Class: FogbugzListener
- Inherits:
-
Object
- Object
- FogbugzListener
- Defined in:
- lib/fogbugz_listener.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #case(bugid) ⇒ Object
- #close ⇒ Object
- #complete ⇒ Object
- #fix ⇒ Object
- #implement ⇒ Object
-
#initialize(options = {}) ⇒ FogbugzListener
constructor
A new instance of FogbugzListener.
- #reference ⇒ Object
- #reopen ⇒ Object
- #resolve ⇒ Object
- #update_fogbugz(service) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ FogbugzListener
Returns a new instance of FogbugzListener.
4 5 6 7 8 |
# File 'lib/fogbugz_listener.rb', line 4 def initialize(={}) @options = @state = :invalid @actions = Hash.new {|h, k| h[k] = Array.new} end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
2 3 4 |
# File 'lib/fogbugz_listener.rb', line 2 def @options end |
Instance Method Details
#case(bugid) ⇒ Object
34 35 36 |
# File 'lib/fogbugz_listener.rb', line 34 def case(bugid) @actions[@state] << bugid end |
#close ⇒ Object
22 23 24 |
# File 'lib/fogbugz_listener.rb', line 22 def close @state = :close end |
#complete ⇒ Object
30 31 32 |
# File 'lib/fogbugz_listener.rb', line 30 def complete @state = :complete end |
#fix ⇒ Object
10 11 12 |
# File 'lib/fogbugz_listener.rb', line 10 def fix @state = :fix end |
#implement ⇒ Object
14 15 16 |
# File 'lib/fogbugz_listener.rb', line 14 def implement @state = :implement end |
#reference ⇒ Object
26 27 28 |
# File 'lib/fogbugz_listener.rb', line 26 def reference @state = :reference end |
#reopen ⇒ Object
18 19 20 |
# File 'lib/fogbugz_listener.rb', line 18 def reopen @state = :reopen end |
#resolve ⇒ Object
38 39 40 |
# File 'lib/fogbugz_listener.rb', line 38 def resolve @state = :resolve end |
#update_fogbugz(service) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/fogbugz_listener.rb', line 42 def update_fogbugz(service) references = @actions.delete(:reference) = "" << "Commit: #{[:sha1]}\n" << "#{[:commit_url]}\n" if [:commit_url] = + "\n" + [:message] if @actions.empty? then references.each do |bugid| service.(:case => bugid, :message => ) end if references else << "\n\nReferences " << references.map {|bugid| "case #{bugid}"}.join(", ") if references && !references.empty? @actions.each_pair do |action, bugids| bugids.each do |bugid| service.send(action, :case => bugid, :message => ) end end end end |