branch-name 3.2.2 → 3.3.0
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/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/branch/name/colorizable.rb +11 -0
- data/lib/branch/name/configurable.rb +33 -5
- data/lib/branch/name/subcommands/config.rb +3 -11
- data/lib/branch/name/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8085a7825aafe9da8526d6738b3a6df3f407632f8b7dae29e49a3bb51495642
|
4
|
+
data.tar.gz: 5fbf55ee24b31c7499a8077155a13b621054cad17f207101bf66833557eba6d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a5252cc84fb2d0ff6b521da27c2e3316bfba1cdd3e37c98b326ee4abca43cb9ec1272beceb72318948f4bc454a5e979c97d8cf6ba5abc563cabafd27dbdafd1
|
7
|
+
data.tar.gz: b445dca1d9b01df49e70ac2152502f57ac4afbdfb95c9dd94ee631b136f9d4ea009bd4830792e9792d09c777e8a1227247b403c6a13889464812f214b2b07cf4
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## ['3.3.0'] - 2022-09-27
|
2
|
+
* Enhancements:
|
3
|
+
* `branch-name config info` now displays the contents of both the Global and the local config files.
|
4
|
+
|
1
5
|
## ['3.2.2'] - 2022-09-27
|
2
6
|
* Changes:
|
3
7
|
* Refactor code that patches Thor incorrect display of nested commands (subcommangs).
|
data/Gemfile.lock
CHANGED
@@ -3,14 +3,17 @@
|
|
3
3
|
require 'colorize'
|
4
4
|
require 'fileutils'
|
5
5
|
require 'yaml'
|
6
|
+
require_relative 'colorizable'
|
6
7
|
require_relative 'locatable'
|
7
8
|
|
8
9
|
module Branch
|
9
10
|
module Name
|
10
11
|
module Configurable
|
12
|
+
include Colorizable
|
11
13
|
include Locatable
|
12
14
|
|
13
15
|
CONFIG_FILENAME = '.branch-name'
|
16
|
+
|
14
17
|
# rubocop:disable Style/StringHashKeys - YAML writing/loading necessitates this
|
15
18
|
DEFAULT_BRANCH_NAME_OPTIONS = {
|
16
19
|
'create' => {
|
@@ -58,37 +61,62 @@ module Branch
|
|
58
61
|
delete_config_file local_config_file
|
59
62
|
end
|
60
63
|
|
64
|
+
def print_global_config_file
|
65
|
+
config_file = global_config_file
|
66
|
+
if global_config_file?
|
67
|
+
say "Global config file (#{config_file}) contents:", SUCCESS
|
68
|
+
print_config_file config_file
|
69
|
+
else
|
70
|
+
say "Global config file (#{config_file}) does not exist.", WARNING
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def print_local_config_file
|
75
|
+
config_file = local_config_file
|
76
|
+
if local_config_file?
|
77
|
+
say "Local config file (#{config_file}) contents:", SUCCESS
|
78
|
+
print_config_file config_file
|
79
|
+
else
|
80
|
+
say "Local config file (#{config_file}) does not exist.", WARNING
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
61
84
|
private
|
62
85
|
|
63
86
|
def create_config_file(config_file)
|
64
87
|
folder = File.dirname(config_file)
|
65
88
|
unless Dir.exist?(folder)
|
66
|
-
say "Destination folder for configuration file (#{folder}) does not exist"
|
89
|
+
say "Destination folder for configuration file (#{folder}) does not exist", ERROR
|
67
90
|
return false
|
68
91
|
end
|
69
92
|
|
70
93
|
if File.exist?(config_file)
|
71
|
-
|
94
|
+
say "Configuration file (#{config_file}) already exists", WARNING
|
72
95
|
return false
|
73
96
|
end
|
74
97
|
|
75
98
|
File.write(config_file, DEFAULT_BRANCH_NAME_OPTIONS.to_yaml)
|
76
|
-
|
99
|
+
say "Configuration file (#{config_file}) created", SUCCESS
|
77
100
|
|
78
101
|
true
|
79
102
|
end
|
80
103
|
|
81
104
|
def delete_config_file(config_file)
|
82
105
|
unless File.exist?(config_file)
|
83
|
-
|
106
|
+
say "Configuration file (#{config_file}) does not exist", WARNING
|
84
107
|
return false
|
85
108
|
end
|
86
109
|
|
87
110
|
File.delete config_file
|
88
|
-
|
111
|
+
say "Configuration file (#{config_file}) deleted", SUCCESS
|
89
112
|
|
90
113
|
true
|
91
114
|
end
|
115
|
+
|
116
|
+
def print_config_file(config_file)
|
117
|
+
hash = YAML.load(File.open(config_file))
|
118
|
+
say hash.to_yaml.gsub("\n-", "\n\n-"), SUCCESS
|
119
|
+
end
|
92
120
|
end
|
93
121
|
end
|
94
122
|
end
|
@@ -26,17 +26,9 @@ module Branch
|
|
26
26
|
branch-name config info
|
27
27
|
LONG_DESC
|
28
28
|
def info
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
say "Global config file does not exist at: \"#{global_folder}\"", :yellow
|
33
|
-
end
|
34
|
-
|
35
|
-
if local_config_file?
|
36
|
-
say "Local config file exists: \"#{local_config_file}\"", :green
|
37
|
-
else
|
38
|
-
say "Local config file does not exist at: \"#{local_folder}\"", :yellow
|
39
|
-
end
|
29
|
+
print_global_config_file
|
30
|
+
say ''
|
31
|
+
print_local_config_file
|
40
32
|
end
|
41
33
|
|
42
34
|
desc 'init SUBCOMMAND', 'Sets up config files for this gem'
|
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.3.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-09-
|
11
|
+
date: 2022-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -110,6 +110,7 @@ files:
|
|
110
110
|
- lib/branch/name/cli.rb
|
111
111
|
- lib/branch/name/cli/thor_ext/shell/basic/say_error.rb
|
112
112
|
- lib/branch/name/clipable.rb
|
113
|
+
- lib/branch/name/colorizable.rb
|
113
114
|
- lib/branch/name/configurable.rb
|
114
115
|
- lib/branch/name/exitable.rb
|
115
116
|
- lib/branch/name/loadable.rb
|