Class: AnnotateRb::RakeBootstrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/annotate_rb/rake_bootstrapper.rb

Class Method Summary collapse

Class Method Details

.call(options) ⇒ Object



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
# File 'lib/annotate_rb/rake_bootstrapper.rb', line 6

def call(options)
  begin
    require "rake/dsl_definition"
  rescue => e
    # We might just be on an old version of Rake...
    warn e.message
    exit e.status_code
  end

  require "rake"
  load "./Rakefile" if File.exist?("./Rakefile")

  begin
    Rake::Task[:environment].invoke
  rescue
    nil
  end

  unless defined?(Rails)
    # Not in a Rails project, so time to load up the parts of
    # ActiveSupport we need.
    require "active_support"
    require "active_support/core_ext/class/subclasses"
    require "active_support/core_ext/string/inflections"
  end
end