branch-name 3.3.0 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/lib/branch/name/cli.rb +13 -7
- data/lib/branch/name/colorizable.rb +1 -0
- data/lib/branch/name/configurable.rb +4 -2
- data/lib/branch/name/normalizable.rb +4 -1
- data/lib/branch/name/projectable.rb +16 -4
- data/lib/branch/name/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b538070d81c24a53a841d1502a2e846fde4c9349df8f627be5ec21cc133f3446
|
4
|
+
data.tar.gz: 26db98632c66f0d0a020219c4e0f34877d22a71ba741fcabbb42b63f2be5a131
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9534c3a6f80ed67115a2e7c2c44651212d7c32e7b7b41d6319ab90da0e978f063faa8f22940d84c6da139237a3a01dcad176eca49a618ee2d9b2673295add1b2
|
7
|
+
data.tar.gz: d8d9a7ac27d35525a0981e85b094c45841893f3c6a70f1fd2eccaabbac8345a50726e456b53e6942f0f45eee31392ffffb495813963f50b4530c690106831418
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## ['3.4.0'] - 2022-10-04
|
2
|
+
* Changes
|
3
|
+
* `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.
|
4
|
+
* Various changes in information printed to stdout when (for example) creating projects.
|
5
|
+
|
1
6
|
## ['3.3.0'] - 2022-09-27
|
2
7
|
* Enhancements:
|
3
8
|
* `branch-name config info` now displays the contents of both the Global and the local config files.
|
data/Gemfile.lock
CHANGED
data/lib/branch/name/cli.rb
CHANGED
@@ -90,7 +90,7 @@ module Branch
|
|
90
90
|
|
91
91
|
def create(ticket_description, ticket = nil)
|
92
92
|
if ticket_description.blank?
|
93
|
-
say_error 'description is required',
|
93
|
+
say_error 'description is required', ERROR
|
94
94
|
exit 1
|
95
95
|
end
|
96
96
|
|
@@ -100,18 +100,24 @@ module Branch
|
|
100
100
|
say_error error.message
|
101
101
|
exit 1
|
102
102
|
end
|
103
|
-
say "Branch name: #{branch_name}", :cyan
|
103
|
+
say "Branch name: \"#{branch_name}\"", :cyan
|
104
|
+
say "Branch name \"#{branch_name}\" has been copied to the clipboard!", SUCCESS if copy_to_clipboard branch_name
|
104
105
|
|
105
106
|
if options[:project]
|
106
|
-
|
107
|
+
project_folder_name = project_folder_name_from(branch_name) do |error|
|
107
108
|
say_error error.message
|
108
109
|
exit 1
|
109
110
|
end
|
110
|
-
|
111
|
-
|
112
|
-
|
111
|
+
project_folder = project_folder_for branch_name
|
112
|
+
unless yes? "Create project for branch \"#{branch_name}\" " \
|
113
|
+
"in folder \"#{project_folder}\" (y/n)?", :cyan
|
114
|
+
say 'Aborted.', ABORTED
|
115
|
+
return
|
116
|
+
end
|
113
117
|
|
114
|
-
|
118
|
+
say "Project folder name: \"#{project_folder_name}\"", :cyan
|
119
|
+
create_project!(project_folder_name)
|
120
|
+
end
|
115
121
|
end
|
116
122
|
|
117
123
|
desc 'config SUBCOMMAND', 'Manages config files for this gem'
|
@@ -47,10 +47,12 @@ module Branch
|
|
47
47
|
|
48
48
|
def create_global_config_file!
|
49
49
|
create_config_file global_config_file
|
50
|
+
print_global_config_file
|
50
51
|
end
|
51
52
|
|
52
53
|
def create_local_config_file!
|
53
54
|
create_config_file local_config_file
|
55
|
+
print_local_config_file
|
54
56
|
end
|
55
57
|
|
56
58
|
def delete_global_config_file!
|
@@ -96,7 +98,7 @@ module Branch
|
|
96
98
|
end
|
97
99
|
|
98
100
|
File.write(config_file, DEFAULT_BRANCH_NAME_OPTIONS.to_yaml)
|
99
|
-
say "Configuration file (#{config_file}) created", SUCCESS
|
101
|
+
say "Configuration file (#{config_file}) created.", SUCCESS
|
100
102
|
|
101
103
|
true
|
102
104
|
end
|
@@ -114,7 +116,7 @@ module Branch
|
|
114
116
|
end
|
115
117
|
|
116
118
|
def print_config_file(config_file)
|
117
|
-
hash = YAML.
|
119
|
+
hash = YAML.safe_load(File.open(config_file))
|
118
120
|
say hash.to_yaml.gsub("\n-", "\n\n-"), SUCCESS
|
119
121
|
end
|
120
122
|
end
|
@@ -25,7 +25,10 @@ module Branch
|
|
25
25
|
yield e
|
26
26
|
end
|
27
27
|
|
28
|
-
|
28
|
+
# Returns a project folder name from a normalized branch name.
|
29
|
+
# The location of the folder is not included; that is, the
|
30
|
+
# folder returned is not fully qualified.
|
31
|
+
def project_folder_name_from(normalized_branch_name)
|
29
32
|
normalize_token normalized_branch_name, PROJECT_FOLDER_REGEX
|
30
33
|
rescue Branch::Name::OptionError => e
|
31
34
|
raise unless block_given?
|
@@ -11,8 +11,7 @@ module Branch
|
|
11
11
|
def create_project!(branch_name)
|
12
12
|
raise 'options[:project] is false' unless options[:project]
|
13
13
|
|
14
|
-
|
15
|
-
project_folder = "#{project_location}/#{branch_name}"
|
14
|
+
project_folder = project_folder_for branch_name
|
16
15
|
|
17
16
|
if Dir.exist? project_folder
|
18
17
|
puts "Project folder \"#{project_folder}\" already exists"
|
@@ -23,7 +22,15 @@ module Branch
|
|
23
22
|
FileUtils.mkdir_p(project_folder)
|
24
23
|
create_project_files!(project_folder)
|
25
24
|
|
26
|
-
|
25
|
+
project_files = options[:project_files]
|
26
|
+
if project_files.blank?
|
27
|
+
puts "Project folder \"#{project_folder}\" was created.".green
|
28
|
+
else
|
29
|
+
puts "Project folder \"#{project_folder}\" was created with project files:".green
|
30
|
+
project_files.each do |project_file|
|
31
|
+
puts "- #{project_file}".green
|
32
|
+
end
|
33
|
+
end
|
27
34
|
end
|
28
35
|
|
29
36
|
def create_project_files!(project_folder)
|
@@ -40,9 +47,14 @@ module Branch
|
|
40
47
|
next if File.exist? full_file_name
|
41
48
|
|
42
49
|
FileUtils.touch full_file_name
|
43
|
-
puts "Created project file \"#{full_file_name}\""
|
50
|
+
puts "Created project file \"#{full_file_name}\"" if options[:verbose]
|
44
51
|
end
|
45
52
|
end
|
53
|
+
|
54
|
+
def project_folder_for(branch_name)
|
55
|
+
project_location = Time.new.strftime(options[:project_location])
|
56
|
+
"#{project_location}/#{branch_name}"
|
57
|
+
end
|
46
58
|
end
|
47
59
|
end
|
48
60
|
end
|
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.
|
4
|
+
version: 3.4.0
|
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: 2022-
|
11
|
+
date: 2022-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|