Class: Engage::Runner
- Includes:
- Thor::Actions
- Defined in:
- lib/engage/runner.rb
Class Method Summary collapse
Instance Method Summary collapse
- #check_parameters ⇒ Object
- #clone_repo ⇒ Object
- #generate_gemset ⇒ Object
- #run_bundler ⇒ Object
- #store ⇒ Object
Class Method Details
.banner ⇒ Object
8 9 10 |
# File 'lib/engage/runner.rb', line 8 def self. "USAGE: engage [project] [--source SOURCE]" end |
Instance Method Details
#check_parameters ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/engage/runner.rb', line 12 def check_parameters if name.blank? && .source.blank? say self.class. say_status 'quitting...', 'no arguments given.', :red raise SystemExit end end |
#clone_repo ⇒ Object
20 21 22 23 24 |
# File 'lib/engage/runner.rb', line 20 def clone_repo return if adding_source? source = ask_for_source run "git clone #{source}:#{name}.git" end |
#generate_gemset ⇒ Object
26 27 28 29 30 |
# File 'lib/engage/runner.rb', line 26 def generate_gemset return if adding_source? run "rvm gemset create #{project_name}" create_file "#{project_name}/.rvmrc", selected_ruby end |
#run_bundler ⇒ Object
32 33 34 35 |
# File 'lib/engage/runner.rb', line 32 def run_bundler return if adding_source? run "cd #{project_name} && #{selected_ruby} exec bundle" if using_bundler? end |
#store ⇒ Object
37 38 39 40 41 42 |
# File 'lib/engage/runner.rb', line 37 def store return unless adding_source? list = sources list << .source File.open(file_path, 'w') { |f| f.write(YAML.dump(list.uniq.compact)) } end |