Class: Dokuen::CLI
- Inherits:
-
Thor
- Object
- Thor
- Dokuen::CLI
- Includes:
- Thor::Actions
- Defined in:
- lib/dokuen/cli.rb
Instance Method Summary collapse
- #boot ⇒ Object
- #buildpacks ⇒ Object
- #config ⇒ Object
- #config_delete(*vars) ⇒ Object
- #config_set(*vars) ⇒ Object
- #create ⇒ Object
- #deploy ⇒ Object
-
#initialize(*args) ⇒ CLI
constructor
A new instance of CLI.
- #install_buildpack(url) ⇒ Object
- #remove_buildpack(name) ⇒ Object
- #restart ⇒ Object
- #run_command(*args) ⇒ Object
- #scale(spec) ⇒ Object
- #setup(dir) ⇒ Object
- #shutdown ⇒ Object
Constructor Details
Instance Method Details
#boot ⇒ Object
100 101 102 103 104 105 106 107 |
# File 'lib/dokuen/cli.rb', line 100 def boot Dir.glob("#{@config.dokuen_dir}/apps/*") do |appdir| next if File.basename(appdir)[0] == '.' app = Dokuen::Application.new(File.basename(appdir), @config) app.clean app.scale end end |
#buildpacks ⇒ Object
129 130 131 |
# File 'lib/dokuen/cli.rb', line 129 def buildpacks system("#{@config.bin_path}/mason buildpacks") end |
#config ⇒ Object
67 68 69 70 71 72 |
# File 'lib/dokuen/cli.rb', line 67 def config app = Dokuen::Application.new([:application], @config) app.env.each do |key, val| puts "#{key}=#{val}" end end |
#config_delete(*vars) ⇒ Object
91 92 93 94 95 96 97 |
# File 'lib/dokuen/cli.rb', line 91 def config_delete(*vars) app = Dokuen::Application.new([:application], @config) vars.each do |var| app.delete_env(var) end app.restart end |
#config_set(*vars) ⇒ Object
75 76 77 78 79 80 81 82 |
# File 'lib/dokuen/cli.rb', line 75 def config_set(*vars) app = Dokuen::Application.new([:application], @config) vars.each do |var| key, val = var.chomp.split('=', 2) app.set_env(key, val) end app.restart end |
#create ⇒ Object
43 44 45 46 |
# File 'lib/dokuen/cli.rb', line 43 def create Dokuen::Application.new([:application], @config).create puts "git remote add dokuen #{@config.git_user}@#{@config.git_server}:apps/#{[:application]}.git" end |
#deploy ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/dokuen/cli.rb', line 50 def deploy ENV['GIT_DIR'] = nil ENV['PATH'] = "#{@config.bin_path}:#{ENV['PATH']}" ENV.each do |k,v| puts "#{k}=#{v}" end Dokuen::Application.new([:application], @config).deploy([:rev]) end |
#install_buildpack(url) ⇒ Object
119 120 121 |
# File 'lib/dokuen/cli.rb', line 119 def install_buildpack(url) system("#{@config.bin_path}/mason buildpacks:install #{url}") end |
#remove_buildpack(name) ⇒ Object
124 125 126 |
# File 'lib/dokuen/cli.rb', line 124 def remove_buildpack(name) system("#{@config.bin_path}/mason buildpacks:uninstall #{name}") end |
#restart ⇒ Object
85 86 87 88 |
# File 'lib/dokuen/cli.rb', line 85 def restart app = Dokuen::Application.new([:application], @config) app.restart end |
#run_command(*args) ⇒ Object
134 135 136 137 |
# File 'lib/dokuen/cli.rb', line 134 def run_command(*args) app = Dokuen::Application.new([:application], @config) app.run_command(args) end |
#scale(spec) ⇒ Object
60 61 62 63 64 |
# File 'lib/dokuen/cli.rb', line 60 def scale(spec) app = Dokuen::Application.new([:application], @config) app.set_env('DOKUEN_SCALE', spec) app.scale end |
#setup(dir) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/dokuen/cli.rb', line 27 def setup(dir) @current_script = File.($0) @current_bin_path = File.dirname(@current_script) Dir.chdir(dir) do setup_dirs setup_bin setup_gitolite write_config install_boot_script puts Dokuen.template('instructions', binding) end end |
#shutdown ⇒ Object
110 111 112 113 114 115 116 |
# File 'lib/dokuen/cli.rb', line 110 def shutdown Dir.glob("#{@config.dokuen_dir}/apps/*") do |appdir| next if File.basename(appdir)[0] == '.' app = Dokuen::Application.new(File.basename(appdir), @config) app.shutdown end end |