tempest-time 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.ruby-version +1 -0
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +133 -0
- data/LICENSE +21 -0
- data/README.md +8 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/bin/tempest +18 -0
- data/lib/tempest_time.rb +4 -0
- data/lib/tempest_time/api/authorization.rb +17 -0
- data/lib/tempest_time/api/jira_api/authorization.rb +27 -0
- data/lib/tempest_time/api/jira_api/models/issue.rb +28 -0
- data/lib/tempest_time/api/jira_api/request.rb +40 -0
- data/lib/tempest_time/api/jira_api/requests/get_issue.rb +29 -0
- data/lib/tempest_time/api/jira_api/requests/get_user_issues.rb +36 -0
- data/lib/tempest_time/api/jira_api/response.rb +5 -0
- data/lib/tempest_time/api/jira_api/responses/get_issue.rb +16 -0
- data/lib/tempest_time/api/jira_api/responses/get_user_issues.rb +14 -0
- data/lib/tempest_time/api/request.rb +87 -0
- data/lib/tempest_time/api/response.rb +34 -0
- data/lib/tempest_time/api/tempo_api/authorization.rb +23 -0
- data/lib/tempest_time/api/tempo_api/models/worklog.rb +36 -0
- data/lib/tempest_time/api/tempo_api/request.rb +35 -0
- data/lib/tempest_time/api/tempo_api/requests/create_worklog.rb +51 -0
- data/lib/tempest_time/api/tempo_api/requests/delete_worklog.rb +29 -0
- data/lib/tempest_time/api/tempo_api/requests/get_worklog.rb +29 -0
- data/lib/tempest_time/api/tempo_api/requests/list_worklogs.rb +41 -0
- data/lib/tempest_time/api/tempo_api/requests/report.rb +0 -0
- data/lib/tempest_time/api/tempo_api/requests/submit_timesheet.rb +49 -0
- data/lib/tempest_time/api/tempo_api/response.rb +5 -0
- data/lib/tempest_time/api/tempo_api/responses/create_worklog.rb +28 -0
- data/lib/tempest_time/api/tempo_api/responses/delete_worklog.rb +8 -0
- data/lib/tempest_time/api/tempo_api/responses/get_worklog.rb +22 -0
- data/lib/tempest_time/api/tempo_api/responses/list_worklogs.rb +40 -0
- data/lib/tempest_time/api/tempo_api/responses/submit_timesheet.rb +13 -0
- data/lib/tempest_time/cli.rb +92 -0
- data/lib/tempest_time/command.rb +60 -0
- data/lib/tempest_time/commands/config.rb +30 -0
- data/lib/tempest_time/commands/config/edit.rb +38 -0
- data/lib/tempest_time/commands/config/setup.rb +55 -0
- data/lib/tempest_time/commands/delete.rb +31 -0
- data/lib/tempest_time/commands/issues.rb +37 -0
- data/lib/tempest_time/commands/list.rb +32 -0
- data/lib/tempest_time/commands/report.rb +83 -0
- data/lib/tempest_time/commands/submit.rb +26 -0
- data/lib/tempest_time/commands/teams.rb +30 -0
- data/lib/tempest_time/commands/teams/add.rb +29 -0
- data/lib/tempest_time/commands/teams/delete.rb +32 -0
- data/lib/tempest_time/commands/teams/edit.rb +49 -0
- data/lib/tempest_time/commands/track.rb +70 -0
- data/lib/tempest_time/helpers/formatting_helper.rb +16 -0
- data/lib/tempest_time/helpers/time_helper.rb +63 -0
- data/lib/tempest_time/models/report.rb +58 -0
- data/lib/tempest_time/services/generate_report.rb +54 -0
- data/lib/tempest_time/setting.rb +47 -0
- data/lib/tempest_time/settings/authorization.rb +19 -0
- data/lib/tempest_time/settings/teams.rb +19 -0
- data/lib/tempest_time/templates/config/.gitkeep +1 -0
- data/lib/tempest_time/templates/config/auth/.gitkeep +1 -0
- data/lib/tempest_time/templates/config/setup/.gitkeep +1 -0
- data/lib/tempest_time/templates/config/teams/.gitkeep +1 -0
- data/lib/tempest_time/templates/delete/.gitkeep +1 -0
- data/lib/tempest_time/templates/issue/.gitkeep +1 -0
- data/lib/tempest_time/templates/issues/.gitkeep +1 -0
- data/lib/tempest_time/templates/list/.gitkeep +1 -0
- data/lib/tempest_time/templates/report/.gitkeep +1 -0
- data/lib/tempest_time/templates/setup/.gitkeep +1 -0
- data/lib/tempest_time/templates/submit/.gitkeep +1 -0
- data/lib/tempest_time/templates/teams/.gitkeep +1 -0
- data/lib/tempest_time/templates/track/.gitkeep +1 -0
- data/lib/tempest_time/templates/view/.gitkeep +1 -0
- data/lib/tempest_time/version.rb +3 -0
- data/tempest-time.gemspec +62 -0
- metadata +517 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 04d23648af22ff5cf992c558b0869344d264cbc678705eea47dca7e90ad28ab0
|
4
|
+
data.tar.gz: c6cab7108458dc09927eb68bd60bff9bb61f70b26ee041534ea26e318a28d4d9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8b4bce6242c4819d1ecbdbfdfb660c6228173fdad4a252e59c05377bef2f1242ff1062c78fb7740afba42e8ad2a97696c602ee28cd9ff35db6c7ac33e43de33d
|
7
|
+
data.tar.gz: 638d8be6fcb28bf6fbe384d0836bd1282e7d46f4de64c6c5eaa96ac0e8e29cf295c422099eca762e302c309406f52be0d23c393ecf506b1e57b5b855d8d380eb
|
data/.gitignore
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.5.0
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
tempest-time (0.5.0)
|
5
|
+
git (~> 1.5)
|
6
|
+
httparty (~> 0.16)
|
7
|
+
pastel (~> 0.7.2)
|
8
|
+
ruby-git (~> 0.2)
|
9
|
+
thor (~> 0.20.0)
|
10
|
+
tty-box (~> 0.3.0)
|
11
|
+
tty-color (~> 0.4)
|
12
|
+
tty-command (~> 0.8.0)
|
13
|
+
tty-config (~> 0.3.0)
|
14
|
+
tty-cursor (~> 0.6)
|
15
|
+
tty-editor (~> 0.5.0)
|
16
|
+
tty-file (~> 0.7.0)
|
17
|
+
tty-font (~> 0.2.0)
|
18
|
+
tty-markdown (~> 0.5.0)
|
19
|
+
tty-pager (~> 0.12.0)
|
20
|
+
tty-pie (~> 0.1.0)
|
21
|
+
tty-platform (~> 0.2.0)
|
22
|
+
tty-progressbar (~> 0.16.0)
|
23
|
+
tty-prompt (~> 0.18.0)
|
24
|
+
tty-screen (~> 0.6)
|
25
|
+
tty-spinner (~> 0.9.0)
|
26
|
+
tty-table (~> 0.10.0)
|
27
|
+
tty-tree (~> 0.2.0)
|
28
|
+
tty-which (~> 0.4)
|
29
|
+
|
30
|
+
GEM
|
31
|
+
remote: https://rubygems.org/
|
32
|
+
specs:
|
33
|
+
byebug (10.0.2)
|
34
|
+
diff-lcs (1.3)
|
35
|
+
equatable (0.5.0)
|
36
|
+
git (1.5.0)
|
37
|
+
httparty (0.16.3)
|
38
|
+
mime-types (~> 3.0)
|
39
|
+
multi_xml (>= 0.5.2)
|
40
|
+
kramdown (1.16.2)
|
41
|
+
mime-types (3.2.2)
|
42
|
+
mime-types-data (~> 3.2015)
|
43
|
+
mime-types-data (3.2018.0812)
|
44
|
+
minitest (5.11.3)
|
45
|
+
multi_xml (0.6.0)
|
46
|
+
necromancer (0.4.0)
|
47
|
+
pastel (0.7.2)
|
48
|
+
equatable (~> 0.5.0)
|
49
|
+
tty-color (~> 0.4.0)
|
50
|
+
rake (10.5.0)
|
51
|
+
rouge (3.3.0)
|
52
|
+
ruby-git (0.2.2)
|
53
|
+
strings (0.1.4)
|
54
|
+
strings-ansi (~> 0.1.0)
|
55
|
+
unicode-display_width (~> 1.4.0)
|
56
|
+
unicode_utils (~> 1.4.0)
|
57
|
+
strings-ansi (0.1.0)
|
58
|
+
thor (0.20.3)
|
59
|
+
timers (4.3.0)
|
60
|
+
tty-box (0.3.0)
|
61
|
+
pastel (~> 0.7.2)
|
62
|
+
strings (~> 0.1.4)
|
63
|
+
tty-cursor (~> 0.6.0)
|
64
|
+
tty-color (0.4.3)
|
65
|
+
tty-command (0.8.2)
|
66
|
+
pastel (~> 0.7.0)
|
67
|
+
tty-config (0.3.1)
|
68
|
+
tty-cursor (0.6.0)
|
69
|
+
tty-editor (0.5.0)
|
70
|
+
tty-prompt (~> 0.18)
|
71
|
+
tty-which (~> 0.4)
|
72
|
+
tty-file (0.7.0)
|
73
|
+
diff-lcs (~> 1.3)
|
74
|
+
pastel (~> 0.7.2)
|
75
|
+
tty-prompt (~> 0.18)
|
76
|
+
tty-font (0.2.0)
|
77
|
+
tty-markdown (0.5.0)
|
78
|
+
kramdown (~> 1.16.2)
|
79
|
+
pastel (~> 0.7.2)
|
80
|
+
rouge (~> 3.3)
|
81
|
+
strings (~> 0.1.4)
|
82
|
+
tty-color (~> 0.4)
|
83
|
+
tty-screen (~> 0.6)
|
84
|
+
tty-pager (0.12.0)
|
85
|
+
strings (~> 0.1.4)
|
86
|
+
tty-screen (~> 0.6)
|
87
|
+
tty-which (~> 0.4)
|
88
|
+
tty-pie (0.1.0)
|
89
|
+
pastel (~> 0.7.2)
|
90
|
+
tty-cursor (~> 0.6.0)
|
91
|
+
tty-platform (0.2.0)
|
92
|
+
tty-progressbar (0.16.0)
|
93
|
+
strings-ansi (~> 0.1.0)
|
94
|
+
tty-cursor (~> 0.6.0)
|
95
|
+
tty-screen (~> 0.6.4)
|
96
|
+
unicode-display_width (~> 1.3)
|
97
|
+
tty-prompt (0.18.1)
|
98
|
+
necromancer (~> 0.4.0)
|
99
|
+
pastel (~> 0.7.0)
|
100
|
+
timers (~> 4.0)
|
101
|
+
tty-cursor (~> 0.6.0)
|
102
|
+
tty-reader (~> 0.5.0)
|
103
|
+
tty-reader (0.5.0)
|
104
|
+
tty-cursor (~> 0.6.0)
|
105
|
+
tty-screen (~> 0.6.4)
|
106
|
+
wisper (~> 2.0.0)
|
107
|
+
tty-screen (0.6.5)
|
108
|
+
tty-spinner (0.9.0)
|
109
|
+
tty-cursor (~> 0.6.0)
|
110
|
+
tty-table (0.10.0)
|
111
|
+
equatable (~> 0.5.0)
|
112
|
+
necromancer (~> 0.4.0)
|
113
|
+
pastel (~> 0.7.2)
|
114
|
+
strings (~> 0.1.0)
|
115
|
+
tty-screen (~> 0.6.4)
|
116
|
+
tty-tree (0.2.0)
|
117
|
+
tty-which (0.4.0)
|
118
|
+
unicode-display_width (1.4.1)
|
119
|
+
unicode_utils (1.4.0)
|
120
|
+
wisper (2.0.0)
|
121
|
+
|
122
|
+
PLATFORMS
|
123
|
+
ruby
|
124
|
+
|
125
|
+
DEPENDENCIES
|
126
|
+
bundler (~> 1.16)
|
127
|
+
byebug (~> 10.0)
|
128
|
+
minitest (~> 5.0)
|
129
|
+
rake (~> 10.0)
|
130
|
+
tempest-time!
|
131
|
+
|
132
|
+
BUNDLED WITH
|
133
|
+
1.16.1
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Copyright (c) Devan Hurst, 2019.
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "tempest"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/bin/tempest
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
lib_path = File.expand_path('../lib', __dir__)
|
5
|
+
$:.unshift(lib_path) if !$:.include?(lib_path)
|
6
|
+
require 'tempest_time/cli'
|
7
|
+
|
8
|
+
Signal.trap('INT') do
|
9
|
+
warn("\n#{caller.join("\n")}: interrupted")
|
10
|
+
exit(1)
|
11
|
+
end
|
12
|
+
|
13
|
+
begin
|
14
|
+
TempestTime::CLI.start
|
15
|
+
rescue TempestTime::CLI::Error => err
|
16
|
+
puts "ERROR: #{err.message}"
|
17
|
+
exit 1
|
18
|
+
end
|
data/lib/tempest_time.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require_relative '../settings/authorization'
|
2
|
+
|
3
|
+
module TempestTime
|
4
|
+
module API
|
5
|
+
class Authorization
|
6
|
+
def credentials
|
7
|
+
{ url: url, user: user, email: email, token: token }
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def settings
|
13
|
+
TempestTime::Settings::Authorization
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require_relative '../authorization'
|
2
|
+
|
3
|
+
module JiraAPI
|
4
|
+
class Authorization < TempestTime::API::Authorization
|
5
|
+
private
|
6
|
+
|
7
|
+
def url
|
8
|
+
"https://#{subdomain}.atlassian.net/rest/api/3"
|
9
|
+
end
|
10
|
+
|
11
|
+
def subdomain
|
12
|
+
settings.read('subdomain')
|
13
|
+
end
|
14
|
+
|
15
|
+
def user
|
16
|
+
settings.read('username')
|
17
|
+
end
|
18
|
+
|
19
|
+
def email
|
20
|
+
settings.read('email')
|
21
|
+
end
|
22
|
+
|
23
|
+
def token
|
24
|
+
settings.read('jira_token')
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require_relative '../../../helpers/formatting_helper'
|
2
|
+
|
3
|
+
module JiraAPI
|
4
|
+
module Models
|
5
|
+
class Issue
|
6
|
+
include TempestTime::Helpers::FormattingHelper
|
7
|
+
|
8
|
+
attr_reader :fields, :summary, :key
|
9
|
+
|
10
|
+
def initialize(issue)
|
11
|
+
@key = issue['key']
|
12
|
+
@fields = issue['fields']
|
13
|
+
end
|
14
|
+
|
15
|
+
def remaining_estimate
|
16
|
+
@remaining_estimate ||= fields.dig('timetracking', 'remainingEstimateSeconds')
|
17
|
+
end
|
18
|
+
|
19
|
+
def summary
|
20
|
+
@summary ||= fields.dig('summary')
|
21
|
+
end
|
22
|
+
|
23
|
+
def status
|
24
|
+
@status ||= fields.dig('status', 'name')
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
require_relative './authorization'
|
5
|
+
require_relative './response'
|
6
|
+
require_relative '../request'
|
7
|
+
|
8
|
+
module JiraAPI
|
9
|
+
class Request < TempestTime::API::Request
|
10
|
+
def send_request
|
11
|
+
@raw_response = self.class.send(
|
12
|
+
request_method,
|
13
|
+
request_path,
|
14
|
+
headers: headers,
|
15
|
+
body: request_body,
|
16
|
+
query: query_params,
|
17
|
+
basic_auth: basic_auth
|
18
|
+
)
|
19
|
+
response
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def authorization_klass
|
25
|
+
Authorization
|
26
|
+
end
|
27
|
+
|
28
|
+
def response_klass
|
29
|
+
Response
|
30
|
+
end
|
31
|
+
|
32
|
+
def user
|
33
|
+
credentials.fetch(:email, nil)
|
34
|
+
end
|
35
|
+
|
36
|
+
def username
|
37
|
+
credentials.fetch(:user, nil)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require_relative '../request'
|
2
|
+
require_relative '../responses/get_issue'
|
3
|
+
|
4
|
+
module JiraAPI
|
5
|
+
module Requests
|
6
|
+
class GetIssue < JiraAPI::Request
|
7
|
+
attr_reader :issue
|
8
|
+
|
9
|
+
def initialize(issue)
|
10
|
+
super
|
11
|
+
@issue = issue
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def request_method
|
17
|
+
'get'
|
18
|
+
end
|
19
|
+
|
20
|
+
def request_path
|
21
|
+
"/issue/#{issue}"
|
22
|
+
end
|
23
|
+
|
24
|
+
def response_klass
|
25
|
+
JiraAPI::Responses::GetIssue
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require_relative '../request'
|
2
|
+
require_relative '../responses/get_user_issues'
|
3
|
+
|
4
|
+
module JiraAPI
|
5
|
+
module Requests
|
6
|
+
class GetUserIssues < JiraAPI::Request
|
7
|
+
attr_reader :requested_user
|
8
|
+
|
9
|
+
def initialize(requested_user = nil)
|
10
|
+
super
|
11
|
+
@requested_user = requested_user || username
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def request_method
|
17
|
+
'get'
|
18
|
+
end
|
19
|
+
|
20
|
+
def request_path
|
21
|
+
"/search"
|
22
|
+
end
|
23
|
+
|
24
|
+
def query_params
|
25
|
+
{
|
26
|
+
'jql' => "assignee=#{requested_user} AND resolution is EMPTY",
|
27
|
+
'maxResults' => 100
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def response_klass
|
32
|
+
JiraAPI::Responses::GetUserIssues
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|