Class: HustleAndFlow::IssueTrackers::Github::Commands::Ready
- Inherits:
-
Object
- Object
- HustleAndFlow::IssueTrackers::Github::Commands::Ready
- Defined in:
- lib/hustle_and_flow/issue_trackers/github/commands/ready.rb
Instance Attribute Summary collapse
-
#branch_name ⇒ Object
Returns the value of attribute branch_name.
-
#io ⇒ Object
Returns the value of attribute io.
-
#issues ⇒ Object
Returns the value of attribute issues.
-
#me ⇒ Object
Returns the value of attribute me.
-
#pull_requests ⇒ Object
Returns the value of attribute pull_requests.
-
#tracker ⇒ Object
Returns the value of attribute tracker.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(**args) ⇒ Ready
constructor
A new instance of Ready.
Constructor Details
#initialize(**args) ⇒ Ready
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/hustle_and_flow/issue_trackers/github/commands/ready.rb', line 17 def initialize(**args) self.branch_name = args[:branch_name] self.me = args[:me] self.io = args[:io] self.tracker = Github::Tracker.new(repo: args[:repo]) self.pull_requests = Github::PullRequests.new tracker: tracker, io: io self.issues = Github::Issues.new tracker: tracker, io: io end |
Instance Attribute Details
#branch_name ⇒ Object
Returns the value of attribute branch_name.
10 11 12 |
# File 'lib/hustle_and_flow/issue_trackers/github/commands/ready.rb', line 10 def branch_name @branch_name end |
#io ⇒ Object
Returns the value of attribute io.
10 11 12 |
# File 'lib/hustle_and_flow/issue_trackers/github/commands/ready.rb', line 10 def io @io end |
#issues ⇒ Object
Returns the value of attribute issues.
10 11 12 |
# File 'lib/hustle_and_flow/issue_trackers/github/commands/ready.rb', line 10 def issues @issues end |
#me ⇒ Object
Returns the value of attribute me.
10 11 12 |
# File 'lib/hustle_and_flow/issue_trackers/github/commands/ready.rb', line 10 def me @me end |
#pull_requests ⇒ Object
Returns the value of attribute pull_requests.
10 11 12 |
# File 'lib/hustle_and_flow/issue_trackers/github/commands/ready.rb', line 10 def pull_requests @pull_requests end |
#tracker ⇒ Object
Returns the value of attribute tracker.
10 11 12 |
# File 'lib/hustle_and_flow/issue_trackers/github/commands/ready.rb', line 10 def tracker @tracker end |
Class Method Details
.call(**args) ⇒ Object
71 72 73 |
# File 'lib/hustle_and_flow/issue_trackers/github/commands/ready.rb', line 71 def self.call(**args) new(**args).call end |
Instance Method Details
#call ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/hustle_and_flow/issue_trackers/github/commands/ready.rb', line 28 def call pull_request = pull_requests.find(branch: branch_name) issue = issues.filter_by_branch(branch: branch_name).first if !issue && !pull_request io.say "Couldn't find either an issue or a pull request for #{branch_name}" exit elsif issue && !pull_request pull_request = issue.convert_to_pull_request(branch: branch_name) elsif !issue && pull_request issue = pull_request end if pull_request.merged? io.say "This pull request has already been merged and cannot be modified. " \ "If you would like to make any code changes, please begin with " \ "'hustle start' and create a new issue." exit end if io.reopen_issue?(pull_request) pull_request.reopen end if pull_request.in_development? pull_request.ready_for_review elsif pull_request.ready_for_review? io.say "Just a note. It looks like this pull request is already marked as ready " \ "for review so I'm not going to touch it." elsif pull_request.being_reviewed? io.say <<-HEREDOC Just a note. It looks like the issue is currently being reviewed by <person>. Because of this, we're going to stop here and not do any notifications or modifications to the Pull Request. If you'd like to do something else, you can open the PR by pressing 'o', otherwise, press any other key to exit. HEREDOC end end |