Sha256: 70cfa1e2d4d531bec1668962d19a66f11ffcb661be6ab76282a051c9173a98d1

Contents?: true

Size: 1.27 KB

Versions: 7

Compression:

Stored size: 1.27 KB

Contents

pwd = File.dirname(__FILE__)
$:.unshift pwd

# This is a predicate useful for the doc:guides task of applications.
def bundler?
  # Note that rake sets the cwd to the one that contains the Rakefile
  # being executed.
  File.exists?('Gemfile')
end

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
  require 'redcarpet'
rescue LoadError
  # This can happen if doc:guides is executed in an application.
  $stderr.puts('Generating guides requires Redcarpet 2.1.1+.')
  $stderr.puts(<<ERROR) if bundler?
Please add

  gem 'redcarpet', '~> 2.1.1'

to the Gemfile, run

  bundle install

and try again.
ERROR
  exit 1
end

begin
  require 'nokogiri'
rescue LoadError
  # This can happen if doc:guides is executed in an application.
  $stderr.puts('Generating guides requires Nokogiri.')
  $stderr.puts(<<ERROR) if bundler?
Please add

  gem 'nokogiri'

to the Gemfile, run

  bundle install

and try again.
ERROR
  exit 1
end

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rails-4.0.3 guides/rails_guides.rb
rails-4.0.2 guides/rails_guides.rb
rails-4.0.1 guides/rails_guides.rb
rails-4.0.1.rc4 guides/rails_guides.rb
rails-4.0.1.rc3 guides/rails_guides.rb
rails-4.0.1.rc2 guides/rails_guides.rb
rails-4.0.1.rc1 guides/rails_guides.rb