2009-02-28 02:23:00 +01:00
|
|
|
pwd = File.dirname(__FILE__)
|
2010-09-05 22:24:15 +02:00
|
|
|
$:.unshift pwd
|
|
|
|
|
|
|
|
# Loading Action Pack requires rack and erubis.
|
|
|
|
require 'rubygems'
|
2009-02-28 02:23:00 +01:00
|
|
|
|
2009-08-04 17:16:03 +02:00
|
|
|
begin
|
2010-09-05 22:24:15 +02:00
|
|
|
# Guides generation in the Rails repo.
|
2009-08-04 17:16:03 +02:00
|
|
|
as_lib = File.join(pwd, "../../activesupport/lib")
|
|
|
|
ap_lib = File.join(pwd, "../../actionpack/lib")
|
|
|
|
|
2010-09-05 22:24:15 +02:00
|
|
|
$:.unshift as_lib if File.directory?(as_lib)
|
|
|
|
$:.unshift ap_lib if File.directory?(ap_lib)
|
2009-08-04 17:16:03 +02:00
|
|
|
rescue LoadError
|
2010-09-05 22:24:15 +02:00
|
|
|
# Guides generation from gems.
|
2009-08-04 17:16:03 +02:00
|
|
|
gem "actionpack", '>= 2.3'
|
|
|
|
end
|
2009-02-28 02:23:00 +01:00
|
|
|
|
|
|
|
begin
|
2009-08-04 17:16:03 +02:00
|
|
|
gem 'RedCloth', '>= 4.1.1'
|
2010-09-05 22:24:15 +02:00
|
|
|
require 'redcloth'
|
2009-02-28 02:23:00 +01:00
|
|
|
rescue Gem::LoadError
|
2010-09-05 22:24:15 +02:00
|
|
|
$stderr.puts('Generating guides requires RedCloth 4.1.1+.')
|
2009-02-28 02:23:00 +01:00
|
|
|
exit 1
|
|
|
|
end
|
|
|
|
|
2010-09-05 22:24:15 +02:00
|
|
|
require "rails_guides/textile_extensions"
|
2009-02-28 02:23:00 +01:00
|
|
|
RedCloth.send(:include, RailsGuides::TextileExtensions)
|
|
|
|
|
2010-09-05 22:24:15 +02:00
|
|
|
require "rails_guides/generator"
|
|
|
|
RailsGuides::Generator.new.generate
|