Class Spork::AppFramework::Rails
In: lib/spork/app_framework/rails.rb
Parent: Spork::AppFramework

Methods

Classes and Modules

Module Spork::AppFramework::Rails::NinjaPatcher

Public Instance methods

[Source]

# File lib/spork/app_framework/rails.rb, line 130
  def boot_file
    @boot_file ||= File.join(File.dirname(environment_file), 'boot')
  end

[Source]

# File lib/spork/app_framework/rails.rb, line 124
  def entry_point
    @entry_point ||= File.expand_path("config/environment.rb", Dir.pwd)
  end

[Source]

# File lib/spork/app_framework/rails.rb, line 134
  def environment_contents
    @environment_contents ||= File.read(environment_file)
  end
environment_file()

Alias for entry_point

[Source]

# File lib/spork/app_framework/rails.rb, line 116
  def preload(&block)
    STDERR.puts "Preloading Rails environment"
    STDERR.flush
    ENV["RAILS_ENV"] ||= 'test'
    preload_rails
    yield
  end

[Source]

# File lib/spork/app_framework/rails.rb, line 152
  def preload_rails
    Object.const_set(:RAILS_GEM_VERSION, version) if version
    require boot_file
    ::Rails::Initializer.send(:include, Spork::AppFramework::Rails::NinjaPatcher)
  end

[Source]

# File lib/spork/app_framework/rails.rb, line 138
  def vendor
    @vendor ||= File.expand_path("vendor/rails", Dir.pwd)
  end

[Source]

# File lib/spork/app_framework/rails.rb, line 142
  def version
    @version ||= (
      if /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/.match(environment_contents)
        $1
      else
        nil
      end
    )
  end

[Validate]