Class: SmartMachine::Commands::App

Inherits:
Thor
  • Object
show all
Includes:
Utilities
Defined in:
lib/smart_machine/commands/app.rb

Instance Method Summary collapse

Instance Method Details

#create(appname, appdomain, username) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/smart_machine/commands/app.rb', line 7

def create(appname, appdomain, username)
  inside_machine_dir do
    with_docker_running do
      machine = SmartMachine::Machine.new
      machine.run_on_machine commands: "smartengine app creater #{appname} #{appdomain} #{username}"
    end
  end
end

#creater(appname, appdomain, username) ⇒ Object



67
68
69
70
71
72
73
# File 'lib/smart_machine/commands/app.rb', line 67

def creater(appname, appdomain, username)
  inside_engine_machine_dir do
    app = SmartMachine::Apps::App.new(appname: appname, username: username)
    prereceiver_name, prereceiver_config = SmartMachine.config.grids.prereceiver.first
    app.creater(appdomain: appdomain, prereceiver_name: prereceiver_name)
  end
end

#destroy(appname) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/smart_machine/commands/app.rb', line 17

def destroy(appname)
  inside_machine_dir do
    with_docker_running do
      machine = SmartMachine::Machine.new
      machine.run_on_machine commands: "smartengine app destroyer #{appname}"
    end
  end
end

#destroyer(appname) ⇒ Object



76
77
78
79
80
81
# File 'lib/smart_machine/commands/app.rb', line 76

def destroyer(appname)
  inside_engine_machine_dir do
    app = SmartMachine::Apps::App.new(appname: appname)
    app.destroyer
  end
end

#down(appname) ⇒ Object



57
58
59
60
61
62
63
64
# File 'lib/smart_machine/commands/app.rb', line 57

def down(appname)
  inside_machine_dir do
    with_docker_running do
      machine = SmartMachine::Machine.new
      machine.run_on_machine commands: "smartengine app downer #{appname}"
    end
  end
end

#downer(appname) ⇒ Object



104
105
106
107
108
109
# File 'lib/smart_machine/commands/app.rb', line 104

def downer(appname)
  inside_engine_machine_dir do
    app = SmartMachine::Apps::App.new(appname: appname)
    app.downer
  end
end

#ps_scale(appname) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/smart_machine/commands/app.rb', line 30

def ps_scale(appname)
  inside_machine_dir do
    with_docker_running do
      machine = SmartMachine::Machine.new
      command = [
        "smartengine app ps:scaler #{appname}"
      ]
      formation = options[:formation].map { |proctype, count| "#{proctype}:#{count}" }.join(' ')
      command.push("--formation=#{formation}") if options[:formation]
      command.push("--version=#{options[:version]}") if options[:version]
      machine.run_on_machine commands: command.join(" ")
    end
  end
end

#ps_scaler(appname) ⇒ Object



87
88
89
90
91
92
# File 'lib/smart_machine/commands/app.rb', line 87

def ps_scaler(appname)
  inside_engine_machine_dir do
    manager = SmartMachine::Apps::Manager.new(appname: appname, appversion: options[:version])
    manager.ps_scaler(formation: options[:formation])
  end
end

#up(appname) ⇒ Object



47
48
49
50
51
52
53
54
# File 'lib/smart_machine/commands/app.rb', line 47

def up(appname)
  inside_machine_dir do
    with_docker_running do
      machine = SmartMachine::Machine.new
      machine.run_on_machine commands: "smartengine app uper #{appname} --version=#{options[:version]}"
    end
  end
end

#uper(appname) ⇒ Object



96
97
98
99
100
101
# File 'lib/smart_machine/commands/app.rb', line 96

def uper(appname)
  inside_engine_machine_dir do
    app = SmartMachine::Apps::App.new(appname: appname)
    app.uper(version: options[:version])
  end
end