Class: Engage::Runner

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/engage/runner.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



8
9
10
# File 'lib/engage/runner.rb', line 8

def self.banner
  "USAGE: engage [project] [--source SOURCE]"
end

Instance Method Details

#check_parametersObject



12
13
14
15
16
17
18
# File 'lib/engage/runner.rb', line 12

def check_parameters
  if name.blank? && options.source.blank?
    say self.class.banner
    say_status 'quitting...', 'no arguments given.', :red
    raise SystemExit
  end
end

#clone_repoObject



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_gemsetObject



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_bundlerObject



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

#storeObject



37
38
39
40
41
42
# File 'lib/engage/runner.rb', line 37

def store
  return unless adding_source?
  list = sources
  list << options.source
  File.open(file_path, 'w') { |f| f.write(YAML.dump(list.uniq.compact)) }
end