Class: GitPusshuTen::Commands::Remote

Inherits:
Base
  • Object
show all
Defined in:
lib/gitpusshuten/commands/remote.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#cli, #command, #configuration, #environment, #hooks, #perform_hooks

Instance Method Summary collapse

Methods inherited from Base

#c, #command_object, description, #e, #error, example, #g, #git, #help, #local, long_description, #message, #perform!, #perform_hooks!, #post_perform!, #pre_perform!, #prompt_for_root_password!, #prompt_for_user_password!, #r, #requires_user_existence!, #silent, #standard, usage, #validate!, #warning, #y, #yes?

Constructor Details

#initialize(*objects) ⇒ Remote

Returns a new instance of Remote.



11
12
13
14
15
16
17
18
# File 'lib/gitpusshuten/commands/remote.rb', line 11

def initialize(*objects)
  super
          
  @command = cli.arguments.shift if cli.arguments.any?
  @command_to_execute = cli.arguments.join(' ') if cli.arguments.any?
  
  help if command.nil? or command_to_execute.nil? or e.name.nil?
end

Instance Attribute Details

#command_to_executeObject

Returns the value of attribute command_to_execute.



9
10
11
# File 'lib/gitpusshuten/commands/remote.rb', line 9

def command_to_execute
  @command_to_execute
end

Instance Method Details

#perform_command!Object

Performs a unix command on the remote server



22
23
24
25
# File 'lib/gitpusshuten/commands/remote.rb', line 22

def perform_command!
  message "Performing command on #{y(c.application)} (#{y(e.name)}) at #{y(c.ip)}!"
  puts e.execute_as_user("cd #{e.app_dir}; #{command_to_execute}")
end