Class: Hudson::Installation::Progress

Inherits:
Object
  • Object
show all
Defined in:
lib/hudson/installation.rb

Defined Under Namespace

Classes: Ok

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeProgress

Returns a new instance of Progress.



107
108
109
110
# File 'lib/hudson/installation.rb', line 107

def initialize
  @shell = Thor::Shell::Color.new
  @aborted = false
end

Instance Attribute Details

#abortedObject (readonly)

Returns the value of attribute aborted.



106
107
108
# File 'lib/hudson/installation.rb', line 106

def aborted
  @aborted
end

Instance Method Details

#means(step) ⇒ Object



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/hudson/installation.rb', line 112

def means(step)
  return if @aborted
  begin
    @shell.say(step + "... ")
    yield(self).tap do
      @shell.say("[OK]", :green)
    end
  rescue Ok => ok
    @shell.say("[OK#{ok.message ? " - #{ok.message}" : ''}]", :green)
  rescue StandardError => e
    @shell.say("[FAIL - #{e.message}]", :red)
    @aborted = true
    false
  end
end

#ok(msg = nil) ⇒ Object

Raises:



128
129
130
# File 'lib/hudson/installation.rb', line 128

def ok(msg = nil)
  raise Ok.new(msg)
end