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
10
11
12
|
# File 'lib/jets/turbo.rb', line 10
def afterburner?
new.rails?
end
|
Instance Method Details
#charge ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/jets/turbo.rb', line 17
def charge
framework = detect
case framework
when :jets
when :rails
Rails.new.setup
else
end
end
|
#config_ru_contains?(value) ⇒ Boolean
47
48
49
50
51
52
53
54
|
# File 'lib/jets/turbo.rb', line 47
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
29
30
31
32
33
34
35
36
37
|
# File 'lib/jets/turbo.rb', line 29
def detect
if rails?
:rails
elsif jets?
:jets
else
:unknown_framework
end
end
|
#jets? ⇒ Boolean
43
44
45
|
# File 'lib/jets/turbo.rb', line 43
def jets?
config_ru_contains?('run Jets.application')
end
|
#rails? ⇒ Boolean
39
40
41
|
# File 'lib/jets/turbo.rb', line 39
def rails?
config_ru_contains?('run Rails.application')
end
|