firespring_dev_commands 2.1.13 → 2.1.14.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a84986a2061f8fe6b475bc9fbf6b0593abffa358128f97e9fe5e6de67be450ff
4
- data.tar.gz: 54b7e228c92940a12695a86f1866f2e2c10e382a785004c6d3ad021f79da0fd1
3
+ metadata.gz: 4c8429522137dc821f95c40908bc0ca8511b661e36ea0217bca59c2341bdc745
4
+ data.tar.gz: b247f082879d7bf5d67a3edf5a4bbd29894c074942244a0d0c3fe42837c37016
5
5
  SHA512:
6
- metadata.gz: e9233d5fe012349dc028739ff650ef4df1ffba9b8692a5c7141a0db600d10aed51191d9c65f92fadc7a6e4f88240226df815cbac993c4965781440aed09ffd0e
7
- data.tar.gz: 539dd77c64dc43c8711e5fe2b4f0ad7409b55e1ddf6687aa83372526d3648aa7e7eee8bea6ccee62ac9924201773bbc4addf27f0993eb9b609fe74009833c9d4
6
+ metadata.gz: 481ec33a976f08c936668ed0e7bfc98151d5493a163a591d31c4a223906f3e78a93373d10c95b377800666e435cd8244f7de921061b516c8db6b5db9bf9c1b94
7
+ data.tar.gz: 148109367568c57919dedba2469d3e8a8d08332cecc27c7cb80bc58e730e353bce3482aec35aa7acb2e94da3b922f14ea4fdddf5a386e7909fa5f639ae0aa84c
@@ -4,6 +4,18 @@ require 'base64'
4
4
  module Dev
5
5
  # Class which contains methods to conenct to jira and query issues
6
6
  class Jira
7
+ # The config file to try to load credentials from
8
+ CONFIG_FILE = "#{Dir.home}/.env.jira".freeze
9
+
10
+ # The text of the username variable key
11
+ JIRA_USERNAME = 'JIRA_USERNAME'.freeze
12
+
13
+ # The text of the token variable key
14
+ JIRA_TOKEN = 'JIRA_TOKEN'.freeze
15
+
16
+ # The text of the url variable key
17
+ JIRA_URL = 'JIRA_URL'.freeze
18
+
7
19
  # Config object for setting top level jira config options
8
20
  # "points_field_name" is the field holding the value for points on a story. If this is not present, all points will default to 0
9
21
  # "user_lookup_list" should be an array of Jira::User objects representing the usernames, ids, etc for all jira users
@@ -11,9 +23,11 @@ module Dev
11
23
  # and there is no way to query this information from Jira directly.
12
24
  Config = Struct.new(:username, :token, :url, :points_field_name, :expand, :user_lookup_list, :read_timeout, :http_debug) do
13
25
  def initialize
14
- self.username = nil
15
- self.token = nil
16
- self.url = nil
26
+ Dotenv.load(CONFIG_FILE) if File.exist?(CONFIG_FILE)
27
+
28
+ self.username = ENV.fetch(JIRA_USERNAME, nil)
29
+ self.token = ENV.fetch(JIRA_TOKEN, nil)
30
+ self.url = ENV.fetch(JIRA_URL, nil)
17
31
  self.points_field_name = nil
18
32
  self.expand = []
19
33
  self.user_lookup_list = []
@@ -40,6 +54,10 @@ module Dev
40
54
 
41
55
  # Initialize a new jira client using the given inputs
42
56
  def initialize(username: self.class.config.username, token: self.class.config.token, url: self.class.config.url)
57
+ raise 'username is required' if username.to_s.strip.empty?
58
+ raise 'token is required' if token.to_s.strip.empty?
59
+ raise 'url is required' if url.to_s.strip.empty?
60
+
43
61
  @username = username
44
62
  @token = token
45
63
  @url = url
@@ -2,9 +2,10 @@ module Dev
2
2
  class TargetProcess
3
3
  # Class containing project information
4
4
  class Project
5
- attr_accessor :id, :type, :name
5
+ attr_accessor :date, :id, :type, :name
6
6
 
7
7
  def initialize(data)
8
+ @data = data
8
9
  @id = data['Id']
9
10
  @type = data['ResourceType']
10
11
  @name = data['Name']
@@ -107,6 +107,11 @@ module Dev
107
107
  self << "(Assignable.EntityType.Name eq '#{entity_type}')" unless entity_type.nil?
108
108
  end
109
109
 
110
+ # Add a filter that looks for assignable id that match the given id
111
+ def filter_by_entity_id(entity_id)
112
+ self << "(Assignable.Id eq '#{entity_id}')" unless entity_id.nil?
113
+ end
114
+
110
115
  # Add a filter that looks for assignable ids which are included in the given array
111
116
  def filter_by_entity_ids(entity_ids)
112
117
  self << "(Assignable.Id in ('#{entity_ids.join("', '")}'))" unless entity_ids.nil? || entity_ids.empty?
@@ -8,9 +8,10 @@ module Dev
8
8
  # The api path for release requests
9
9
  PATH = '/Releases'.freeze
10
10
 
11
- attr_accessor :id, :type, :name, :start_date, :end_date, :custom_fields
11
+ attr_accessor :data, :id, :type, :name, :start_date, :end_date, :custom_fields
12
12
 
13
13
  def initialize(data)
14
+ @data = data
14
15
  @id = data['Id']
15
16
  @type = data['ResourceType']
16
17
  @name = data['Name']
@@ -2,9 +2,10 @@ module Dev
2
2
  class TargetProcess
3
3
  # Class containing team information
4
4
  class Team
