Class: SmartMachine::Commands::GridCommands::Mysql

Inherits:
SubThor
  • Object
show all
Includes:
Utilities
Defined in:
lib/smart_machine/commands/grid_commands/mysql.rb

Instance Method Summary collapse

Methods inherited from SubThor

banner, subcommand_prefix

Instance Method Details

#downObject



21
22
23
24
25
26
27
28
29
# File 'lib/smart_machine/commands/grid_commands/mysql.rb', line 21

def down
  inside_machine_dir do
    with_docker_running do
      machine = SmartMachine::Machine.new
      name_option = options[:name] ? " --name=#{options[:name]}" : ""
      machine.run_on_machine commands: "smartengine grid mysql downer#{name_option}"
    end
  end
end

#downerObject



55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/smart_machine/commands/grid_commands/mysql.rb', line 55

def downer
  inside_engine_machine_dir do
    if options[:name]
      mysql = SmartMachine::Grids::Mysql.new(name: options[:name])
      mysql.downer
    else
      SmartMachine.config.grids.mysql.each do |name, config|
        mysql = SmartMachine::Grids::Mysql.new(name: name.to_s)
        mysql.downer
      end
    end
  end
end

#upObject



9
10
11
12
13
14
15
16
17
# File 'lib/smart_machine/commands/grid_commands/mysql.rb', line 9

def up
  inside_machine_dir do
    with_docker_running do
      machine = SmartMachine::Machine.new
      name_option = options[:name] ? " --name=#{options[:name]}" : ""
      machine.run_on_machine commands: "smartengine grid mysql uper#{name_option}"
    end
  end
end

#uperObject



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/smart_machine/commands/grid_commands/mysql.rb', line 39

def uper
  inside_engine_machine_dir do
    if options[:name]
      mysql = SmartMachine::Grids::Mysql.new(name: options[:name])
      mysql.uper
    else
      SmartMachine.config.grids.mysql.each do |name, config|
        mysql = SmartMachine::Grids::Mysql.new(name: name.to_s)
        mysql.uper
      end
    end
  end
end