Class: Divvy::PackageRunner
- Inherits:
-
Object
- Object
- Divvy::PackageRunner
- Defined in:
- lib/divvy/package_runner.rb
Instance Attribute Summary collapse
-
#package ⇒ Object
readonly
Returns the value of attribute package.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
Instance Method Summary collapse
-
#initialize(server, package) ⇒ PackageRunner
constructor
A new instance of PackageRunner.
- #process ⇒ Object
- #run(command, options = {}) ⇒ Object
- #scp(source, destination, options = {}) ⇒ Object
Constructor Details
#initialize(server, package) ⇒ PackageRunner
Returns a new instance of PackageRunner.
3 4 5 |
# File 'lib/divvy/package_runner.rb', line 3 def initialize(server, package) @server, @package = server, package end |
Instance Attribute Details
#package ⇒ Object (readonly)
Returns the value of attribute package.
7 8 9 |
# File 'lib/divvy/package_runner.rb', line 7 def package @package end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
7 8 9 |
# File 'lib/divvy/package_runner.rb', line 7 def server @server end |
Instance Method Details
#process ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/divvy/package_runner.rb', line 17 def process puts "==> Processing #{package.name}" unless package.verifications.empty? begin process_verifications(true) puts " --> #{package.name} already installed package: #{server.host}" return rescue Divvy::VerificationFailed => e # Yaay package not installed yet end end self.instance_eval(&package.apply_block) unless package.apply_block.nil? process_verifications end |
#run(command, options = {}) ⇒ Object
9 10 11 |
# File 'lib/divvy/package_runner.rb', line 9 def run(command, = {}) server.remote_command(command, ) end |
#scp(source, destination, options = {}) ⇒ Object
13 14 15 |
# File 'lib/divvy/package_runner.rb', line 13 def scp(source, destination, = {}) server.scp(source, destination, ) end |