Class: Reviewr::Project
- Inherits:
-
Object
- Object
- Reviewr::Project
- Extended by:
- Forwardable
- Defined in:
- lib/reviewr/project.rb
Instance Attribute Summary collapse
-
#email_password ⇒ Object
Returns the value of attribute email_password.
-
#email_server ⇒ Object
readonly
Returns the value of attribute email_server.
-
#git ⇒ Object
readonly
Returns the value of attribute git.
- #review_branch ⇒ Object
-
#to ⇒ Object
Returns the value of attribute to.
- #user_email ⇒ Object
Instance Method Summary collapse
- #create_review_branch(base = 'master') ⇒ Object
- #create_review_commit(msg) ⇒ Object
- #delete_remote_review_branch ⇒ Object
- #fetch_master ⇒ Object
- #fetch_review_branch ⇒ Object
-
#initialize(git = Git.instance) ⇒ Project
constructor
A new instance of Project.
- #master_sha ⇒ Object
- #merge_commits ⇒ Object
- #push_review_branch ⇒ Object
- #rebase_review ⇒ Object
- #requester_email ⇒ Object
- #review_body ⇒ Object
- #review_sha ⇒ Object
- #review_subject ⇒ Object
Constructor Details
Instance Attribute Details
#email_password ⇒ Object
Returns the value of attribute email_password.
8 9 10 |
# File 'lib/reviewr/project.rb', line 8 def email_password @email_password end |
#email_server ⇒ Object (readonly)
Returns the value of attribute email_server.
7 8 9 |
# File 'lib/reviewr/project.rb', line 7 def email_server @email_server end |
#git ⇒ Object (readonly)
Returns the value of attribute git.
7 8 9 |
# File 'lib/reviewr/project.rb', line 7 def git @git end |
#review_branch ⇒ Object
59 60 61 |
# File 'lib/reviewr/project.rb', line 59 def review_branch @review_branch ||= "review_#{review_sha}" end |
#to ⇒ Object
Returns the value of attribute to.
8 9 10 |
# File 'lib/reviewr/project.rb', line 8 def to @to end |
#user_email ⇒ Object
63 64 65 |
# File 'lib/reviewr/project.rb', line 63 def user_email @user_email ||= git.user_email end |
Instance Method Details
#create_review_branch(base = 'master') ⇒ Object
18 19 20 21 |
# File 'lib/reviewr/project.rb', line 18 def create_review_branch(base = 'master') git.create_branch(review_branch, base) git.change_branch(review_branch) end |
#create_review_commit(msg) ⇒ Object
35 36 37 |
# File 'lib/reviewr/project.rb', line 35 def create_review_commit(msg) git.commit(msg) end |
#delete_remote_review_branch ⇒ Object
77 78 79 |
# File 'lib/reviewr/project.rb', line 77 def delete_remote_review_branch git.push_branch(":#{review_branch}") end |
#fetch_master ⇒ Object
31 32 33 |
# File 'lib/reviewr/project.rb', line 31 def fetch_master git.fetch('master') end |
#fetch_review_branch ⇒ Object
27 28 29 |
# File 'lib/reviewr/project.rb', line 27 def fetch_review_branch git.fetch(review_branch) end |
#master_sha ⇒ Object
55 56 57 |
# File 'lib/reviewr/project.rb', line 55 def master_sha @master_sha ||= git.origin_master_commit.slice(0, 8) end |
#merge_commits ⇒ Object
71 72 73 74 75 |
# File 'lib/reviewr/project.rb', line 71 def merge_commits git.cherry(current_branch, review_branch).split(/\n/).each do |line| git.cherry_pick(line.split(/\s/)[1]) end end |
#push_review_branch ⇒ Object
39 40 41 |
# File 'lib/reviewr/project.rb', line 39 def push_review_branch git.push_branch(review_branch) end |
#rebase_review ⇒ Object
23 24 25 |
# File 'lib/reviewr/project.rb', line 23 def rebase_review git.rebase(current_branch, review_branch) end |
#requester_email ⇒ Object
81 82 83 84 85 86 87 |
# File 'lib/reviewr/project.rb', line 81 def requester_email msg = git.log(1) if msg m = msg.match(/requested_by: ([^\s]+)/) m && m[1] end end |
#review_body ⇒ Object
51 52 53 |
# File 'lib/reviewr/project.rb', line 51 def review_body @review_body ||= git.last_commit_body end |
#review_sha ⇒ Object
43 44 45 |
# File 'lib/reviewr/project.rb', line 43 def review_sha @review_sha ||= git.last_commit_sha.slice(0, 8) end |
#review_subject ⇒ Object
47 48 49 |
# File 'lib/reviewr/project.rb', line 47 def review_subject @review_subject ||= git.last_commit_subject end |