Class: Jirify::Subcommands::Issues
- Inherits:
-
Thor
- Object
- Thor
- Jirify::Subcommands::Issues
- Defined in:
- lib/jirify/cli/issue.rb
Instance Method Summary collapse
- #assignee(issue_id) ⇒ Object
- #block(issue_id) ⇒ Object
- #close(issue_id) ⇒ Object
- #describe(issue_id) ⇒ Object
- #mine ⇒ Object
- #open(issue_id) ⇒ Object
- #review(issue_id) ⇒ Object
- #start(issue_id) ⇒ Object
- #status(issue_id) ⇒ Object
- #take(issue_id) ⇒ Object
- #todo(issue_id) ⇒ Object
- #transition(issue_id, transition_name) ⇒ Object
- #transitions(issue_id) ⇒ Object
- #unassign(issue_id) ⇒ Object
- #unblock(issue_id) ⇒ Object
Instance Method Details
#assignee(issue_id) ⇒ Object
71 72 73 74 75 76 77 78 79 |
# File 'lib/jirify/cli/issue.rb', line 71 def assignee(issue_id) issue = get_issue_or_exit issue_id if issue.assignee.nil? say 'Unassigned'.yellow else say issue.assignee.displayName end end |
#block(issue_id) ⇒ Object
136 137 138 139 140 141 142 143 |
# File 'lib/jirify/cli/issue.rb', line 136 def block(issue_id) issue = get_issue_or_exit issue_id check_assigned_to_self issue issue.reopen! if issue.done? issue.stop_review! if issue.in_review? issue.block! end |
#close(issue_id) ⇒ Object
209 210 211 212 213 214 215 |
# File 'lib/jirify/cli/issue.rb', line 209 def close(issue_id) issue = get_issue_or_exit issue_id check_assigned_to_self issue issue.unblock! if issue.blocked? issue.close! end |
#describe(issue_id) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/jirify/cli/issue.rb', line 48 def describe(issue_id) issue = get_issue_or_exit issue_id issue_renderer = UI::IssueRenderer.new(issue) = {} [:url] = true [:summary] = true [:assignee] = true begin say issue_renderer.as_card() rescue UI::WindowTooNarrow say ColorizedString['ERROR: Your terminal window is too narrow to print the sprint table!'] .white.on_red.bold end end |
#mine ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/jirify/cli/issue.rb', line 28 def mine statuses = build_issue_statuses() issues = Models::Issue.list_mine(statuses, [:all]) issues.each do |issue| if [:key_only] say issue.key else say issue.to_s Config.always_verbose || [:verbose] end end end |
#open(issue_id) ⇒ Object
42 43 44 45 |
# File 'lib/jirify/cli/issue.rb', line 42 def open(issue_id) get_issue_or_exit issue_id unless [:force] Launchy.open("#{Config.issue_browse_url}#{issue_id}") end |
#review(issue_id) ⇒ Object
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/jirify/cli/issue.rb', line 191 def review(issue_id) issue = get_issue_or_exit issue_id check_assigned_to_self issue if issue.blocked? issue.unblock! issue.start! elsif issue.todo? issue.start! elsif issue.done? issue.reopen! issue.start! end issue.start_review! end |
#start(issue_id) ⇒ Object
176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/jirify/cli/issue.rb', line 176 def start(issue_id) issue = get_issue_or_exit issue_id check_assigned_to_self issue issue.unblock! if issue.blocked? issue.reopen! if issue.done? if issue.in_review? issue.stop_review! else issue.start! end end |
#status(issue_id) ⇒ Object
107 108 109 110 111 |
# File 'lib/jirify/cli/issue.rb', line 107 def status(issue_id) issue = get_issue_or_exit issue_id say "Status: #{issue.status.name}" end |
#take(issue_id) ⇒ Object
95 96 97 98 99 100 |
# File 'lib/jirify/cli/issue.rb', line 95 def take(issue_id) issue = get_issue_or_exit issue_id say "Assigning #{issue.key} to #{Config.username}..." issue.assign_to_me! end |
#todo(issue_id) ⇒ Object
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/jirify/cli/issue.rb', line 159 def todo(issue_id) issue = get_issue_or_exit issue_id check_assigned_to_self issue if issue.blocked? issue.unblock! elsif issue.in_progress? issue.stop! elsif issue.in_review? issue.stop_review! issue.stop! elsif issue.done? issue.reopen! end end |
#transition(issue_id, transition_name) ⇒ Object
122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/jirify/cli/issue.rb', line 122 def transition(issue_id, transition_name) issue = get_issue_or_exit issue_id transition = issue.transitions.find_by_name(transition_name) if transition.nil? say ColorizedString[" ERROR: Issue can't transition to #{transition_name} "].white.on_red.bold exit(0) end say "Transitioning #{issue.key} with #{transition_name}...".green issue.transition! transition end |
#transitions(issue_id) ⇒ Object
114 115 116 117 118 119 |
# File 'lib/jirify/cli/issue.rb', line 114 def transitions(issue_id) issue = get_issue_or_exit issue_id say 'Available transitions:' issue.transitions.names.each { |name| say name } end |
#unassign(issue_id) ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/jirify/cli/issue.rb', line 82 def unassign(issue_id) issue = get_issue_or_exit issue_id if issue.assignee.nil? say 'Issue already unassigned'.yellow exit(0) end say "Previous assignee: #{issue.assignee.name}. Unassigning..." issue.unassign! end |
#unblock(issue_id) ⇒ Object
146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/jirify/cli/issue.rb', line 146 def unblock(issue_id) issue = get_issue_or_exit issue_id check_assigned_to_self issue if issue.blocked? say 'Unblocking issue...' issue.unblock! else say 'Issue wasn\'t blocked anyway :)'.green end end |