tempest_time 0.5.6 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ba7b6688e350d7f3e9408c135c4413346a9465a736115422b37e0a57a56346e
4
- data.tar.gz: 4d0c38beeffd10ca499409cb79e9c7f49b2a599fae8d5c5a6c99a281fe894987
3
+ metadata.gz: d691cff0165bbed3a5fec7fd6e03290e22073d11c8d00bcc2d695d7a0e29161a
4
+ data.tar.gz: 480718ec2d0f8a99bb9128113c0c2927cdcb8f634d3c0cf3616d6c2469830205
5
5
  SHA512:
6
- metadata.gz: c90fa07f62adb8928ff2842b5d0502a88166ced7992cded2e0c7fbb146704378f83f59d798e91503524413c0eb4d1501942b5df4fec5add33ccaabd295e719c2
7
- data.tar.gz: f821ca56abd35b260be25d0b0fb857a087e460d55f02a4cbf19065dc37d07eef0f7dbeb932b322b486a83b0e7f86d90af17fed21defca2e533c786a4bc023f75
6
+ metadata.gz: d83520231149dce7e91072a738c8e75556ac6070e19db50ef43f275d7f91645e8a6973183529789ff3a8495c9d79f5deca061aeb494bd76e6f6c72c0ec4b63bf
7
+ data.tar.gz: 3e6dca53bdedfdaaea7a9e373bf367693c2f819315b581372813067b6e452e9f7cebd6146a3ef59738bdeb9c88638a98c0eb45a77a3c2c4e6e640d25a83058ec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tempest_time (0.5.5)
4
+ tempest_time (0.5.6)
5
5
  git (~> 1.5)
6
6
  httparty (~> 0.16)
7
7
  pastel (~> 0.7.2)
@@ -57,6 +57,12 @@ module TempestTime
57
57
  TempestTime::Commands::Delete.new(worklogs, options).execute
58
58
  end
59
59
 
60
+ desc 'issue', 'Open a Jira issue in your browser.'
61
+ def issue(issue)
62
+ require_relative 'commands/issue'
63
+ TempestTime::Commands::Issue.new(issue).execute
64
+ end
65
+
60
66
  desc 'issues', "View a list of a user's assigned tickets. (Defaults to you.)"
61
67
  def issues(user = nil)
62
68
  require_relative 'commands/issues'
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../command'
4
+ require_relative '../settings/authorization'
5
+
6
+ module TempestTime
7
+ module Commands
8
+ class Issue < TempestTime::Command
9
+ def initialize(issue)
10
+ @issue = issue.upcase
11
+ end
12
+
13
+ def execute(input: $stdin, output: $stdout)
14
+ command.run("open #{url(@issue)}")
15
+ end
16
+
17
+ private
18
+
19
+ def url(issue)
20
+ domain = TempestTime::Settings::Authorization.read('subdomain')
21
+ "https://#{domain}.atlassian.net/browse/#{issue}"
22
+ end
23
+ end
24
+ end
25
+ end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require_relative '../command'
4
4
  require_relative '../api/jira_api/requests/get_user_issues'
5
+ require_relative './issue'
5
6
 
6
7
  module TempestTime
7
8
  module Commands
@@ -13,15 +14,26 @@ module TempestTime
13
14
 
14
15
  def execute(input: $stdin, output: $stdout)
15
16
  request = JiraAPI::Requests::GetUserIssues.new(@user)
16
- with_spinner("Getting issues for #{request.requested_user}") do |spinner|
17
- response = request.send_request
18
- spinner.stop
19
- puts format_output(response.issues)
17
+ message = "Getting issues for #{request.requested_user}"
18
+ response = with_spinner(message) do |spinner|
19
+ request.send_request.tap { spinner.stop }
20
20
  end
21
+ puts format_output(response.issues)
22
+ browser_prompt(response.issues)
21
23
  end
22
24
 
23
25
  private
24
26
 
27
+ def browser_prompt(issues)
28
+ abort if prompt.no?('Open an issue in your browser?')
29
+ issue = prompt.select(
30
+ 'Select an issue to open in browser, or press ^C to quit.',
31
+ issues.map(&:key),
32
+ per_page: 5
33
+ )
34
+ Issue.new(issue).execute
35
+ end
36
+
25
37
  def format_output(issues)
26
38
  table.new(
27
39
  %w[Status Issue Summary],
@@ -1,3 +1,3 @@
1
1
  module TempestTime
2
- VERSION = '0.5.6'.freeze
2
+ VERSION = '0.6.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tempest_time
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Devan Hurst
@@ -454,6 +454,7 @@ files:
454
454
  - lib/tempest_time/commands/config/edit.rb
455
455
  - lib/tempest_time/commands/config/setup.rb
456
456
  - lib/tempest_time/commands/delete.rb
457
+ - lib/tempest_time/commands/issue.rb
457
458
  - lib/tempest_time/commands/issues.rb
458
459
  - lib/tempest_time/commands/list.rb
459
460
  - lib/tempest_time/commands/report.rb