jira-auto-tool 1.1.0 → 1.1.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/Rakefile +4 -0
- data/features/sprint_filtering.feature +17 -17
- data/lib/jira/auto/tool/common_options.rb +11 -7
- data/lib/jira/auto/tool/environment_loader/options.rb +1 -1
- data/lib/jira/auto/tool/helpers/environment_based_value.rb +1 -1
- data/lib/jira/auto/tool/helpers/option_parser.rb +1 -1
- data/lib/jira/auto/tool/version.rb +1 -1
- data/lib/tasks/version.rake +55 -0
- data/spec/jira/auto/tool/helpers/option_parser_spec.rb +1 -1
- data/spec/jira/auto/tool_spec.rb +10 -10
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: add7c4637bf997f40928d5c82ccb61253feee7f9bc671068b41e38e706843402
|
4
|
+
data.tar.gz: 5a7f0d706305157e7efae7656834c56ec9f70e32042547fcf660255c8b26c539
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1210eedc7eda1ca3a93a81ce66539c3728b2c470c45da54dec690ad0b0d38eb07c36f0ddf41d067bf6bbaa3eb5272af62ea131eafe34147f0645f8c17635c280
|
7
|
+
data.tar.gz: 5dfdbbe196e763f005504fd4f3311533fb2cc543a987674bf8d7c282c8534178391f461986a08f6b7df85ebaa4b8c85a6f879815d5789fbdcd90923cfb443bf8
|
data/Rakefile
CHANGED
@@ -21,9 +21,9 @@ Feature: Sprint Filtering
|
|
21
21
|
"""
|
22
22
|
\+-------+--\+
|
23
23
|
\| \s+ Matching Sprints \s+ \|
|
24
|
-
|
25
|
-
\| Id
|
26
|
-
|
24
|
+
\+----+-\+-------------------------\+----------------\+-------------------------\+-------------------------\+-----------------------\+---------------------------------+--\+-------------------\+
|
25
|
+
\| Id \s+\| Name \| Length In Days \| Start Date \| End Date \| Board Name \| Board UI URL \s+ \| Board Project Key \|
|
26
|
+
\+----+-\+-------------------------\+----------------\+-------------------------\+-------------------------\+-----------------------\+---------------------------------+--\+-------------------\+
|
27
27
|
"""
|
28
28
|
And the output should match:
|
29
29
|
"""
|
@@ -40,13 +40,13 @@ Feature: Sprint Filtering
|
|
40
40
|
|
41
41
|
Scenario: No filtering (except closed sprints) and excluding the corresponding board information
|
42
42
|
When I successfully run `jira-auto-tool --sprint-list-without-board-info`
|
43
|
-
Then the
|
43
|
+
Then the output should match:
|
44
44
|
"""
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
\+------+----------------------------------------------------------------------------------------------\+
|
46
|
+
\| \s+ Matching Sprints \s+ \|
|
47
|
+
\+-----+-\+-------------------------\+----------------\+-------------------------\+-------------------------\+
|
48
|
+
\| Id \s+\| Name \| Length In Days \| Start Date \| End Date \|
|
49
|
+
\+-----+-\+-------------------------\+----------------\+-------------------------\+-------------------------\+
|
50
50
|
"""
|
51
51
|
And the output should match:
|
52
52
|
"""
|
@@ -68,11 +68,11 @@ Feature: Sprint Filtering
|
|
68
68
|
When I successfully run `jira-auto-tool --sprint-list`
|
69
69
|
Then the output should match:
|
70
70
|
"""
|
71
|
-
|
71
|
+
\+--------+------------\+
|
72
72
|
\| \s+ Matching Sprints \s+ \|
|
73
|
-
|
74
|
-
\| Id
|
75
|
-
|
73
|
+
\+-----+-\+---------+--------\+----------------\+-------------------------\+-------------------------\+-----------------------\+---------------------------------+--\+-------------------\+
|
74
|
+
\| Id \s+\| Name \s+ \| Length In Days \| Start Date \| End Date \| Board Name \| Board UI URL \s+ \| Board Project Key \|
|
75
|
+
\+-----+-\+---------+--------\+----------------\+-------------------------\+-------------------------\+-----------------------\+---------------------------------+--\+-------------------\+
|
76
76
|
"""
|
77
77
|
And the output should match:
|
78
78
|
"""
|
@@ -93,11 +93,11 @@ Feature: Sprint Filtering
|
|
93
93
|
When I successfully run `jira-auto-tool --sprint-list`
|
94
94
|
Then the output should match:
|
95
95
|
"""
|
96
|
-
|
96
|
+
\+-------+------\+
|
97
97
|
\| \s+ Matching Sprints \s+ \|
|
98
|
-
|
99
|
-
\| Id
|
100
|
-
|
98
|
+
\+-----+-\+---------+-------\+----------------\+-------------------------\+-------------------------\+-----------------------\+---------------------------------+--\+-------------------\+
|
99
|
+
\| Id \s+\| Name \s+ \| Length In Days \| Start Date \| End Date \| Board Name \| Board UI URL \s+ \| Board Project Key \|
|
100
|
+
\+-----+-\+---------+-------\+----------------\+-------------------------\+-------------------------\+-----------------------\+---------------------------------+--\+-------------------\+
|
101
101
|
"""
|
102
102
|
And the output should match:
|
103
103
|
"""
|
@@ -11,19 +11,15 @@ module Jira
|
|
11
11
|
def self.add(tool, parser)
|
12
12
|
::ARGV << DISPLAY_HELP_OPTION if ARGV.empty?
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
parser.on("-v", "--version", "Print the version") do
|
17
|
-
Kernel.puts tool.class::VERSION
|
14
|
+
parser.section_header "Common"
|
18
15
|
|
19
|
-
|
20
|
-
|
16
|
+
add_help_banner_and_options(parser)
|
17
|
+
add_version_options(parser, tool)
|
21
18
|
end
|
22
19
|
|
23
20
|
def self.add_help_banner_and_options(parser)
|
24
21
|
parser.banner = <<~EOBANNER
|
25
22
|
Usage: #{File.basename($PROGRAM_NAME)} [options]*
|
26
|
-
|
27
23
|
EOBANNER
|
28
24
|
|
29
25
|
parser.on("-h", DISPLAY_HELP_OPTION, "Print this help") do
|
@@ -31,6 +27,14 @@ module Jira
|
|
31
27
|
Kernel.exit 1
|
32
28
|
end
|
33
29
|
end
|
30
|
+
|
31
|
+
def self.add_version_options(parser, tool)
|
32
|
+
parser.on("-v", "--version", "Print the version") do
|
33
|
+
Kernel.puts tool.class::VERSION
|
34
|
+
|
35
|
+
Kernel.exit 1
|
36
|
+
end
|
37
|
+
end
|
34
38
|
end
|
35
39
|
end
|
36
40
|
end
|
@@ -8,7 +8,7 @@ module Jira
|
|
8
8
|
def self.add(tool, parser)
|
9
9
|
parser.section_header "Environment"
|
10
10
|
|
11
|
-
parser.on("--env-list", "List the
|
11
|
+
parser.on("--env-list", "List the environment variables used by the tool") do
|
12
12
|
tool.environment.list
|
13
13
|
end
|
14
14
|
|
@@ -70,7 +70,7 @@ module Jira
|
|
70
70
|
environment_variable_name = caller_method_name.upcase
|
71
71
|
|
72
72
|
value = ENV.fetch(environment_variable_name) do |name|
|
73
|
-
raise KeyError, "Missing #{name}
|
73
|
+
raise KeyError, "Missing #{name} environment variable!"
|
74
74
|
end
|
75
75
|
|
76
76
|
log.debug { "fetch_corresponding_environment_variable(#{environment_variable_name}) - #{value.inspect}" }
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
def validate_version_type(type)
|
4
|
+
valid_types = %w[patch minor major]
|
5
|
+
return if valid_types.include?(type)
|
6
|
+
|
7
|
+
puts "Error: Version type must be one of: #{valid_types.join(", ")}"
|
8
|
+
exit 1
|
9
|
+
end
|
10
|
+
|
11
|
+
def execute_version_bump(type)
|
12
|
+
puts "Bumping #{type} version..."
|
13
|
+
bump_result = system("bundle exec gem bump --version #{type}")
|
14
|
+
return if bump_result
|
15
|
+
|
16
|
+
puts "Error: Failed to bump version"
|
17
|
+
exit 1
|
18
|
+
end
|
19
|
+
|
20
|
+
def update_gemfile_lock
|
21
|
+
puts "Updating Gemfile.lock..."
|
22
|
+
bundle_result = system("bundle install")
|
23
|
+
return if bundle_result
|
24
|
+
|
25
|
+
puts "Error: Failed to update Gemfile.lock"
|
26
|
+
exit 1
|
27
|
+
end
|
28
|
+
|
29
|
+
def amend_commit_to_include_gemfile_lock_changes
|
30
|
+
puts "Amending commit to include Gemfile.lock update..."
|
31
|
+
system("git add .")
|
32
|
+
system(%(git commit --amend --no-edit))
|
33
|
+
end
|
34
|
+
|
35
|
+
namespace :version do
|
36
|
+
desc "Bump version (patch, minor, major) and update Gemfile.lock in a single step. Default: patch"
|
37
|
+
task :bump, [:type] do |_t, args|
|
38
|
+
args.with_defaults(type: "patch")
|
39
|
+
|
40
|
+
validate_version_type(args.type)
|
41
|
+
|
42
|
+
execute_version_bump(args.type)
|
43
|
+
update_gemfile_lock
|
44
|
+
amend_commit_to_include_gemfile_lock_changes
|
45
|
+
|
46
|
+
puts <<~EOEM
|
47
|
+
Version successfully bumped and committed!
|
48
|
+
|
49
|
+
Run 'git push' to push the changes to your remote repository.
|
50
|
+
EOEM
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
desc "Alias for version:bump"
|
55
|
+
task :bump, [:type] => ["version:bump"]
|
data/spec/jira/auto/tool_spec.rb
CHANGED
@@ -42,7 +42,7 @@ module Jira
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
describe "#
|
45
|
+
describe "#environment" do
|
46
46
|
let(:environment_loader) { instance_double(EnvironmentLoader) }
|
47
47
|
|
48
48
|
before { allow(EnvironmentLoader).to receive_messages(new: environment_loader) }
|
@@ -131,7 +131,7 @@ module Jira
|
|
131
131
|
end
|
132
132
|
|
133
133
|
# TODO: move that to environment_based_value_spec
|
134
|
-
RSpec.shared_examples "an overridable
|
134
|
+
RSpec.shared_examples "an overridable environment based value" do |method_name|
|
135
135
|
let(:env_var_name) { method_name.to_s.upcase }
|
136
136
|
let(:method_name?) { :"#{method_name}_defined?" }
|
137
137
|
let(:config) { Config.new(object_with_overridable_value) }
|
@@ -141,7 +141,7 @@ module Jira
|
|
141
141
|
allow(config).to receive_messages(value_store: {})
|
142
142
|
end
|
143
143
|
|
144
|
-
context "when the
|
144
|
+
context "when the environment variable is set" do
|
145
145
|
let(:expected_value) { "#{env_var_name} env_value" }
|
146
146
|
|
147
147
|
before do
|
@@ -156,7 +156,7 @@ module Jira
|
|
156
156
|
.to eq(expected_value)
|
157
157
|
end
|
158
158
|
|
159
|
-
it "fetches its value from the
|
159
|
+
it "fetches its value from the environment" do
|
160
160
|
expect(object_with_overridable_value.send(method_name)).to eq(expected_value)
|
161
161
|
end
|
162
162
|
|
@@ -173,11 +173,11 @@ module Jira
|
|
173
173
|
end
|
174
174
|
end
|
175
175
|
|
176
|
-
context "when the
|
176
|
+
context "when the environment variable is not set" do
|
177
177
|
before do
|
178
178
|
allow(ENV).to receive(:fetch)
|
179
179
|
.with(env_var_name)
|
180
|
-
.and_raise(KeyError.new("Missing #{env_var_name}
|
180
|
+
.and_raise(KeyError.new("Missing #{env_var_name} environment variable!)"))
|
181
181
|
|
182
182
|
allow(ENV).to receive(:key?).with(env_var_name).and_return(false)
|
183
183
|
end
|
@@ -189,9 +189,9 @@ module Jira
|
|
189
189
|
.to eq("DEFAULT_VALUE")
|
190
190
|
end
|
191
191
|
|
192
|
-
it "raises an error if the
|
192
|
+
it "raises an error if the environment variable is not found" do
|
193
193
|
expect { object_with_overridable_value.send(method_name) }
|
194
|
-
.to raise_error(KeyError, /Missing #{env_var_name}
|
194
|
+
.to raise_error(KeyError, /Missing #{env_var_name} environment variable!/)
|
195
195
|
end
|
196
196
|
end
|
197
197
|
|
@@ -232,10 +232,10 @@ module Jira
|
|
232
232
|
jira_site_url jira_username
|
233
233
|
jira_sprint_field_name
|
234
234
|
].each do |method_name|
|
235
|
-
describe "
|
235
|
+
describe "environment based values" do
|
236
236
|
let(:object_with_overridable_value) { tool }
|
237
237
|
|
238
|
-
it_behaves_like "an overridable
|
238
|
+
it_behaves_like "an overridable environment based value", method_name
|
239
239
|
end
|
240
240
|
end
|
241
241
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jira-auto-tool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christophe Broult
|
@@ -298,6 +298,7 @@ files:
|
|
298
298
|
- lib/jira/auto/tool/ticket.rb
|
299
299
|
- lib/jira/auto/tool/until_date.rb
|
300
300
|
- lib/jira/auto/tool/version.rb
|
301
|
+
- lib/tasks/version.rake
|
301
302
|
- sig/jira/sprint/tool.rbs
|
302
303
|
- spec/jira/auto/tool/board/cache_spec.rb
|
303
304
|
- spec/jira/auto/tool/board/unavailable_board_spec.rb
|