5
- attr_accessor :id, :type, :name
5
+ attr_accessor :data, :id, :type, :name
6
6
 
7
7
  def initialize(data)
8
+ @data = data
8
9
  @id = data['Id']
9
10
  @type = data['ResourceType']
10
11
  @name = data['Name']
@@ -8,9 +8,10 @@ module Dev
8
8
  # The api path for team assignment requests
9
9
  PATH = '/TeamAssignments'.freeze
10
10
 
11
- attr_accessor :id, :type, :start_date, :end_date, :team, :story
11
+ attr_accessor :data, :id, :type, :start_date, :end_date, :team, :story
12
12
 
13
13
  def initialize(data)
14
+ @data = data
14
15
  @id = data['Id']
15
16
  @type = data['ResourceType']
16
17
  @start_date = parse_time(data['StartDate'])
@@ -2,9 +2,10 @@ module Dev
2
2
  class TargetProcess
3
3
  # Class containing user information
4
4
  class User
5
- attr_accessor :id, :type, :name, :login
5
+ attr_accessor :data, :id, :type, :name, :login
6
6
 
7
7
  def initialize(data)
8
+ @data = data
8
9
  @id = data['Id']
9
10
  @type = data['ResourceType']
10
11
  @name = data['FullName']
@@ -8,10 +8,11 @@ module Dev
8
8
  # The api path for user story requests
9
9
  PATH = '/UserStories'.freeze
10
10
 
11
- attr_accessor :type, :id, :name, :description, :start_date, :end_date, :create_date, :modify_date, :tags, :effort, :time_spent, :last_state_change_date, :project,
12
- :owner, :creator, :release, :team, :priority, :state, :original_data
11
+ attr_accessor :data, :type, :id, :name, :description, :start_date, :end_date, :create_date, :modify_date, :tags, :effort, :time_spent, :last_state_change_date,
12
+ :project, :owner, :creator, :release, :team, :priority, :state
13
13
 
14
14
  def initialize(data)
15
+ @data = data
15
16
  @id = data['Id']
16
17
  @type = data['ResourceType']
17
18
  @name = data['Name']
@@ -30,7 +31,6 @@ module Dev
30
31
  @effort = data['Effort']
31
32
  @time_spent = data['TimeSpent']
32
33
  @last_state_change_date = parse_time(data['LastStateChangeDate'])
33
- @original_data = original_data
34
34
  end
35
35
 
36
36
  # Parse the dot net time representation into something that ruby can use
@@ -46,6 +46,18 @@ module Dev
46
46
 
47
47
  (end_date - start_date).to_f / (60 * 60 * 24)
48
48
  end
49
+
50
+ # Returns the time the team was responsible for the issue was
51
+ def team_cycle_time(team_ids)
52
+ # Calculate the difference and convert to days
53
+ finished_dev_query = Dev::TargetProcess::Query.new
54
+ finished_dev_query.filter_by_team_ids(team_ids)
55
+ finished_dev_query.filter_end_date_between(start_date, end_date)
56
+ finished_dev_query.filter_by_entity_type(Dev::TargetProcess::UserStory::RESOURCE_TYPE)
57
+ finished_dev_query.filter_by_entity_id(id)
58
+ team_assignments = Dev::TargetProcess.new.team_assignments(finished_dev_query)
59
+ team_assignments.sum(&:cycle_time)
60
+ end
49
61
  end
50
62
  end
51
63
  end
@@ -8,10 +8,11 @@ module Dev
8
8
  # The api path for user story requests
9
9
  PATH = '/UserStoryHistories'.freeze
10
10
 
11
- attr_accessor :type, :id, :source_entity_id, :name, :description, :start_date, :end_date, :create_date, :modify_date, :tags, :effort, :time_spent,
12
- :last_state_change_date, :project, :owner, :creator, :release, :team, :priority, :state, :original_data
11
+ attr_accessor :data, :type, :id, :source_entity_id, :name, :description, :start_date, :end_date, :create_date, :modify_date, :tags, :effort,
12
+ :time_spent, :last_state_change_date, :project, :owner, :creator, :release, :team, :priority, :state
13
13
 
14
14
  def initialize(data)
15
+ @data = data
15
16
  @id = data['Id']
16
17
  @source_entity_id = data['SourceEntityId']
17
18
  @type = data['ResourceType']
@@ -31,7 +32,6 @@ module Dev
31
32
  @effort = data['Effort']
32
33
  @time_spent = data['TimeSpent']
33
34
  @last_state_change_date = parse_time(data['LastStateChangeDate'])
34
- @original_data = original_data
35
35
  end
36
36
 
37
37
  # Parse the dot net time representation into something that ruby can use
@@ -6,6 +6,6 @@ module Dev
6
6
  # Use 'v.v.v.pre.alpha.v' for pre-release vesions
7
7
  # Use 'v.v.v.beta.v for beta versions
8
8
  # Use semantic versioning for any releases (https://semver.org/)
9
- VERSION = '2.1.13'.freeze
9
+ VERSION = '2.1.14.pre.alpha.2'.freeze
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firespring_dev_commands
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.13
4
+ version: 2.1.14.pre.alpha.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Firespring
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-15 00:00:00.000000000 Z
11
+ date: 2023-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -399,9 +399,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
399
399
  version: '3.1'
400
400
  required_rubygems_version: !ruby/object:Gem::Requirement
401
401
  requirements:
402
- - - ">="
402
+ - - ">"
403
403
  - !ruby/object:Gem::Version
404
- version: '0'
404
+ version: 1.3.1
405
405
  requirements: []
406
406
  rubygems_version: 3.4.10
407
407
  signing_key: