firespring_dev_commands 2.1.4.pre.alpha.1 → 2.1.4.pre.alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/firespring_dev_commands/aws/login.rb +6 -0
- data/lib/firespring_dev_commands/jira/issue.rb +2 -63
- data/lib/firespring_dev_commands/jira.rb +4 -6
- data/lib/firespring_dev_commands/version.rb +1 -1
- metadata +1 -3
- data/lib/firespring_dev_commands/jira/histories.rb +0 -13
- data/lib/firespring_dev_commands/jira/history.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bfc98cc8da862092d77bcb5781f7ea61260c56e4207ed72cc5c2b6812a6fbaf
|
4
|
+
data.tar.gz: 2b1a49276792b8f5d24dbd4e188eb7c89a70d77876625e80edd193d4b06fc9ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f20f8b61f93b885fe0d3039abba3d922dce072f64a565472c9ca61eaac69047679de5615e92399ffbe494069fbef2d6469fbd3661edccd0c0e4c6aa65d7a3075
|
7
|
+
data.tar.gz: 26f3c929fe09590e24851b5075fb2d4525f6fe3e67a0940dfc11e4289095a5338fecbe128165ead9b48ed7d27064949e96b55742913712d95d9ca2e2297f93e9
|
@@ -38,6 +38,12 @@ module Dev
|
|
38
38
|
|
39
39
|
region = profileini['region'] || defaultini['region'] || Dev::Aws::DEFAULT_REGION
|
40
40
|
|
41
|
+
# Explicitly set the region to the one we are logging in to. Then exit if we are already logged in.
|
42
|
+
# This is to fix an issue where you are attempting to log in to an account in a different region.
|
43
|
+
# We were seeing issue where it would still be attempting to use the old region until the process exited
|
44
|
+
ENV['AWS_DEFAULT_REGION'] = region
|
45
|
+
return if Dev::Aws::Credentials.new.active?(account)
|
46
|
+
|
41
47
|
serial = profileini['mfa_serial_name'] || defaultini['mfa_serial_name']
|
42
48
|
serial = "arn:aws:iam::#{Dev::Aws::Account.new.root.id}:mfa/#{serial}" if serial
|
43
49
|
serial ||= profileini['mfa_serial'] || defaultini['mfa_serial']
|
@@ -5,7 +5,7 @@ module Dev
|
|
5
5
|
# Issue subtypes which do not map to a story type
|
6
6
|
NON_STORY_TYPES = ['review', 'sub-task', 'code review sub-task', 'pre-deploy sub-task', 'deploy sub-task', 'devops sub-task'].freeze
|
7
7
|
|
8
|
-
attr_accessor :data, :project, :id, :title, :points, :assignee, :resolved_date
|
8
|
+
attr_accessor :data, :project, :id, :title, :points, :assignee, :resolved_date
|
9
9
|
|
10
10
|
def initialize(data)
|
11
11
|
@data = data
|
@@ -15,71 +15,10 @@ module Dev
|
|
15
15
|
@points = calculate_points(data)
|
16
16
|
@assignee = Jira::User.lookup(data.assignee&.accountId)
|
17
17
|
@resolved_date = data.resolutiondate
|
18
|
-
@histories = Jira::Histories.populate(data)
|
19
|
-
@in_progress_history = nil
|
20
|
-
@in_review_history = nil
|
21
|
-
@closed_history = nil
|
22
|
-
end
|
23
|
-
|
24
|
-
def cycle_time
|
25
|
-
# Calculate the difference and convert to days
|
26
|
-
((last_closed_history.created - first_in_progress_history.created) / 60 / 60 / 24).round(2)
|
27
|
-
end
|
28
|
-
|
29
|
-
def in_progress_cycle_time
|
30
|
-
# Calculate the difference and convert to days
|
31
|
-
((first_in_review_history.created - first_in_progress_history.created) / 60 / 60 / 24).round(2)
|
32
|
-
end
|
33
|
-
|
34
|
-
def in_review_cycle_time
|
35
|
-
# Calculate the difference and convert to days
|
36
|
-
((last_closed_history.created - first_in_review_history.created) / 60 / 60 / 24).round(2)
|
37
|
-
end
|
38
|
-
|
39
|
-
private def first_in_progress_history
|
40
|
-
raise 'you must expand the changelog field to calculate cycle time' if histories.nil?
|
41
|
-
|
42
|
-
# Find the first instance in the histoy where the status moved to "In Progress"
|
43
|
-
@in_progress_history ||= histories.select do |history|
|
44
|
-
history.items.find do |item|
|
45
|
-
item['fieldId'] == 'status' && item['toString'] == 'In Progress'
|
46
|
-
end
|
47
|
-
end.min_by(&:created)
|
48
|
-
raise 'unable to find "In Progress" history entry needed to calculate cycle time' unless @in_progress_history
|
49
|
-
|
50
|
-
@in_progress_history
|
51
|
-
end
|
52
|
-
|
53
|
-
private def first_in_review_history
|
54
|
-
raise 'you must expand the changelog field to calculate cycle time' if histories.nil?
|
55
|
-
|
56
|
-
# Find the first instance in the histoy where the status moved to "In Review"
|
57
|
-
@in_review_history ||= histories.select do |history|
|
58
|
-
history.items.find do |item|
|
59
|
-
item['fieldId'] == 'status' && item['toString'] == 'In Review'
|
60
|
-
end
|
61
|
-
end.min_by(&:created)
|
62
|
-
raise 'unable to find "In Review" history entry needed to calculate cycle time' unless @in_review_history
|
63
|
-
|
64
|
-
@in_review_history
|
65
|
-
end
|
66
|
-
|
67
|
-
private def last_closed_history
|
68
|
-
raise 'you must expand the changelog field to calculate cycle time' if histories.nil?
|
69
|
-
|
70
|
-
# Find the last instance in the histoy where the status moved to "Closed"
|
71
|
-
@closed_history ||= histories.select do |history|
|
72
|
-
history.items.find do |item|
|
73
|
-
item['fieldId'] == 'status' && item['toString'] == 'Closed'
|
74
|
-
end
|
75
|
-
end.max_by(&:created)
|
76
|
-
raise 'unable to find "Closed" history entry needed to calculate cycle time' unless @closed_history
|
77
|
-
|
78
|
-
@closed_history
|
79
18
|
end
|
80
19
|
|
81
20
|
# Returns the value of the jira points field or 0 if the field is not found
|
82
|
-
|
21
|
+
def calculate_points(data)
|
83
22
|
return data.send(Dev::Jira.config.points_field_name).to_i if Dev::Jira.config.points_field_name && data.respond_to?(Dev::Jira.config.points_field_name)
|
84
23
|
|
85
24
|
0
|
@@ -9,16 +9,15 @@ module Dev
|
|
9
9
|
# "user_lookup_list" should be an array of Jira::User objects representing the usernames, ids, etc for all jira users
|
10
10
|
# This is a bit clumsy but currently the jira api only returns the user id with issues
|
11
11
|
# and there is no way to query this information from Jira directly.
|
12
|
-
Config = Struct.new(:username, :token, :url, :points_field_name, :
|
12
|
+
Config = Struct.new(:username, :token, :url, :points_field_name, :user_lookup_list, :read_timeout, :http_debug) do
|
13
13
|
def initialize
|
14
14
|
self.username = nil
|
15
15
|
self.token = nil
|
16
16
|
self.url = nil
|
17
17
|
self.points_field_name = nil
|
18
|
-
self.expand = []
|
19
18
|
self.user_lookup_list = []
|
20
19
|
self.read_timeout = 120
|
21
|
-
self.http_debug =
|
20
|
+
self.http_debug = false
|
22
21
|
end
|
23
22
|
end
|
24
23
|
|
@@ -63,16 +62,15 @@ module Dev
|
|
63
62
|
def issues(jql, &)
|
64
63
|
start_at = 0
|
65
64
|
max_results = 100
|
66
|
-
expand = self.class.config.expand
|
67
65
|
|
68
66
|
# Query Jira and yield all issues it returns
|
69
|
-
issues = @client.Issue.jql(jql, start_at:, max_results
|
67
|
+
issues = @client.Issue.jql(jql, start_at:, max_results:)
|
70
68
|
issues.map { |data| Issue.new(data) }.each(&)
|
71
69
|
|
72
70
|
# If we returned the max_results then there may be more - add the max results to where we start at and query again
|
73
71
|
while issues.length >= max_results
|
74
72
|
start_at += max_results
|
75
|
-
issues = @client.Issue.jql(jql, start_at:, max_results
|
73
|
+
issues = @client.Issue.jql(jql, start_at:, max_results:)
|
76
74
|
issues.map { |data| Issue.new(data) }.each(&)
|
77
75
|
end
|
78
76
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: firespring_dev_commands
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.4.pre.alpha.
|
4
|
+
version: 2.1.4.pre.alpha.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Firespring
|
@@ -284,8 +284,6 @@ files:
|
|
284
284
|
- lib/firespring_dev_commands/git.rb
|
285
285
|
- lib/firespring_dev_commands/git/info.rb
|
286
286
|
- lib/firespring_dev_commands/jira.rb
|
287
|
-
- lib/firespring_dev_commands/jira/histories.rb
|
288
|
-
- lib/firespring_dev_commands/jira/history.rb
|
289
287
|
- lib/firespring_dev_commands/jira/issue.rb
|
290
288
|
- lib/firespring_dev_commands/jira/project.rb
|
291
289
|
- lib/firespring_dev_commands/jira/user.rb
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'date'
|
2
|
-
|
3
|
-
module Dev
|
4
|
-
class Jira
|
5
|
-
class History
|
6
|
-
attr_accessor :date, :id, :author, :created, :items
|
7
|
-
|
8
|
-
def initialize(data)
|
9
|
-
@data = data
|
10
|
-
@id = data['id']
|
11
|
-
@author = data['author']
|
12
|
-
@items = data['items']
|
13
|
-
@created = Time.parse(data['created'])
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|