git_reflow 0.9.6 → 0.9.9
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/.github/workflows/multi-ruby-tests.yml +1 -1
- data/CHANGELOG.md +29 -0
- data/Gemfile.lock +6 -6
- data/lib/git_reflow/git_helpers.rb +2 -0
- data/lib/git_reflow/version.rb +1 -1
- data/lib/git_reflow/workflow.rb +26 -14
- data/lib/git_reflow/workflows/core.rb +2 -2
- data/spec/lib/git_reflow/git_helpers_spec.rb +9 -1
- data/spec/lib/git_reflow/workflows/core_spec.rb +1 -2
- data/spec/lib/git_reflow_spec.rb +1 -0
- 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: 71b211551532be88db262a0a26ecb4a63072b7090eafbbadff217efe80bb4c3b
|
4
|
+
data.tar.gz: ef3434b6020aa61b9da30b7602f162f9da8ca99ae3da4de32fdc30bcc3f648f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cc0b3e505894ea29a5322014f8459fdc41a74da50098c2f8fffa58039b1d94558538c0d03b824af949a985e34b1cc3a151f84b83b191e6c4df74f321785f82a
|
7
|
+
data.tar.gz: 3737b674eb342c8b8fe0047b637c978b0fdad4d30c228061343f20d9171e9278e0f9356a752f79e0d7d032e7ba969dd5a7f963f654b8e58955ec0eada3673b6a
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,34 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v0.9.9](https://github.com/reenhanced/gitreflow/tree/v0.9.9) (2022-03-01)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/reenhanced/gitreflow/compare/v0.9.7...HEAD)
|
6
|
+
|
7
|
+
**Bug fixes:**
|
8
|
+
|
9
|
+
- Fixes issue with custom workflows failing to load due to a race condition
|
10
|
+
preventing GitReflow.logger from loading before the rest of the library in
|
11
|
+
Ruby 3.0+
|
12
|
+
- Cleans up tests and bump Ruby versions in GH workflows
|
13
|
+
|
14
|
+
## [v0.9.8](https://github.com/reenhanced/gitreflow/tree/v0.9.8) (2022-02-20)
|
15
|
+
|
16
|
+
[Full Changelog](https://github.com/reenhanced/gitreflow/compare/v0.9.7...HEAD)
|
17
|
+
|
18
|
+
**Bug fixes:**
|
19
|
+
|
20
|
+
- Fixes a bug accidentally introduced when attempting to debug OptionParser issue.
|
21
|
+
|
22
|
+
# Changelog
|
23
|
+
|
24
|
+
## [v0.9.7](https://github.com/reenhanced/gitreflow/tree/v0.9.7) (2022-02-20)
|
25
|
+
|
26
|
+
[Full Changelog](https://github.com/reenhanced/gitreflow/compare/v0.9.6...HEAD)
|
27
|
+
|
28
|
+
**Bug fixes:**
|
29
|
+
|
30
|
+
- Correctly parse command line flag and switch values when no help docs are provided
|
31
|
+
|
3
32
|
## [v0.9.6](https://github.com/reenhanced/gitreflow/tree/v0.9.6) (2021-11-05)
|
4
33
|
|
5
34
|
[Full Changelog](https://github.com/reenhanced/gitreflow/compare/v0.9.5...HEAD)
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
git_reflow (0.9.
|
4
|
+
git_reflow (0.9.9)
|
5
5
|
bundler (>= 1.10.0)
|
6
6
|
codenamev_bitbucket_api (= 0.4.1)
|
7
7
|
colorize (>= 0.8.1)
|
@@ -95,17 +95,17 @@ GEM
|
|
95
95
|
concurrent-ruby (~> 1.0)
|
96
96
|
jwt (2.3.0)
|
97
97
|
method_source (1.0.0)
|
98
|
-
mini_portile2 (2.
|
98
|
+
mini_portile2 (2.8.0)
|
99
99
|
minitest (5.14.4)
|
100
100
|
multi_json (1.15.0)
|
101
101
|
multi_xml (0.6.0)
|
102
102
|
multipart-post (2.1.1)
|
103
103
|
nio4r (2.5.7)
|
104
|
-
nokogiri (1.
|
105
|
-
mini_portile2 (~> 2.
|
104
|
+
nokogiri (1.13.3)
|
105
|
+
mini_portile2 (~> 2.8.0)
|
106
106
|
racc (~> 1.4)
|
107
|
-
oauth2 (1.4.
|
108
|
-
faraday (>= 0.
|
107
|
+
oauth2 (1.4.9)
|
108
|
+
faraday (>= 0.17.3, < 3.0)
|
109
109
|
jwt (>= 1.0, < 3.0)
|
110
110
|
multi_json (~> 1.3)
|
111
111
|
multi_xml (~> 0.5)
|
data/lib/git_reflow/version.rb
CHANGED
data/lib/git_reflow/workflow.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'git_reflow/logger'
|
1
2
|
require 'git_reflow/sandbox'
|
2
3
|
require 'git_reflow/git_helpers'
|
3
4
|
require 'bundler/inline'
|
@@ -77,8 +78,12 @@ module GitReflow
|
|
77
78
|
GitReflow.git_server
|
78
79
|
end
|
79
80
|
|
80
|
-
def logger
|
81
|
-
|
81
|
+
def logger(*args)
|
82
|
+
return @logger if defined?(@logger)
|
83
|
+
|
84
|
+
@logger = GitReflow.try(:logger, *args) || GitReflow::Logger.new(*args)
|
85
|
+
rescue NoMethodError
|
86
|
+
@logger = GitReflow::Logger.new(*args)
|
82
87
|
end
|
83
88
|
|
84
89
|
# Checks for an installed gem, and if none is installed use bundler's
|
@@ -113,10 +118,10 @@ module GitReflow
|
|
113
118
|
# @param name [String] the name of the Workflow file to use as a basis
|
114
119
|
def use(workflow_name)
|
115
120
|
if workflows.key?(workflow_name)
|
116
|
-
|
121
|
+
logger.debug "Using Workflow: #{workflow_name}"
|
117
122
|
GitReflow::Workflows::Core.load_workflow(workflows[workflow_name])
|
118
123
|
else
|
119
|
-
|
124
|
+
logger.error "Tried to use non-existent Workflow: #{workflow_name}"
|
120
125
|
end
|
121
126
|
end
|
122
127
|
|
@@ -157,6 +162,7 @@ module GitReflow
|
|
157
162
|
self.commands[name] = params
|
158
163
|
self.command_docs[name] = params
|
159
164
|
|
165
|
+
logger.debug "adding new command '#{name}' with #{defaults.inspect}"
|
160
166
|
self.define_singleton_method(name) do |args = {}|
|
161
167
|
args_with_defaults = {}
|
162
168
|
args.each do |name, value|
|
@@ -173,18 +179,18 @@ module GitReflow
|
|
173
179
|
end
|
174
180
|
end
|
175
181
|
|
176
|
-
|
182
|
+
logger.debug "callbacks: #{callbacks.inspect}"
|
177
183
|
Array(callbacks[:before][name]).each do |block|
|
178
|
-
|
184
|
+
logger.debug "(before) callback running for `#{name}` command..."
|
179
185
|
argument_overrides = block.call(**args_with_defaults) || {}
|
180
186
|
args_with_defaults.merge!(argument_overrides) if argument_overrides.is_a?(Hash)
|
181
187
|
end
|
182
188
|
|
183
|
-
|
189
|
+
logger.info "Running command `#{name}` with args: #{args_with_defaults.inspect}..."
|
184
190
|
block.call(**args_with_defaults)
|
185
191
|
|
186
192
|
Array(callbacks[:after][name]).each do |block|
|
187
|
-
|
193
|
+
logger.debug "(after) callback running for `#{name}` command..."
|
188
194
|
block.call(**args_with_defaults)
|
189
195
|
end
|
190
196
|
end
|
@@ -202,9 +208,9 @@ module GitReflow
|
|
202
208
|
def before(name, &block)
|
203
209
|
name = name.to_sym
|
204
210
|
if commands[name].nil?
|
205
|
-
|
211
|
+
logger.error "Attempted to register (before) callback for non-existing command: #{name}"
|
206
212
|
else
|
207
|
-
|
213
|
+
logger.debug "(before) callback registered for: #{name}"
|
208
214
|
callbacks[:before][name] ||= []
|
209
215
|
callbacks[:before][name] << block
|
210
216
|
end
|
@@ -222,9 +228,9 @@ module GitReflow
|
|
222
228
|
def after(name, &block)
|
223
229
|
name = name.to_sym
|
224
230
|
if commands[name].nil?
|
225
|
-
|
231
|
+
logger.error "Attempted to register (after) callback for non-existing command: #{name}"
|
226
232
|
else
|
227
|
-
|
233
|
+
logger.debug "(after) callback registered for: #{name}"
|
228
234
|
callbacks[:after][name] ||= []
|
229
235
|
callbacks[:after][name] << block
|
230
236
|
end
|
@@ -310,13 +316,19 @@ module GitReflow
|
|
310
316
|
opts.separator "COMMAND OPTIONS:" if docs[:flags].any? || docs[:switches].any?
|
311
317
|
|
312
318
|
self.commands[name][:flags].each do |flag_name, flag_default|
|
313
|
-
|
319
|
+
# There is a bug in Ruby that will not parse the flag value if no
|
320
|
+
# help text is provided. Fallback to the flag name.
|
321
|
+
flag_help = command_docs[name][:flags][flag_name] || flag_name
|
322
|
+
opts.on("-#{flag_name[0]}", "--#{flag_name} #{flag_name.upcase}", flag_help) do |f|
|
314
323
|
options[kebab_to_underscore(flag_name)] = f || flag_default
|
315
324
|
end
|
316
325
|
end
|
317
326
|
|
318
327
|
self.commands[name][:switches].each do |switch_name, switch_default|
|
319
|
-
|
328
|
+
# There is a bug in Ruby that will not parse the switch value if no
|
329
|
+
# help text is provided. Fallback to the switch name.
|
330
|
+
switch_help = command_docs[name][:switches][switch_name] || switch_name
|
331
|
+
opts.on("-#{switch_name[0]}", "--[no-]#{switch_name}", switch_help) do |s|
|
320
332
|
options[kebab_to_underscore(switch_name)] = s || switch_default
|
321
333
|
end
|
322
334
|
end
|
@@ -13,7 +13,7 @@ module GitReflow
|
|
13
13
|
# @param workflow_path [String] the path of the Workflow file to eval
|
14
14
|
def self.load_workflow(workflow_path)
|
15
15
|
return unless workflow_path.length > 0 and File.exists?(workflow_path)
|
16
|
-
|
16
|
+
logger.debug "Using workflow: #{workflow_path}"
|
17
17
|
self.load_raw_workflow(File.read(workflow_path))
|
18
18
|
end
|
19
19
|
|
@@ -22,7 +22,7 @@ module GitReflow
|
|
22
22
|
# @param workflow_string [String] the contents of a Workflow file to eval
|
23
23
|
def self.load_raw_workflow(workflow_string)
|
24
24
|
return if workflow_string.strip.empty?
|
25
|
-
|
25
|
+
logger.debug "Evaluating workflow..."
|
26
26
|
binding.eval(workflow_string)
|
27
27
|
end
|
28
28
|
|
@@ -30,7 +30,15 @@ describe GitReflow::GitHelpers do
|
|
30
30
|
|
31
31
|
describe ".git_root_dir" do
|
32
32
|
subject { Gitacular.git_root_dir }
|
33
|
-
|
33
|
+
|
34
|
+
before { Gitacular.instance_variable_set(:@git_root_dir, nil) }
|
35
|
+
|
36
|
+
it { expect(subject).to eq(Dir.pwd) }
|
37
|
+
|
38
|
+
context "when not in the root directory" do
|
39
|
+
before { allow(Dir).to receive(:pwd).and_return("/tmp/nope") }
|
40
|
+
it { expect { subject }.to have_run_command_silently "git rev-parse --show-toplevel" }
|
41
|
+
end
|
34
42
|
end
|
35
43
|
|
36
44
|
describe ".git_editor_command" do
|
@@ -34,7 +34,6 @@ describe GitReflow::Workflows::Core do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
describe ".load_raw_workflow(workflow_string)" do
|
37
|
-
before { allow(GitReflow::Workflows::Core).to receive(:load_workflow).and_call_original }
|
38
37
|
it "evaluates the raw string in the context of the Core workflow" do
|
39
38
|
workflow_content = <<~WORKFLOW_CONTENT
|
40
39
|
command :dummy do
|
@@ -44,7 +43,7 @@ describe GitReflow::Workflows::Core do
|
|
44
43
|
fake_binding = instance_double(Binding)
|
45
44
|
expect(fake_binding).to receive(:eval).with(workflow_content)
|
46
45
|
expect(described_class).to receive(:binding).and_return(fake_binding)
|
47
|
-
|
46
|
+
described_class.load_raw_workflow(workflow_content)
|
48
47
|
end
|
49
48
|
end
|
50
49
|
|
data/spec/lib/git_reflow_spec.rb
CHANGED
@@ -41,6 +41,7 @@ describe GitReflow do
|
|
41
41
|
it "calls the defined workflow methods instead of the default core" do
|
42
42
|
workflow_path = File.join(File.expand_path("../../fixtures", __FILE__), "/awesome_workflow.rb")
|
43
43
|
allow(GitReflow::Config).to receive(:get).with("reflow.workflow").and_return(workflow_path)
|
44
|
+
allow(GitReflow::Workflows::Core).to receive(:load_raw_workflow)
|
44
45
|
expect(GitReflow::Workflows::Core).to receive(:load_raw_workflow).with(File.read(workflow_path)).and_call_original
|
45
46
|
|
46
47
|
expect{ subject.start }.to have_said "Awesome."
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_reflow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Valentino Stoll
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2022-03-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: appraisal
|