Class: Jets::Turbo
- Inherits:
-
Object
show all
- Defined in:
- lib/jets/turbo.rb,
lib/jets/turbo/rail.rb,
lib/jets/turbo/database_yaml.rb
Defined Under Namespace
Classes: DatabaseYaml, Rail
Instance Method Summary
collapse
Instance Method Details
#charge ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/jets/turbo.rb', line 9
def charge
framework = detect
case framework
when :jets
when :rails
Rail.new.setup
else
end
end
|
#config_ru_contains?(value) ⇒ Boolean
39
40
41
42
43
44
45
|
# File 'lib/jets/turbo.rb', line 39
def config_ru_contains?(value)
config_ru = "#{Dir.pwd}/config.ru"
return false unless File.exist?(config_ru)
lines = ::IO.readlines(config_ru)
lines.detect { |l| l.include?(value) }
end
|
#detect ⇒ Object
21
22
23
24
25
26
27
28
29
|
# File 'lib/jets/turbo.rb', line 21
def detect
if rails?
:rails
elsif jets?
:jets
else
:unknown_framework
end
end
|
#jets? ⇒ Boolean
35
36
37
|
# File 'lib/jets/turbo.rb', line 35
def jets?
config_ru_contains?('run Jets.application')
end
|
#rails? ⇒ Boolean
31
32
33
|
# File 'lib/jets/turbo.rb', line 31
def rails?
config_ru_contains?('run Rails.application')
end
|