Class: Duke::Cli
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Duke::Cli
- Includes:
- Thor::Actions
- Defined in:
- lib/duke/cli.rb
Instance Method Summary collapse
- #add(repo_url) ⇒ Object
- #build(repo_dir) ⇒ Object
- #cijoed(repo_dir, port, log_file, pid_file) ⇒ Object
- #list ⇒ Object
- #new(dir = nil) ⇒ Object
- #runner(repo_dir, cmd) ⇒ Object
- #rvm_exec(repo_dir, cmd) ⇒ Object
- #start(repo_dir, port) ⇒ Object
- #stop(repo_dir) ⇒ Object
Instance Method Details
#add(repo_url) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/duke/cli.rb', line 15 def add(repo_url) p = Project.create(:repo_url => repo_url) puts <<-MSG *** #{p.repo_dir} has been cloned and configured! *** Don't forget to: *** set up #{p.repo_dir}/config/database.yml *** create the project gemset *** run bundle install *** start up cijoe! MSG end |
#build(repo_dir) ⇒ Object
39 40 41 |
# File 'lib/duke/cli.rb', line 39 def build(repo_dir) Project.find(:repo_dir => repo_dir).build end |
#cijoed(repo_dir, port, log_file, pid_file) ⇒ Object
43 44 45 46 |
# File 'lib/duke/cli.rb', line 43 def cijoed(repo_dir, port, log_file, pid_file) cmd = "nohup cijoe -p #{port} #{repo_dir} 1>#{log_file} 2>&1 & echo $! > #{pid_file}" exec(rvm_exec(repo_dir, cmd)) end |
#list ⇒ Object
35 36 37 |
# File 'lib/duke/cli.rb', line 35 def list Project.all.each(&:print_status_msg) end |
#new(dir = nil) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/duke/cli.rb', line 7 def new(dir=nil) dir ||= "." [:pid_dir, :log_dir].collect do |meth| FileUtils.mkdir_p("#{dir}/#{Config.send(meth)}") end directory 'templates', dir end |
#runner(repo_dir, cmd) ⇒ Object
48 49 50 |
# File 'lib/duke/cli.rb', line 48 def runner(repo_dir, cmd) Project.find(:repo_dir => repo_dir).set_runner(cmd) end |
#rvm_exec(repo_dir, cmd) ⇒ Object
52 53 54 55 56 |
# File 'lib/duke/cli.rb', line 52 def rvm_exec(repo_dir, cmd) path = "#{repo_dir}/.rvmrc" cmd = "#{File.read(path)} exec '#{cmd}'" if File.exist?(path) cmd end |