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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 17df99358f86abaa36bf5e36882881e34df34de901441daf121e98b86fbd4ea2
4
- data.tar.gz: 9fb2d8b44488861db052fdabab616260ca0b276dfd1f595a39ccff8822a83b0b
3
+ metadata.gz: add7c4637bf997f40928d5c82ccb61253feee7f9bc671068b41e38e706843402
4
+ data.tar.gz: 5a7f0d706305157e7efae7656834c56ec9f70e32042547fcf660255c8b26c539
5
5
  SHA512:
6
- metadata.gz: 7d65dab75a5828d2d2ecc2c533aca864abb0a4f541f662ab4740fcda352805e80482bd6c8aefefc5bd13290a1b2365072732f5813b6365e9928d373ca7f300a7
7
- data.tar.gz: a62f5ad58f3cb57756c5c1e9589665553eb802cfa1e8af60629cf27aea3451a0129e4b7a1b808ce28b2db98eb2d5d3da1d44ac8fadb81b49dcabbe176777299b
6
+ metadata.gz: 1210eedc7eda1ca3a93a81ce66539c3728b2c470c45da54dec690ad0b0d38eb07c36f0ddf41d067bf6bbaa3eb5272af62ea131eafe34147f0645f8c17635c280
7
+ data.tar.gz: 5dfdbbe196e763f005504fd4f3311533fb2cc543a987674bf8d7c282c8534178391f461986a08f6b7df85ebaa4b8c85a6f879815d5789fbdcd90923cfb443bf8
data/Rakefile CHANGED
@@ -4,6 +4,10 @@ require "bundler/gem_tasks"
4
4
  require "rspec/core/rake_task"
5
5
  require "cucumber"
6
6
  require "cucumber/rake/task"
7
+ require "rake"
8
+
9
+ # Load custom tasks
10
+ Dir.glob("lib/tasks/**/*.rake").each { |r| load r }
7
11
 
8
12
  RSpec::Core::RakeTask.new(:spec)
9
13
 
@@ -21,9 +21,9 @@ Feature: Sprint Filtering
21
21
  """
22
22
  \+-------+--\+
23
23
  \| \s+ Matching Sprints \s+ \|
24
- \+-------\+-------------------------\+----------------\+-------------------------\+-------------------------\+-----------------------\+---------------------------------+--\+-------------------\+
25
- \| Id \| Name \| Length In Days \| Start Date \| End Date \| Board Name \| Board UI URL \s+ \| Board Project Key \|
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 stdout should contain:
43
+ Then the output should match:
44
44
  """
45
- +------------------------------------------------------------------------------------------------------+
46
- | Matching Sprints |
47
- +-------+-------------------------+----------------+-------------------------+-------------------------+
48
- | Id | Name | Length In Days | Start Date | End Date |
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 \| Name \s+ \| Length In Days \| Start Date \| End Date \| Board Name \| Board UI URL \s+ \| Board Project Key \|
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 \| Name \s+ \| Length In Days \| Start Date \| End Date \| Board Name \| Board UI URL \s+ \| Board Project Key \|
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
- add_help_banner_and_options(parser)
15
-
16
- parser.on("-v", "--version", "Print the version") do
17
- Kernel.puts tool.class::VERSION
14
+ parser.section_header "Common"
18
15
 
19
- Kernel.exit 1
20
- end
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 environment_loader variables used by the tool") do
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} environment_loader variable!"
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}" }
@@ -10,7 +10,7 @@ class OptionParser
10
10
  on <<~EOSH
11
11
 
12
12
  #{header_name}
13
- #{header_name.gsub(/./, "-")}
13
+ #{header_name.gsub(/./, "*")}
14
14
  EOSH
15
15
  end
16
16
  end
@@ -3,7 +3,7 @@
3
3
  module Jira
4
4
  module Auto
5
5
  class Tool
6
- VERSION = "1.1.0"
6
+ VERSION = "1.1.2"
7
7
  end
8
8
  end
9
9
  end
@@ -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"]
@@ -12,7 +12,7 @@ RSpec.describe OptionParser do
12
12
  expect(option_parser).to receive(:on).with(<<~EOSB)
13
13
 
14
14
  a section name:
15
- ---------------
15
+ ***************
16
16
  EOSB
17
17
 
18
18
  option_parser.section_header("a section name")
@@ -42,7 +42,7 @@ module Jira
42
42
  end
43
43
  end
44
44
 
45
- describe "#environment_loader" do
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 environment_loader based value" do |method_name|
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 environment_loader variable is set" do
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 environment_loader" do
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 environment_loader variable is not set" do
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} environment_loader variable!)"))
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 environment_loader variable is not found" do
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} environment_loader variable!/)
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 "environment_loader based values" do
235
+ describe "environment based values" do
236
236
  let(:object_with_overridable_value) { tool }
237
237
 
238
- it_behaves_like "an overridable environment_loader based value", method_name
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.0
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