Class: Divvy::Verification
- Inherits:
-
Object
- Object
- Divvy::Verification
- Defined in:
- lib/divvy/verification.rb
Instance Attribute Summary collapse
-
#commands ⇒ Object
:nodoc:.
-
#description ⇒ Object
:nodoc:.
-
#package ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#initialize(package, description = '', &block) ⇒ Verification
constructor
:nodoc:.
- #verify(server) ⇒ Object
Constructor Details
#initialize(package, description = '', &block) ⇒ Verification
:nodoc:
6 7 8 9 10 11 12 13 14 |
# File 'lib/divvy/verification.rb', line 6 def initialize(package, description = '', &block) #:nodoc: raise 'Verify requires a block.' unless block @package = package @description = description.empty? ? package.name : description @commands = [] self.instance_eval(&block) end |
Instance Attribute Details
#commands ⇒ Object
:nodoc:
4 5 6 |
# File 'lib/divvy/verification.rb', line 4 def commands @commands end |
#description ⇒ Object
:nodoc:
4 5 6 |
# File 'lib/divvy/verification.rb', line 4 def description @description end |
#package ⇒ Object
:nodoc:
4 5 6 |
# File 'lib/divvy/verification.rb', line 4 def package @package end |
Instance Method Details
#verify(server) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/divvy/verification.rb', line 16 def verify(server) @commands.each do |command| begin server.remote_command(command) rescue Divvy::NonZeroExitCode => ex raise Divvy::VerificationFailed.new(@package, description) end end end |