Class: Wordmove::LocalHost
- Inherits:
-
Object
- Object
- Wordmove::LocalHost
- Defined in:
- lib/wordmove/hosts/local_host.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#ssh_extras ⇒ Object
readonly
Returns the value of attribute ssh_extras.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(options = {}) ⇒ LocalHost
constructor
A new instance of LocalHost.
- #run(*args) ⇒ Object
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 = Hashie::Mash.new() @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
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
7 8 9 |
# File 'lib/wordmove/hosts/local_host.rb', line 7 def logger @logger end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/wordmove/hosts/local_host.rb', line 6 def @options end |
#ssh_extras ⇒ Object (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
#close ⇒ Object
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 |