Class: Spork::AppFramework::Rails
Defined Under Namespace
Modules: NinjaPatcher
Constant Summary
SUPPORTED_FRAMEWORKS
Instance Method Summary
collapse
[], #bootstrap_required?, detect_framework, detect_framework_name, setup_autoload, short_name, #short_name
Instance Method Details
#boot_file ⇒ Object
130
131
132
|
# File 'lib/spork/app_framework/rails.rb', line 130
def boot_file
@boot_file ||= File.join(File.dirname(environment_file), 'boot')
end
|
#entry_point ⇒ Object
Also known as:
environment_file
124
125
126
|
# File 'lib/spork/app_framework/rails.rb', line 124
def entry_point
@entry_point ||= File.expand_path("config/environment.rb", Dir.pwd)
end
|
#environment_contents ⇒ Object
134
135
136
|
# File 'lib/spork/app_framework/rails.rb', line 134
def environment_contents
@environment_contents ||= File.read(environment_file)
end
|
#preload(&block) ⇒ Object
116
117
118
119
120
121
122
|
# 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
|
#preload_rails ⇒ Object
152
153
154
155
156
|
# 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
|
#vendor ⇒ Object
138
139
140
|
# File 'lib/spork/app_framework/rails.rb', line 138
def vendor
@vendor ||= File.expand_path("vendor/rails", Dir.pwd)
end
|
#version ⇒ Object
142
143
144
145
146
147
148
149
150
|
# 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
|