Class: Jets::Turbo
- Inherits:
-
Object
show all
- Extended by:
- Memoist
- Defined in:
- lib/jets/turbo.rb,
lib/jets/turbo/rails.rb,
lib/jets/turbo/database_yaml.rb
Defined Under Namespace
Classes: DatabaseYaml, Rails
Class Method Summary
collapse
-
.afterburner? ⇒ Boolean
Relies on the cached side-effect since Jets afterburner will switch Jets.root and the result will be different.
Instance Method Summary
collapse
Class Method Details
.afterburner? ⇒ Boolean
Relies on the cached side-effect since Jets afterburner will switch Jets.root and the result will be different
9
10
11
|
# File 'lib/jets/turbo.rb', line 9
def afterburner?
new.rails?
end
|
Instance Method Details
#charge ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/jets/turbo.rb', line 16
def charge
framework = detect
case framework
when :jets
when :rails
Rails.new.setup
else
end
end
|
#config_ru_contains?(value) ⇒ Boolean
46
47
48
49
50
51
52
53
|
# File 'lib/jets/turbo.rb', line 46
def config_ru_contains?(value)
root = ENV["JETS_ROOT"] || Dir.pwd config_ru = "#{root}/config.ru"
return false unless File.exist?(config_ru)
lines = ::IO.readlines(config_ru)
!!lines.detect { |l| l.include?(value) }
end
|
#detect ⇒ Object
28
29
30
31
32
33
34
35
36
|
# File 'lib/jets/turbo.rb', line 28
def detect
if rails?
:rails
elsif jets?
:jets
else
:unknown_framework
end
end
|
#jets? ⇒ Boolean
42
43
44
|
# File 'lib/jets/turbo.rb', line 42
def jets?
config_ru_contains?('run Jets.application')
end
|
#rails? ⇒ Boolean
38
39
40
|
# File 'lib/jets/turbo.rb', line 38
def rails?
config_ru_contains?('run Rails.application')
end
|