Class: Wordmove::LocalHost

Inherits:
Object
  • Object
show all
Defined in:
lib/wordmove/hosts/local_host.rb

Direct Known Subclasses

RemoteHost

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ LocalHost

Returns a new instance of LocalHost.



10
11
12
13
14
15
16
17
18
19
# File 'lib/wordmove/hosts/local_host.rb', line 10

def initialize(options = {})
  @options = Hashie::Mash.new(options)
  @logger = @options[:logger]
  @ssh_extras = {}
  [ :port, :password ].each do |p|
    @ssh_extras.merge!( { p => @options.ssh[p] } ) if @options.ssh and @options.ssh[p]
  end

  puts "SSH options: #{@ssh_extras.inspect}"
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



7
8
9
# File 'lib/wordmove/hosts/local_host.rb', line 7

def logger
  @logger
end

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/wordmove/hosts/local_host.rb', line 6

def options
  @options
end

#ssh_extrasObject (readonly)

Returns the value of attribute ssh_extras.



8
9
10
# File 'lib/wordmove/hosts/local_host.rb', line 8

def ssh_extras
  @ssh_extras
end

Instance Method Details

#closeObject



29
30
# File 'lib/wordmove/hosts/local_host.rb', line 29

def close
end

#run(*args) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/wordmove/hosts/local_host.rb', line 21

def run(*args)
  command = shell_command(*args)
  logger.verbose "Executing locally #{command}"
  unless system(command)
    raise Thor::Error, "Error executing \"#{command}\""
  end
end