Class: Mysqlknife::Command
- Inherits:
-
Object
- Object
- Mysqlknife::Command
- Defined in:
- lib/mysqlknife/command.rb
Instance Method Summary collapse
- #execute(cmd) ⇒ Object
-
#initialize ⇒ Command
constructor
A new instance of Command.
Constructor Details
#initialize ⇒ Command
Returns a new instance of Command.
5 6 7 8 9 |
# File 'lib/mysqlknife/command.rb', line 5 def initialize @cnf = Configs.instance @ssh = SSH.new @iterm = Iterm.new end |
Instance Method Details
#execute(cmd) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/mysqlknife/command.rb', line 11 def execute(cmd) if cmd.nil? exit 1 end @iterm.color(@cnf.ssh_color) @iterm.name(@cnf.name) if @cnf.ssh_use cmd = @ssh.execute(cmd) end Mysqlknife::Log.new.command(cmd) system cmd ensure @iterm.name @iterm.reset end |