Class: NewlineHw::Shell::Runners::Ruby
- Inherits:
-
Base
- Object
- Base
- NewlineHw::Shell::Runners::Ruby
show all
- Defined in:
- lib/newline_hw/shell/runners/ruby.rb
Overview
Build a shell command that is dependent on files of a project being present that are UNOPINIONATED about how to setup / start a ruby related project
Instance Attribute Summary
Attributes inherited from Base
#commands, #pwd
Instance Method Summary
collapse
Methods inherited from Base
#add_command, #file?, #file_contents?, #file_path, get_commands, #initialize
Instance Method Details
#_rails_commands ⇒ Object
21
22
23
24
25
26
27
|
# File 'lib/newline_hw/shell/runners/ruby.rb', line 21
def _rails_commands
add_command "spring stop" if spring?
add_command "bin/rake db:setup"
add_command "bin/rails s & sleep #{SLEEP_TIME} && open http://localhost:3000"
add_command "bin/rake test"
add_command "sleep 1 && %%" end
|
#gemfile? ⇒ Boolean
13
14
15
|
# File 'lib/newline_hw/shell/runners/ruby.rb', line 13
def gemfile?
file?("Gemfile")
end
|
#prepare_commands ⇒ Object
29
30
31
32
|
# File 'lib/newline_hw/shell/runners/ruby.rb', line 29
def prepare_commands
add_command "bundle install" if gemfile?
_rails_commands if rails?
end
|
#rails? ⇒ Boolean
9
10
11
|
# File 'lib/newline_hw/shell/runners/ruby.rb', line 9
def rails?
file?("bin", "rails")
end
|
#spring? ⇒ Boolean
17
18
19
|
# File 'lib/newline_hw/shell/runners/ruby.rb', line 17
def spring?
file_contents?(/spring/, "Gemfile.lock")
end
|