aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/rails_guides.rb
blob: e6f0b694a62084fd1b9261d851d779bc748d73d0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
pwd = File.dirname(__FILE__)
$:.unshift pwd

# Loading Action Pack requires rack and erubis.
require 'rubygems'

begin
  # Guides generation in the Rails repo.
  as_lib = File.join(pwd, "../../activesupport/lib")
  ap_lib = File.join(pwd, "../../actionpack/lib")

  $:.unshift as_lib if File.directory?(as_lib)
  $:.unshift ap_lib if File.directory?(ap_lib)
rescue LoadError
  # Guides generation from gems.
  gem "actionpack", '>= 3.0'
end

begin
  gem 'RedCloth', '>= 4.1.1'
  require 'redcloth'
rescue Gem::LoadError
  $stderr.puts %(Generating Guides requires RedCloth 4.1.1+)
  exit 1
end

require "rails_guides/textile_extensions"
RedCloth.send(:include, RailsGuides::TextileExtensions)

require "rails_guides/generator"
RailsGuides::Generator.new.generate