branch-name 3.10.1 → 3.10.3
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/.rubocop.yml +1 -0
- data/CHANGELOG.md +104 -49
- data/Gemfile +8 -10
- data/Gemfile.lock +57 -31
- data/bin/console +2 -1
- data/lib/branch/name/cli.rb +59 -36
- data/lib/branch/name/configurable.rb +12 -10
- data/lib/branch/name/locatable.rb +5 -0
- data/lib/branch/name/subcommands/config.rb +9 -2
- data/lib/branch/name/subcommands/delete.rb +6 -6
- data/lib/branch/name/subcommands/init.rb +4 -4
- data/lib/branch/name/version.rb +1 -1
- metadata +19 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ab9f37a984715c52a3c0952d554f14c4c031f88b91c5dfb6fbfb7147f576633
|
4
|
+
data.tar.gz: '09619b8e08559e13b2e9e8c236c2d849e620019fd44bc9868d2d1e564813d9ea'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25805fbe99145fd386f48c36979fbf4ec1cb3102ea927a819d7fb8cbaa33ccda80519a70babc0f36317b4bc733d70dce314733e70ef88c5d173e375c40186ec3
|
7
|
+
data.tar.gz: 52107197383539295ff02f687db9adbc133be2b31332b3822b263a5568d36afadea8ff94d51c3628745aaf47cb8c1fd53a32127e18092f058e1627cb4933aee1
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,82 +1,137 @@
|
|
1
|
+
## ['3.10.3'] - 2023-08-18
|
2
|
+
|
3
|
+
Changes
|
4
|
+
|
5
|
+
- Update gems.
|
6
|
+
- Various code refactors.
|
7
|
+
- Add some more test coverage.
|
8
|
+
|
9
|
+
## ['3.10.2'] - 2023-08-17
|
10
|
+
|
11
|
+
Changes
|
12
|
+
|
13
|
+
- Update gems.
|
14
|
+
|
1
15
|
## ['3.10.1'] - 2023-03-22
|
2
|
-
|
3
|
-
|
16
|
+
|
17
|
+
Changes
|
18
|
+
|
19
|
+
- Update gems. Remedy an activesupport dependabot alert.
|
4
20
|
|
5
21
|
## ['3.10.0'] - 2023-02-16
|
6
|
-
|
7
|
-
|
22
|
+
|
23
|
+
Changes
|
24
|
+
|
25
|
+
- Update gems.
|
8
26
|
|
9
27
|
## ['3.9.0'] - 2022-11-04
|
10
|
-
|
11
|
-
|
28
|
+
|
29
|
+
Changes
|
30
|
+
|
31
|
+
- Update gems.
|
12
32
|
|
13
33
|
## ['3.8.0'] - 2022-11-04
|
14
|
-
|
15
|
-
|
34
|
+
|
35
|
+
Changes
|
36
|
+
|
37
|
+
- Limit gem version to ~> 3.0 to avoid breaking changes.
|
16
38
|
|
17
39
|
## ['3.7.0'] - 2022-10-06
|
18
|
-
|
19
|
-
|
20
|
-
|
40
|
+
|
41
|
+
Changes
|
42
|
+
|
43
|
+
- Use thor_nested_subcommand to fix Thor nested subcommand help bug.
|
44
|
+
- Add missing global config option for create: :interactive.
|
21
45
|
|
22
46
|
## ['3.6.0'] - 2022-10-06
|
23
|
-
|
24
|
-
|
25
|
-
|
47
|
+
|
48
|
+
Changes
|
49
|
+
|
50
|
+
- Added a `-i` (interactive) option to `branch-name create`. When used in conjunction with the `-p` option (project creation), if the `-i` option is used, the user will be prompted to create the project. If the `-i` option is NOT used, the user will NOT be prompted when creating the project.
|
51
|
+
- Update the README.md file accordign to the aforementioned.
|
26
52
|
|
27
53
|
## ['3.5.1'] - 2022-10-05
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
54
|
+
|
55
|
+
Changes
|
56
|
+
|
57
|
+
- Add test coverage for the above scenarios.
|
58
|
+
- Use File.join to join paths and files safely where appropriate.
|
59
|
+
- Update .gemspec gem description with more detail.
|
60
|
+
|
61
|
+
Bug Fixes
|
62
|
+
|
63
|
+
- Fix bug that failed to remove underscore (_) characters in ticket and ticket descriptions from folder and branch name formulation.
|
64
|
+
- Fix bug that allowed unacceptable project folder token separators in the project folder name (-p option). The rule is now: for `branch-name create`, if the `options[:separator]` option (-s) is included in `Branch::Name::Normalizable::PROJECT_FOLDER_TOKEN_SEPARATORS`, `options[:separator]` (-s) will be used as the project folder token separator; otherwise, `Branch::Name::Normalizable::DEFAULT_PROJECT_FOLDER_TOKEN_SEPARATOR` will be used.
|
35
65
|
|
36
66
|
## ['3.5.0'] - 2022-10-04
|
37
|
-
|
38
|
-
|
67
|
+
|
68
|
+
Changes
|
69
|
+
|
70
|
+
- Fix broken link to CHANGELOG.md in .gemspec file.
|
39
71
|
|
40
72
|
## ['3.4.0'] - 2022-10-04
|
41
|
-
|
42
|
-
|
43
|
-
|
73
|
+
|
74
|
+
Changes
|
75
|
+
|
76
|
+
- `branch-name create` when creating projects prompts to confirm creating of projects by clicking 'y'. This change was prompted because projects were being created when users were attempting to display help for `branch-name create`; for example, users were incorrectly attempting to display help using `branch-name create help`, when, infact, `branch-name help create` should have been entered. Incorrectly executing `branch-name create help` would create a project with the name "help". Prompting the user to verify project creation solves this problem.
|
77
|
+
- Various changes in information printed to stdout when (for example) creating projects.
|
44
78
|
|
45
79
|
## ['3.3.0'] - 2022-09-27
|
46
|
-
|
47
|
-
|
80
|
+
|
81
|
+
Enhancements
|
82
|
+
|
83
|
+
- `branch-name config info` now displays the contents of both the Global and the local config files.
|
48
84
|
|
49
85
|
## ['3.2.2'] - 2022-09-27
|
50
|
-
|
51
|
-
|
86
|
+
|
87
|
+
Changes
|
88
|
+
|
89
|
+
- Refactor code that patches Thor incorrect display of nested commands (subcommangs).
|
52
90
|
|
53
91
|
## ['3.2.1'] - 2022-09-27
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
92
|
+
|
93
|
+
Changes
|
94
|
+
|
95
|
+
- Fix rubocop violations.
|
96
|
+
- Miscellaneous mixin refactors.
|
97
|
+
- Bug Fixes: Fix bug that displayed subcommand help incorrectly.
|
58
98
|
|
59
99
|
## ['3.1.0'] - 2022-09-26
|
60
|
-
|
61
|
-
|
62
|
-
|
100
|
+
|
101
|
+
Enhancements
|
102
|
+
|
103
|
+
- Branch names may now be created using a forward-slash (/). See the README.md file for more information.
|
104
|
+
- The `branch-name create :format_string` option string now accepts a %u placeholder which will be replaced with the currently logged in username. See `$ branch-name help create` for more information.
|
63
105
|
|
64
106
|
## ['3.0.0'] - 2022-09-26
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
107
|
+
|
108
|
+
Changes
|
109
|
+
|
110
|
+
- Default default commands to :help.
|
111
|
+
- Remove references to system for options, folder locations, etc. These were not being used and the nature of this tool is that global options should suffice.
|
112
|
+
|
113
|
+
Bug Fixes
|
114
|
+
|
115
|
+
- Not really a branch-name bug, but patched Thor bug that displays nested subcommands incorrectly.
|
69
116
|
|
70
117
|
## ['2.2.0'] - 2022-09-24
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
118
|
+
|
119
|
+
Enhancements
|
120
|
+
|
121
|
+
- Add support for `branch-name create` `-x` argument (see `branch-name help create`) which allows you to position the ticket and ticket description within the formulated branch name.
|
122
|
+
- The `branch-name create :project_location` option string now accepts any [`Time.strftime`](`https://apidock.com/ruby/Time/strftime`) format directive.
|
123
|
+
- Add better test coverage, although not what it should be (I'm working on it); this started a "quick and dirty" tool.
|
124
|
+
- `branch-name create` will now create the PROJECT_LOCATION if it does not exist.
|
125
|
+
- Update README.md file.
|
77
126
|
|
78
127
|
## ['2.1.0'] - 2022-09-22
|
79
|
-
|
128
|
+
|
129
|
+
Enhancements
|
130
|
+
|
131
|
+
- Add support for Windows clipboard. Branch names created are copied to the clibboard for macOS and Windows now.
|
80
132
|
|
81
133
|
## ['2.0.1-beta] - 2022-09-20
|
82
|
-
|
134
|
+
|
135
|
+
Bug fixes
|
136
|
+
|
137
|
+
- Ticket description was not joined properly (without token separator).
|
data/Gemfile
CHANGED
@@ -5,13 +5,11 @@ source 'https://rubygems.org'
|
|
5
5
|
# Specify your gem's dependencies in branch-name.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
gem '
|
9
|
-
gem '
|
10
|
-
gem '
|
11
|
-
|
12
|
-
gem '
|
13
|
-
gem '
|
14
|
-
|
15
|
-
|
16
|
-
# spec.add_development_dependency 'rubocop-rspec', '~> 2.12', '>= 2.12.1'
|
17
|
-
gem 'simplecov', '~> 0.21.2'
|
8
|
+
gem 'pry-byebug', '~> 3.10', '>= 3.10.1'
|
9
|
+
gem 'rake', '~> 13.0', '>= 13.0.6'
|
10
|
+
gem 'reek', '~> 6.1', '>= 6.1.4'
|
11
|
+
gem 'rspec', '~> 3.12'
|
12
|
+
gem 'rubocop', '~> 1.56.0'
|
13
|
+
gem 'rubocop-performance', '~> 1.19'
|
14
|
+
gem 'rubocop-rspec', '~> 2.23', '>= 2.23.2'
|
15
|
+
gem 'simplecov', '~> 0.22.0'
|
data/Gemfile.lock
CHANGED
@@ -1,96 +1,122 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
branch-name (3.10.
|
4
|
+
branch-name (3.10.3)
|
5
5
|
activesupport (~> 7.0, >= 7.0.4)
|
6
|
-
colorize (
|
6
|
+
colorize (>= 0.8.1, < 1.2.0)
|
7
7
|
os (~> 1.1, >= 1.1.4)
|
8
|
-
thor (~> 1.2, >= 1.2.
|
9
|
-
thor_nested_subcommand (~> 1.0)
|
8
|
+
thor (~> 1.2, >= 1.2.2)
|
9
|
+
thor_nested_subcommand (~> 1.0, >= 1.0.1)
|
10
10
|
|
11
11
|
GEM
|
12
12
|
remote: https://rubygems.org/
|
13
13
|
specs:
|
14
|
-
activesupport (7.0.
|
14
|
+
activesupport (7.0.7.2)
|
15
15
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
16
|
i18n (>= 1.6, < 2)
|
17
17
|
minitest (>= 5.1)
|
18
18
|
tzinfo (~> 2.0)
|
19
19
|
ast (2.4.2)
|
20
|
+
base64 (0.1.1)
|
20
21
|
byebug (11.1.3)
|
21
22
|
coderay (1.1.3)
|
22
|
-
colorize (
|
23
|
+
colorize (1.1.0)
|
23
24
|
concurrent-ruby (1.2.2)
|
24
25
|
diff-lcs (1.5.0)
|
25
26
|
docile (1.4.0)
|
26
|
-
i18n (1.
|
27
|
+
i18n (1.14.1)
|
27
28
|
concurrent-ruby (~> 1.0)
|
28
|
-
|
29
|
+
json (2.6.3)
|
29
30
|
kwalify (0.7.2)
|
31
|
+
language_server-protocol (3.17.0.3)
|
30
32
|
method_source (1.0.0)
|
31
|
-
minitest (5.
|
33
|
+
minitest (5.19.0)
|
32
34
|
os (1.1.4)
|
33
|
-
parallel (1.
|
34
|
-
parser (3.2.
|
35
|
+
parallel (1.23.0)
|
36
|
+
parser (3.2.2.3)
|
35
37
|
ast (~> 2.4.1)
|
38
|
+
racc
|
36
39
|
pry (0.14.2)
|
37
40
|
coderay (~> 1.1)
|
38
41
|
method_source (~> 1.0)
|
39
42
|
pry-byebug (3.10.1)
|
40
43
|
byebug (~> 11.0)
|
41
44
|
pry (>= 0.13, < 0.15)
|
45
|
+
racc (1.7.1)
|
42
46
|
rainbow (3.1.1)
|
43
47
|
rake (13.0.6)
|
44
48
|
reek (6.1.4)
|
45
49
|
kwalify (~> 0.7.0)
|
46
50
|
parser (~> 3.2.0)
|
47
51
|
rainbow (>= 2.0, < 4.0)
|
48
|
-
|
52
|
+
regexp_parser (2.8.1)
|
53
|
+
rexml (3.2.6)
|
49
54
|
rspec (3.12.0)
|
50
55
|
rspec-core (~> 3.12.0)
|
51
56
|
rspec-expectations (~> 3.12.0)
|
52
57
|
rspec-mocks (~> 3.12.0)
|
53
|
-
rspec-core (3.12.
|
58
|
+
rspec-core (3.12.2)
|
54
59
|
rspec-support (~> 3.12.0)
|
55
|
-
rspec-expectations (3.12.
|
60
|
+
rspec-expectations (3.12.3)
|
56
61
|
diff-lcs (>= 1.2.0, < 2.0)
|
57
62
|
rspec-support (~> 3.12.0)
|
58
|
-
rspec-mocks (3.12.
|
63
|
+
rspec-mocks (3.12.6)
|
59
64
|
diff-lcs (>= 1.2.0, < 2.0)
|
60
65
|
rspec-support (~> 3.12.0)
|
61
|
-
rspec-support (3.12.
|
62
|
-
rubocop (
|
63
|
-
|
66
|
+
rspec-support (3.12.1)
|
67
|
+
rubocop (1.56.1)
|
68
|
+
base64 (~> 0.1.1)
|
69
|
+
json (~> 2.3)
|
70
|
+
language_server-protocol (>= 3.17.0)
|
64
71
|
parallel (~> 1.10)
|
65
|
-
parser (>= 2.
|
72
|
+
parser (>= 3.2.2.3)
|
66
73
|
rainbow (>= 2.2.2, < 4.0)
|
67
|
-
|
74
|
+
regexp_parser (>= 1.8, < 3.0)
|
75
|
+
rexml (>= 3.2.5, < 4.0)
|
76
|
+
rubocop-ast (>= 1.28.1, < 2.0)
|
68
77
|
ruby-progressbar (~> 1.7)
|
69
|
-
unicode-display_width (>=
|
78
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
79
|
+
rubocop-ast (1.29.0)
|
80
|
+
parser (>= 3.2.1.0)
|
81
|
+
rubocop-capybara (2.18.0)
|
82
|
+
rubocop (~> 1.41)
|
83
|
+
rubocop-factory_bot (2.23.1)
|
84
|
+
rubocop (~> 1.33)
|
85
|
+
rubocop-performance (1.19.0)
|
86
|
+
rubocop (>= 1.7.0, < 2.0)
|
87
|
+
rubocop-ast (>= 0.4.0)
|
88
|
+
rubocop-rspec (2.23.2)
|
89
|
+
rubocop (~> 1.33)
|
90
|
+
rubocop-capybara (~> 2.17)
|
91
|
+
rubocop-factory_bot (~> 2.22)
|
70
92
|
ruby-progressbar (1.13.0)
|
71
|
-
simplecov (0.
|
93
|
+
simplecov (0.22.0)
|
72
94
|
docile (~> 1.1)
|
73
95
|
simplecov-html (~> 0.11)
|
74
96
|
simplecov_json_formatter (~> 0.1)
|
75
97
|
simplecov-html (0.12.3)
|
76
98
|
simplecov_json_formatter (0.1.4)
|
77
|
-
thor (1.2.
|
78
|
-
thor_nested_subcommand (1.0.
|
99
|
+
thor (1.2.2)
|
100
|
+
thor_nested_subcommand (1.0.1)
|
79
101
|
tzinfo (2.0.6)
|
80
102
|
concurrent-ruby (~> 1.0)
|
81
|
-
unicode-display_width (
|
103
|
+
unicode-display_width (2.4.2)
|
82
104
|
|
83
105
|
PLATFORMS
|
84
106
|
x86_64-darwin-19
|
107
|
+
x86_64-darwin-21
|
108
|
+
x86_64-linux
|
85
109
|
|
86
110
|
DEPENDENCIES
|
87
111
|
branch-name!
|
88
|
-
pry-byebug (~> 3.
|
89
|
-
rake (~> 13.0)
|
90
|
-
reek (~> 6.1, >= 6.1.
|
91
|
-
rspec (~> 3.
|
92
|
-
rubocop (~>
|
93
|
-
|
112
|
+
pry-byebug (~> 3.10, >= 3.10.1)
|
113
|
+
rake (~> 13.0, >= 13.0.6)
|
114
|
+
reek (~> 6.1, >= 6.1.4)
|
115
|
+
rspec (~> 3.12)
|
116
|
+
rubocop (~> 1.56.0)
|
117
|
+
rubocop-performance (~> 1.19)
|
118
|
+
rubocop-rspec (~> 2.23, >= 2.23.2)
|
119
|
+
simplecov (~> 0.22.0)
|
94
120
|
|
95
121
|
BUNDLED WITH
|
96
122
|
2.3.22
|
data/bin/console
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
+
require 'pry-byebug'
|
4
5
|
require 'bundler/setup'
|
5
|
-
require 'branch/name'
|
6
|
+
require 'branch/name/cli'
|
6
7
|
|
7
8
|
# You can add fixtures and/or initialization code here to make experimenting
|
8
9
|
# with your gem easier. You can also use a different console, if you like.
|
data/lib/branch/name/cli.rb
CHANGED
@@ -38,52 +38,51 @@ module Branch
|
|
38
38
|
description and optional ticket'
|
39
39
|
long_desc <<-LONG_DESC
|
40
40
|
NAME
|
41
|
-
|
41
|
+
|
42
42
|
`branch-name create` -- will formulate a Git branch name based on the
|
43
43
|
DESCRIPTION and optional TICKET provided.
|
44
44
|
|
45
45
|
SYNOPSIS
|
46
|
-
|
46
|
+
|
47
47
|
branch-name create [-i|-l|-f|-d|-s|-p|-x] DESCRIPTION [TICKET]
|
48
48
|
|
49
|
-
\x5
|
50
49
|
The following options are available:
|
51
50
|
|
52
|
-
|
51
|
+
NOTE: Default option values will be overidden if .branch-name config files
|
53
52
|
are present. Run `branch-name config info` to determine what config files
|
54
53
|
are present.
|
55
54
|
|
56
|
-
|
55
|
+
-d: Forces the branch name to lower case.
|
57
56
|
The default is: #{DEFAULT_BRANCH_NAME_OPTIONS['create']['downcase']}.
|
58
57
|
|
59
|
-
|
58
|
+
-f: Used with the -p option. If -f is specified, project files
|
60
59
|
will be created in the PROJECT_LOCATION specified by the -l option.
|
61
60
|
The default is: #{DEFAULT_BRANCH_NAME_OPTIONS['create']['project_files']}.
|
62
61
|
|
63
|
-
|
62
|
+
-i: Interactive. Used only with the -p option. If -i is specified, you will
|
64
63
|
be prompted when creating project folders. If -i is not specified, you will
|
65
64
|
NOT be prompted when creating project folders.
|
66
65
|
|
67
|
-
|
66
|
+
-l PROJECT_LOCATION: Indicates where the project should be created.
|
68
67
|
A "project" is a folder that is created in the PROJECT_LOCATION specified,
|
69
68
|
whose name is equivalent to the branch name that is formulated.
|
70
69
|
The default is: "#{Locatable.project_folder(options: options)}".
|
71
70
|
|
72
|
-
|
71
|
+
-p: Indicates that a project should be created.
|
73
72
|
The default is: #{DEFAULT_BRANCH_NAME_OPTIONS['create']['project']}.
|
74
73
|
|
75
|
-
|
74
|
+
-s SEPARATOR: Indicates the SEPARATOR that will be used to delimit tokens in the branch name.
|
76
75
|
The default SEPARATOR is: '#{DEFAULT_BRANCH_NAME_OPTIONS['create']['separator']}'.
|
77
76
|
|
78
|
-
|
77
|
+
-x FORMAT_STRING: This is a string that determines the format of the branch name
|
79
78
|
that is formulated. The following is a list of required placeholders you must put
|
80
79
|
in your format string to format the branch name: [%t, %d].
|
81
|
-
|
82
|
-
|
83
|
-
|
80
|
+
Where %t will be replaced by the ticket.
|
81
|
+
Where %d will be replaced by the ticket description.
|
82
|
+
The following is a list of optional placeholders you may put
|
84
83
|
in your format string to format the branch name: [%u].
|
85
|
-
|
86
|
-
|
84
|
+
Where %u will be replaced with your username (`Etc.getlogin`, https://rubygems.org/gems/etc).
|
85
|
+
The default format string is: "#{DEFAULT_BRANCH_NAME_OPTIONS['create']['format_string']}".
|
87
86
|
LONG_DESC
|
88
87
|
method_option :downcase, type: :boolean, aliases: '-d'
|
89
88
|
method_option :separator, type: :string, aliases: '-s'
|
@@ -91,28 +90,25 @@ module Branch
|
|
91
90
|
method_option :project, type: :boolean, aliases: '-p'
|
92
91
|
method_option :project_location, type: :string, aliases: '-l'
|
93
92
|
method_option :project_files, type: :array, aliases: '-f'
|
94
|
-
method_option :interactive, type: :boolean, aliases: '-i'
|
93
|
+
method_option :interactive, type: :boolean, optional: true, aliases: '-i'
|
95
94
|
|
96
95
|
def create(ticket_description, ticket = nil)
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
end
|
96
|
+
validate_ticket_description! ticket_description
|
97
|
+
original_options, altered_options = init_options_for! command: :create
|
98
|
+
self.options = altered_options
|
101
99
|
|
102
|
-
|
103
|
-
|
104
|
-
branch_name = normalize_branch_name(ticket_description, ticket) do |error|
|
105
|
-
say_error error.message
|
106
|
-
exit 1
|
107
|
-
end
|
100
|
+
branch_name = validate_and_normalize_branch_name(ticket_description, ticket)
|
108
101
|
say "Branch name: \"#{branch_name}\"", :cyan
|
109
102
|
say "Branch name \"#{branch_name}\" has been copied to the clipboard!", SUCCESS if copy_to_clipboard branch_name
|
103
|
+
if original_options[:interactive] && !options[:project]
|
104
|
+
say 'Ignored: -i is only used with projects (-p).',
|
105
|
+
WARNING
|
106
|
+
end
|
107
|
+
interactive_default = options['interactive']
|
108
|
+
options[:interactive] = interactive_default if original_options[:interactive].nil?
|
110
109
|
|
111
110
|
if options[:project]
|
112
|
-
project_folder_name =
|
113
|
-
say_error error.message
|
114
|
-
exit 1
|
115
|
-
end
|
111
|
+
project_folder_name = validate_and_create_project_folder_name_from! branch_name
|
116
112
|
if options[:interactive]
|
117
113
|
project_folder = project_folder_for branch_name
|
118
114
|
unless yes? "Create project for branch \"#{branch_name}\" " \
|
@@ -137,15 +133,42 @@ module Branch
|
|
137
133
|
|
138
134
|
private
|
139
135
|
|
136
|
+
def validate_ticket_description!(ticket_description)
|
137
|
+
return unless ticket_description.blank?
|
138
|
+
|
139
|
+
say_error 'description is required', ERROR
|
140
|
+
exit 1
|
141
|
+
end
|
142
|
+
|
143
|
+
def validate_and_normalize_branch_name(ticket_description, ticket)
|
144
|
+
normalize_branch_name(ticket_description, ticket) do |error|
|
145
|
+
say_error error.message
|
146
|
+
exit 1
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
def validate_and_create_project_folder_name_from!(branch_name)
|
151
|
+
project_folder_name_from(branch_name) do |error|
|
152
|
+
say_error error.message
|
153
|
+
exit 1
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
140
157
|
def init_options_for!(command:)
|
158
|
+
options_array = []
|
159
|
+
options_array << options.dup
|
160
|
+
|
141
161
|
say "Options before config file merge: #{options}" if options[:debug]
|
142
162
|
|
143
|
-
load_options
|
144
|
-
|
145
|
-
|
163
|
+
(load_options(defaults: DEFAULT_BRANCH_NAME_OPTIONS)[command.to_s] || {}).tap do |load_options|
|
164
|
+
say "No options loaded from config file(s): #{load_options}" if options[:debug] && load_options.blank?
|
165
|
+
say "Options loaded from config file(s): #{load_options}" if options[:debug]
|
166
|
+
|
167
|
+
options_array << Thor::CoreExt::HashWithIndifferentAccess.new(load_options.merge(options))
|
168
|
+
say "Options after config file merge: #{options_array.last}" if options_array.last[:debug]
|
169
|
+
end
|
146
170
|
|
147
|
-
|
148
|
-
say "Options after config file merge: #{options}" if options[:debug]
|
171
|
+
options_array
|
149
172
|
end
|
150
173
|
end
|
151
174
|
end
|
@@ -28,14 +28,12 @@ module Branch
|
|
28
28
|
}.freeze
|
29
29
|
# rubocop:enable Style/StringHashKeys
|
30
30
|
|
31
|
-
module_function
|
32
|
-
|
33
31
|
def global_config_file
|
34
|
-
File.join(global_folder, CONFIG_FILENAME)
|
32
|
+
File.join(Locatable.global_folder, CONFIG_FILENAME)
|
35
33
|
end
|
36
34
|
|
37
35
|
def local_config_file
|
38
|
-
File.join(local_folder, CONFIG_FILENAME)
|
36
|
+
File.join(Locatable.local_folder, CONFIG_FILENAME)
|
39
37
|
end
|
40
38
|
|
41
39
|
def global_config_file?
|
@@ -47,12 +45,16 @@ module Branch
|
|
47
45
|
end
|
48
46
|
|
49
47
|
def create_global_config_file!
|
50
|
-
|
48
|
+
create_options = DEFAULT_BRANCH_NAME_OPTIONS
|
49
|
+
yield create_options if block_given?
|
50
|
+
create_config_file global_config_file, create_options: create_options
|
51
51
|
print_global_config_file
|
52
52
|
end
|
53
53
|
|
54
54
|
def create_local_config_file!
|
55
|
-
|
55
|
+
create_options = DEFAULT_BRANCH_NAME_OPTIONS
|
56
|
+
yield create_options if block_given?
|
57
|
+
create_config_file local_config_file, create_options: create_options
|
56
58
|
print_local_config_file
|
57
59
|
end
|
58
60
|
|
@@ -84,9 +86,7 @@ module Branch
|
|
84
86
|
end
|
85
87
|
end
|
86
88
|
|
87
|
-
|
88
|
-
|
89
|
-
def create_config_file(config_file)
|
89
|
+
def create_config_file(config_file, create_options:)
|
90
90
|
folder = File.dirname(config_file)
|
91
91
|
unless Dir.exist?(folder)
|
92
92
|
say "Destination folder for configuration file (#{folder}) does not exist", ERROR
|
@@ -98,12 +98,14 @@ module Branch
|
|
98
98
|
return false
|
99
99
|
end
|
100
100
|
|
101
|
-
File.write(config_file,
|
101
|
+
File.write(config_file, create_options.to_yaml)
|
102
102
|
say "Configuration file (#{config_file}) created.", SUCCESS
|
103
103
|
|
104
104
|
true
|
105
105
|
end
|
106
106
|
|
107
|
+
private
|
108
|
+
|
107
109
|
def delete_config_file(config_file)
|
108
110
|
unless File.exist?(config_file)
|
109
111
|
say "Configuration file (#{config_file}) does not exist", WARNING
|
@@ -18,16 +18,23 @@ module Branch
|
|
18
18
|
desc 'info', 'Displays information about this gem configuration'
|
19
19
|
long_desc <<-LONG_DESC
|
20
20
|
NAME
|
21
|
-
|
21
|
+
|
22
22
|
`branch-name config info` -- Displays information about this gem configuration.
|
23
23
|
|
24
24
|
SYNOPSIS
|
25
|
-
|
25
|
+
|
26
26
|
branch-name config info
|
27
27
|
LONG_DESC
|
28
28
|
def info
|
29
29
|
print_global_config_file
|
30
30
|
say ''
|
31
|
+
|
32
|
+
if global_folder?
|
33
|
+
say 'NOTE: You are in your global folder. ' \
|
34
|
+
'Local and global configurations are the same.'.colorize(:yellow)
|
35
|
+
return
|
36
|
+
end
|
37
|
+
|
31
38
|
print_local_config_file
|
32
39
|
end
|
33
40
|
|
@@ -24,11 +24,11 @@ module Branch
|
|
24
24
|
desc 'all', 'Deletes all config files (local and global) for this gem'
|
25
25
|
long_desc <<-LONG_DESC
|
26
26
|
NAME
|
27
|
-
|
27
|
+
|
28
28
|
`branch-name config delete all` -- will remove the all .branch-name config files.
|
29
29
|
|
30
30
|
SYNOPSIS
|
31
|
-
|
31
|
+
|
32
32
|
branch-name config delete all
|
33
33
|
LONG_DESC
|
34
34
|
def all
|
@@ -39,11 +39,11 @@ module Branch
|
|
39
39
|
desc 'global', 'Deletes the global config file for this gem'
|
40
40
|
long_desc <<-LONG_DESC
|
41
41
|
NAME
|
42
|
-
|
42
|
+
|
43
43
|
`branch-name config delete global` -- will remove the global .branch-name config file.
|
44
44
|
|
45
45
|
SYNOPSIS
|
46
|
-
|
46
|
+
|
47
47
|
branch-name config delete global
|
48
48
|
LONG_DESC
|
49
49
|
def global
|
@@ -53,11 +53,11 @@ module Branch
|
|
53
53
|
desc 'local', 'Deletes the local config file for this gem'
|
54
54
|
long_desc <<-LONG_DESC
|
55
55
|
NAME
|
56
|
-
|
56
|
+
|
57
57
|
`branch-name config delete local` -- will remove the local .branch-name config file.
|
58
58
|
|
59
59
|
SYNOPSIS
|
60
|
-
|
60
|
+
|
61
61
|
branch-name config delete local
|
62
62
|
LONG_DESC
|
63
63
|
def local
|
@@ -24,12 +24,12 @@ module Branch
|
|
24
24
|
desc 'global', 'Creates and initializes a .branch-name file in the global folder'
|
25
25
|
long_desc <<-LONG_DESC
|
26
26
|
NAME
|
27
|
-
|
27
|
+
|
28
28
|
`branch-name config init global` -- will create and initialize a .branch-name file
|
29
29
|
in the "#{Locatable.global_folder}" folder.
|
30
30
|
|
31
31
|
SYNOPSIS
|
32
|
-
|
32
|
+
|
33
33
|
branch-name config init global
|
34
34
|
LONG_DESC
|
35
35
|
def global
|
@@ -39,12 +39,12 @@ module Branch
|
|
39
39
|
desc 'local', 'Creates and initializes a .branch-name file in the local folder'
|
40
40
|
long_desc <<-LONG_DESC
|
41
41
|
NAME
|
42
|
-
|
42
|
+
|
43
43
|
`branch-name config init local` -- will create and initialize a .branch-name file
|
44
44
|
in the "#{Locatable.local_folder}" folder.
|
45
45
|
|
46
46
|
SYNOPSIS
|
47
|
-
|
47
|
+
|
48
48
|
branch-name config init local
|
49
49
|
LONG_DESC
|
50
50
|
def local
|
data/lib/branch/name/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: branch-name
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.10.
|
4
|
+
version: 3.10.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gene M. Angelo, Jr.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -34,16 +34,22 @@ dependencies:
|
|
34
34
|
name: colorize
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "
|
37
|
+
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: 0.8.1
|
40
|
+
- - "<"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 1.2.0
|
40
43
|
type: :runtime
|
41
44
|
prerelease: false
|
42
45
|
version_requirements: !ruby/object:Gem::Requirement
|
43
46
|
requirements:
|
44
|
-
- - "
|
47
|
+
- - ">="
|
45
48
|
- !ruby/object:Gem::Version
|
46
49
|
version: 0.8.1
|
50
|
+
- - "<"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 1.2.0
|
47
53
|
- !ruby/object:Gem::Dependency
|
48
54
|
name: os
|
49
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,7 +79,7 @@ dependencies:
|
|
73
79
|
version: '1.2'
|
74
80
|
- - ">="
|
75
81
|
- !ruby/object:Gem::Version
|
76
|
-
version: 1.2.
|
82
|
+
version: 1.2.2
|
77
83
|
type: :runtime
|
78
84
|
prerelease: false
|
79
85
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -83,7 +89,7 @@ dependencies:
|
|
83
89
|
version: '1.2'
|
84
90
|
- - ">="
|
85
91
|
- !ruby/object:Gem::Version
|
86
|
-
version: 1.2.
|
92
|
+
version: 1.2.2
|
87
93
|
- !ruby/object:Gem::Dependency
|
88
94
|
name: thor_nested_subcommand
|
89
95
|
requirement: !ruby/object:Gem::Requirement
|
@@ -91,6 +97,9 @@ dependencies:
|
|
91
97
|
- - "~>"
|
92
98
|
- !ruby/object:Gem::Version
|
93
99
|
version: '1.0'
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 1.0.1
|
94
103
|
type: :runtime
|
95
104
|
prerelease: false
|
96
105
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -98,6 +107,9 @@ dependencies:
|
|
98
107
|
- - "~>"
|
99
108
|
- !ruby/object:Gem::Version
|
100
109
|
version: '1.0'
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 1.0.1
|
101
113
|
description: |2
|
102
114
|
branch-name is a gem that provides a command-line interface that allows you to accomplish several tasks, tasks I personally find myself having to carry out every time I work on a feature branch. I created this gem for myself; however, you are free to use it yourself, if any of these tasks fits into your personal routine:
|
103
115
|
|
@@ -165,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
177
|
- !ruby/object:Gem::Version
|
166
178
|
version: '0'
|
167
179
|
requirements: []
|
168
|
-
rubygems_version: 3.
|
180
|
+
rubygems_version: 3.2.15
|
169
181
|
signing_key:
|
170
182
|
specification_version: 4
|
171
183
|
summary: Generates a branch name based on a JIRA ticket/ticket number.
|