Class: PolarBear::Review
- Inherits:
-
Object
- Object
- PolarBear::Review
- Defined in:
- lib/polarbear/model/review.rb
Instance Attribute Summary collapse
-
#creation_date ⇒ Object
readonly
Returns the value of attribute creation_date.
-
#creator ⇒ Object
readonly
Returns the value of attribute creator.
-
#diff_args ⇒ Object
Returns the value of attribute diff_args.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#participants ⇒ Object
Returns the value of attribute participants.
-
#phase ⇒ Object
readonly
Returns the value of attribute phase.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #active? ⇒ Boolean
- #add_git_diff(branch_a, branch_b) ⇒ Object
- #add_git_diff_with_args(diffargs) ⇒ Object
- #browse ⇒ Object
- #cancel! ⇒ Object
- #create_it! ⇒ Object
- #delete! ⇒ Object
-
#initialize(hash) ⇒ Review
constructor
A new instance of Review.
- #next_phase! ⇒ Object
- #planning? ⇒ Boolean
Constructor Details
#initialize(hash) ⇒ Review
Returns a new instance of Review.
18 19 20 21 |
# File 'lib/polarbear/model/review.rb', line 18 def initialize(hash) load_data(hash) @admin_review = Command::AdminReview.new end |
Instance Attribute Details
#creation_date ⇒ Object (readonly)
Returns the value of attribute creation_date.
13 14 15 |
# File 'lib/polarbear/model/review.rb', line 13 def creation_date @creation_date end |
#creator ⇒ Object (readonly)
Returns the value of attribute creator.
12 13 14 |
# File 'lib/polarbear/model/review.rb', line 12 def creator @creator end |
#diff_args ⇒ Object
Returns the value of attribute diff_args.
16 17 18 |
# File 'lib/polarbear/model/review.rb', line 16 def diff_args @diff_args end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
11 12 13 |
# File 'lib/polarbear/model/review.rb', line 11 def id @id end |
#participants ⇒ Object
Returns the value of attribute participants.
15 16 17 |
# File 'lib/polarbear/model/review.rb', line 15 def participants @participants end |
#phase ⇒ Object (readonly)
Returns the value of attribute phase.
10 11 12 |
# File 'lib/polarbear/model/review.rb', line 10 def phase @phase end |
#title ⇒ Object
Returns the value of attribute title.
14 15 16 |
# File 'lib/polarbear/model/review.rb', line 14 def title @title end |
Instance Method Details
#active? ⇒ Boolean
23 24 25 |
# File 'lib/polarbear/model/review.rb', line 23 def active? %w(Planning Inspection Rework).include?(@phase) end |
#add_git_diff(branch_a, branch_b) ⇒ Object
47 48 49 50 51 |
# File 'lib/polarbear/model/review.rb', line 47 def add_git_diff(branch_a, branch_b) raise 'must be a valid review' if @review_content[:id].nil? Utils::Executor.instance.execute_command("--no-browser --quiet addgitdiffs #{@review_content[:id]} #{branch_a} #{branch_b}") @diff_args = "#{branch_a} #{branch_b}" end |
#add_git_diff_with_args(diffargs) ⇒ Object
53 54 55 56 57 |
# File 'lib/polarbear/model/review.rb', line 53 def add_git_diff_with_args(diffargs) raise 'must be a valid review' if @review_content[:id].nil? Utils::Executor.instance.execute_command("--no-browser --quiet addgitdiffs #{@review_content[:id]} #{diffargs}") @diff_args = diffargs end |
#browse ⇒ Object
43 44 45 |
# File 'lib/polarbear/model/review.rb', line 43 def browse Utils::Executor.instance.execute_command("browse --review #{@id}") end |
#cancel! ⇒ Object
31 32 33 |
# File 'lib/polarbear/model/review.rb', line 31 def cancel! @admin_review.cancel(@id) end |
#create_it! ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/polarbear/model/review.rb', line 59 def create_it! can_create? = PolarBear::Command::GlobalOptions.new batch = PolarBear::Command::Batch.new() batch.add_command(':admin_review_create', {:title => "#{@title}"}) unless @title.nil? batch.add_command(':admin_review_create/', '') if @title.nil? load_participants_in_batch(batch) batch.add_command(':admin_review_finish', {:review => 'last'}) batch.add_command(':admin_review-xml', {:review => 'last'}) update_review_from_xml(batch.execute) end |
#delete! ⇒ Object
35 36 37 |
# File 'lib/polarbear/model/review.rb', line 35 def delete! @admin_review.delete(@id) end |
#next_phase! ⇒ Object
39 40 41 |
# File 'lib/polarbear/model/review.rb', line 39 def next_phase! @admin_review.finish(@id) end |
#planning? ⇒ Boolean
27 28 29 |
# File 'lib/polarbear/model/review.rb', line 27 def planning? %w(Planning).include?(@phase) end |