git_reflow 0.9.8 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72b11a5519ef9749a971a39fe8f5db8184b690a20fd6252580ec9e065aa0cc2b
4
- data.tar.gz: 22e88f4979e30671592e2c1ef5206cb71ea79aa51e194ed79731d15ffa096522
3
+ metadata.gz: 71b211551532be88db262a0a26ecb4a63072b7090eafbbadff217efe80bb4c3b
4
+ data.tar.gz: ef3434b6020aa61b9da30b7602f162f9da8ca99ae3da4de32fdc30bcc3f648f1
5
5
  SHA512:
6
- metadata.gz: 82605482502f22b09d7915aeba4222f7db16b10e42b7c8a9446f1770f6a1d22e663096832b806b4205be27d3045f2cb1c67e8194cca534dbdd9a5701e60fae03
7
- data.tar.gz: f6f32d501815ffd8d66e0402db7c8433fafd5494e4da1af4c3106d4efd86a84b0c4909c54d9b9c00a0f5842d1f3bb0bd847dd9dca7066168f6c3d44b6e5dfd04
6
+ metadata.gz: 1cc0b3e505894ea29a5322014f8459fdc41a74da50098c2f8fffa58039b1d94558538c0d03b824af949a985e34b1cc3a151f84b83b191e6c4df74f321785f82a
7
+ data.tar.gz: 3737b674eb342c8b8fe0047b637c978b0fdad4d30c228061343f20d9171e9278e0f9356a752f79e0d7d032e7ba969dd5a7f963f654b8e58955ec0eada3673b6a
@@ -12,7 +12,7 @@ jobs:
12
12
  fail-fast: true
13
13
  matrix:
14
14
  os: [ ubuntu-latest, macos-latest ]
15
- ruby: ['2.6.6', '2.7.2', '3.0.0 ']
15
+ ruby: ['2.6.9', '2.7.5', '3.0.3 ', '3.1.1']
16
16
  runs-on: ${{ matrix.os }}
17
17
  steps:
18
18
  - uses: actions/checkout@v2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
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
+
3
14
  ## [v0.9.8](https://github.com/reenhanced/gitreflow/tree/v0.9.8) (2022-02-20)
4
15
 
5
16
  [Full Changelog](https://github.com/reenhanced/gitreflow/compare/v0.9.7...HEAD)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- git_reflow (0.9.8)
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,14 +95,14 @@ GEM
95
95
  concurrent-ruby (~> 1.0)
96
96
  jwt (2.3.0)
97
97
  method_source (1.0.0)
98
- mini_portile2 (2.7.1)
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.13.1)
105
- mini_portile2 (~> 2.7.0)
104
+ nokogiri (1.13.3)
105
+ mini_portile2 (~> 2.8.0)
106
106
  racc (~> 1.4)
107
107
  oauth2 (1.4.9)
108
108
  faraday (>= 0.17.3, < 3.0)
@@ -14,6 +14,8 @@ module GitReflow
14
14
 
15
15
  def git_root_dir
16
16
  return @git_root_dir unless @git_root_dir.to_s.empty?
17
+ return @git_root_dir = Dir.pwd if Dir.exists?("#{Dir.pwd}/.git")
18
+
17
19
  @git_root_dir = run('git rev-parse --show-toplevel', loud: false).strip
18
20
  end
19
21
 
@@ -1,3 +1,3 @@
1
1
  module GitReflow
2
- VERSION = "0.9.8"
2
+ VERSION = "0.9.9"
3
3
  end
@@ -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
- GitReflow.logger
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
- GitReflow.logger.debug "Using Workflow: #{workflow_name}"
121
+ logger.debug "Using Workflow: #{workflow_name}"
117
122
  GitReflow::Workflows::Core.load_workflow(workflows[workflow_name])
118
123
  else
119
- GitReflow.logger.error "Tried to use non-existent Workflow: #{workflow_name}"
124
+ logger.error "Tried to use non-existent Workflow: #{workflow_name}"
120
125
  end
121
126
  end
122
127
 
@@ -157,7 +162,7 @@ module GitReflow
157
162
  self.commands[name] = params
158
163
  self.command_docs[name] = params
159
164
 
160
- GitReflow.logger.debug "adding new command '#{name}' with #{defaults.inspect}"
165
+ logger.debug "adding new command '#{name}' with #{defaults.inspect}"
161
166
  self.define_singleton_method(name) do |args = {}|
162
167
  args_with_defaults = {}
163
168
  args.each do |name, value|
@@ -174,18 +179,18 @@ module GitReflow
174
179
  end
175
180
  end
176
181
 
177
- GitReflow.logger.debug "callbacks: #{callbacks.inspect}"
182
+ logger.debug "callbacks: #{callbacks.inspect}"
178
183
  Array(callbacks[:before][name]).each do |block|
179
- GitReflow.logger.debug "(before) callback running for `#{name}` command..."
184
+ logger.debug "(before) callback running for `#{name}` command..."
180
185
  argument_overrides = block.call(**args_with_defaults) || {}
181
186
  args_with_defaults.merge!(argument_overrides) if argument_overrides.is_a?(Hash)
182
187
  end
183
188
 
184
- GitReflow.logger.info "Running command `#{name}` with args: #{args_with_defaults.inspect}..."
189
+ logger.info "Running command `#{name}` with args: #{args_with_defaults.inspect}..."
185
190
  block.call(**args_with_defaults)
186
191
 
187
192
  Array(callbacks[:after][name]).each do |block|
188
- GitReflow.logger.debug "(after) callback running for `#{name}` command..."
193
+ logger.debug "(after) callback running for `#{name}` command..."
189
194
  block.call(**args_with_defaults)
190
195
  end
191
196
  end
@@ -203,9 +208,9 @@ module GitReflow
203
208
  def before(name, &block)
204
209
  name = name.to_sym
205
210
  if commands[name].nil?
206
- GitReflow.logger.error "Attempted to register (before) callback for non-existing command: #{name}"
211
+ logger.error "Attempted to register (before) callback for non-existing command: #{name}"
207
212
  else
208
- GitReflow.logger.debug "(before) callback registered for: #{name}"
213
+ logger.debug "(before) callback registered for: #{name}"
209
214
  callbacks[:before][name] ||= []
210
215
  callbacks[:before][name] << block
211
216
  end
@@ -223,9 +228,9 @@ module GitReflow
223
228
  def after(name, &block)
224
229
  name = name.to_sym
225
230
  if commands[name].nil?
226
- GitReflow.logger.error "Attempted to register (after) callback for non-existing command: #{name}"
231
+ logger.error "Attempted to register (after) callback for non-existing command: #{name}"
227
232
  else
228
- GitReflow.logger.debug "(after) callback registered for: #{name}"
233
+ logger.debug "(after) callback registered for: #{name}"
229
234
  callbacks[:after][name] ||= []
230
235
  callbacks[:after][name] << block
231
236
  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
- ::GitReflow.logger.debug "Using workflow: #{workflow_path}"
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
- ::GitReflow.logger.debug "Evaluating workflow..."
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
- it { expect { subject }.to have_run_command_silently "git rev-parse --show-toplevel" }
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
- GitReflow::Workflows::Core.load_raw_workflow(workflow_content)
46
+ described_class.load_raw_workflow(workflow_content)
48
47
  end
49
48
  end
50
49
 
@@ -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.8
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: 2022-02-20 00:00:00.000000000 Z
13
+ date: 2022-03-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: appraisal