git_reflow 0.9.5 → 0.9.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0e834acddb09b38d8cf8514276ffffb362686ab63e207a2ee12d86c1e0d1d9a5
4
- data.tar.gz: cb8b074c0b5a54d4dc6c5924d07c1ea0b3361f9fafa4f1f6e79ac5bd63be144d
3
+ metadata.gz: 3f15edd7ea0d9df95980438cf9e846bd6b3e07829ef05adcc63c7b548c55c623
4
+ data.tar.gz: f315bc14d8ce7873db9f3e4708da9db581bec1bff63d2302465eb356450a2196
5
5
  SHA512:
6
- metadata.gz: f1e43bfcc3e2ca7d6df9ebfcb87a52ed27088023ea0aed9554e7c49cd6c418a0a7e96f1cb2579e115265849b28fbec16bc01b531a9ffa8d19f49a1a6f062ef21
7
- data.tar.gz: 3e6cced31705172b348ec8c6a29d5ab5ab033288d61e8ef8854ee48a31094d475b128f11cb19f4f7068596dde71202c3c8c96ac96698479e1823bf4cec3dbda9
6
+ metadata.gz: bf83e0671b38cd6b3e2f1a008068ad038cee28177ead79a1646994987b0e24141aeb41b0ee191e3856f7f0032df703b66b6a08e41949e319e68ad7dbea9e0bc1
7
+ data.tar.gz: 948128297b7ba1a38476fb48a81e1f238745a04966295e8506556cf61c1efacc32a98ea8d2966af43ffaa09a536c03790b6b04f129f65bab779ddfd5e9eeb5ed
data/.rubocop.yml CHANGED
@@ -1,2 +1,9 @@
1
+ Metrics/BlockLength:
2
+ Exclude:
3
+ - "spec/**/*_spec.rb"
1
4
  Metrics/LineLength:
2
5
  Max: 120
6
+ Style/ModuleFuction:
7
+ EnforcedStyle: extend_self
8
+ Style/StringLiterals:
9
+ EnforcedStyle: double_quotes
data/CHANGELOG.md CHANGED
@@ -1,13 +1,29 @@
1
1
  # Changelog
2
2
 
3
- ## [Unreleased](https://github.com/reenhanced/gitreflow/tree/HEAD)
3
+ ## [v0.9.6](https://github.com/reenhanced/gitreflow/tree/v0.9.6) (2021-11-05)
4
4
 
5
- [Full Changelog](https://github.com/reenhanced/gitreflow/compare/v0.9.4...HEAD)
5
+ [Full Changelog](https://github.com/reenhanced/gitreflow/compare/v0.9.5...HEAD)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Use GitHub PR Templates? [\#251](https://github.com/reenhanced/gitreflow/issues/251)
10
+
11
+ **Merged pull requests:**
12
+
13
+ - Introduce configurable PR and merge commit templates [\#252](https://github.com/reenhanced/gitreflow/pull/252) ([codenamev](https://github.com/codenamev))
14
+
15
+ ## [v0.9.5](https://github.com/reenhanced/gitreflow/tree/v0.9.5) (2021-03-25)
16
+
17
+ [Full Changelog](https://github.com/reenhanced/gitreflow/compare/v0.9.4...v0.9.5)
6
18
 
7
19
  **Fixed bugs:**
8
20
 
9
21
  - Deprecation warnings with Ruby 2.7.0 [\#239](https://github.com/reenhanced/gitreflow/issues/239)
10
22
 
23
+ **Merged pull requests:**
24
+
25
+ - Support for Ruby 3.0 [\#249](https://github.com/reenhanced/gitreflow/pull/249) ([codenamev](https://github.com/codenamev))
26
+
11
27
  ## [v0.9.4](https://github.com/reenhanced/gitreflow/tree/v0.9.4) (2020-11-10)
12
28
 
13
29
  [Full Changelog](https://github.com/reenhanced/gitreflow/compare/v0.9.3...v0.9.4)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- git_reflow (0.9.5)
4
+ git_reflow (0.9.6)
5
5
  bundler (>= 1.10.0)
6
6
  codenamev_bitbucket_api (= 0.4.1)
7
7
  colorize (>= 0.8.1)
@@ -68,7 +68,7 @@ GEM
68
68
  faraday-http-cache (2.2.0)
69
69
  faraday (>= 0.8)
70
70
  faraday-net_http (1.0.1)
71
- faraday_middleware (1.0.0)
71
+ faraday_middleware (1.2.0)
72
72
  faraday (~> 1.0)
73
73
  fiber-local (1.0.0)
74
74
  github_api (0.19.0)
@@ -93,16 +93,16 @@ GEM
93
93
  httpclient (2.8.3)
94
94
  i18n (1.8.9)
95
95
  concurrent-ruby (~> 1.0)
96
- jwt (2.2.2)
96
+ jwt (2.3.0)
97
97
  method_source (1.0.0)
98
- mini_portile2 (2.5.0)
98
+ mini_portile2 (2.6.1)
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.11.2)
105
- mini_portile2 (~> 2.5.0)
104
+ nokogiri (1.12.5)
105
+ mini_portile2 (~> 2.6.1)
106
106
  racc (~> 1.4)
107
107
  oauth2 (1.4.7)
108
108
  faraday (>= 0.8, < 2.0)
@@ -124,7 +124,7 @@ GEM
124
124
  coderay (~> 1.1)
125
125
  method_source (~> 1.0)
126
126
  public_suffix (4.0.6)
127
- racc (1.5.2)
127
+ racc (1.6.0)
128
128
  rack (2.2.3)
129
129
  rainbow (3.0.0)
130
130
  rake (13.0.3)
@@ -47,23 +47,29 @@ module GitReflow
47
47
  end
48
48
 
49
49
  def pull_request_template
50
- filenames_to_try = %w[.github/PULL_REQUEST_TEMPLATE.md
51
- .github/PULL_REQUEST_TEMPLATE
52
- PULL_REQUEST_TEMPLATE.md
53
- PULL_REQUEST_TEMPLATE].map do |file|
50
+ custom_template = GitReflow::Config.get('templates.pull-request')
51
+ filenames_to_try = %w[
52
+ .github/PULL_REQUEST_TEMPLATE.md
53
+ .github/PULL_REQUEST_TEMPLATE
54
+ PULL_REQUEST_TEMPLATE.md
55
+ PULL_REQUEST_TEMPLATE
56
+ ].map do |file|
54
57
  "#{git_root_dir}/#{file}"
55
58
  end
59
+ filenames_to_try.unshift(custom_template) unless custom_template.empty?
56
60
 
57
61
  parse_first_matching_template_file(filenames_to_try)
58
62
  end
59
63
 
60
64
  def merge_commit_template
65
+ custom_template = GitReflow::Config.get('templates.merge-commit')
61
66
  filenames_to_try = %w[.github/MERGE_COMMIT_TEMPLATE.md
62
67
  .github/MERGE_COMMIT_TEMPLATE
63
68
  MERGE_COMMIT_TEMPLATE.md
64
69
  MERGE_COMMIT_TEMPLATE].map do |file|
65
70
  "#{git_root_dir}/#{file}"
66
71
  end
72
+ filenames_to_try.unshift(custom_template) unless custom_template.empty?
67
73
 
68
74
  parse_first_matching_template_file(filenames_to_try)
69
75
  end
@@ -1,3 +1,3 @@
1
1
  module GitReflow
2
- VERSION = "0.9.5"
2
+ VERSION = "0.9.6"
3
3
  end
@@ -1,15 +1,15 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
+
3
+ module Gitacular
4
+ include GitReflow::GitHelpers
5
+ extend self
6
+ end
2
7
 
3
8
  describe GitReflow::GitHelpers do
4
- let(:origin_url) { 'git@github.com:reenhanced.spectacular/this-is-the.shit.git' }
9
+ let(:origin_url) { "git@github.com:reenhanced.spectacular/this-is-the.shit.git" }
5
10
 
6
11
  before do
7
- stub_with_fallback(GitReflow::Config, :get).with('remote.origin.url').and_return(origin_url)
8
-
9
- module Gitacular
10
- include GitReflow::GitHelpers
11
- extend self
12
- end
12
+ stub_with_fallback(GitReflow::Config, :get).with("remote.origin.url").and_return(origin_url)
13
13
 
14
14
  stub_run_for Gitacular
15
15
  end
@@ -18,83 +18,86 @@ describe GitReflow::GitHelpers do
18
18
  subject { Gitacular.default_editor }
19
19
 
20
20
  context "when the environment has EDITOR set" do
21
- before { allow(ENV).to receive(:[]).with('EDITOR').and_return('emacs') }
22
- specify { expect( subject ).to eql('emacs') }
21
+ before { allow(ENV).to receive(:[]).with("EDITOR").and_return("emacs") }
22
+ specify { expect(subject).to eql("emacs") }
23
23
  end
24
24
 
25
25
  context "when the environment has no EDITOR set" do
26
- before { allow(ENV).to receive(:[]).with('EDITOR').and_return(nil) }
27
- specify { expect( subject ).to eql('vi') }
26
+ before { allow(ENV).to receive(:[]).with("EDITOR").and_return(nil) }
27
+ specify { expect(subject).to eql("vi") }
28
28
  end
29
29
  end
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
+ it { expect { subject }.to have_run_command_silently "git rev-parse --show-toplevel" }
34
34
  end
35
35
 
36
- describe '.git_editor_command' do
36
+ describe ".git_editor_command" do
37
37
  subject { Gitacular.git_editor_command }
38
- before { ENV['EDITOR'] = 'vim' }
38
+ before { ENV["EDITOR"] = "vim" }
39
39
 
40
- it 'defaults to GitReflow config' do
41
- allow(GitReflow::Config).to receive(:get).with('core.editor').and_return 'nano'
40
+ it "defaults to GitReflow config" do
41
+ allow(GitReflow::Config).to receive(:get).with("core.editor").and_return "nano"
42
42
 
43
- expect(subject).to eq 'nano'
43
+ expect(subject).to eq "nano"
44
44
  end
45
45
 
46
- it 'falls back to the environment variable $EDITOR' do
47
- allow(GitReflow::Config).to receive(:get).with('core.editor').and_return ''
46
+ it "falls back to the environment variable $EDITOR" do
47
+ allow(GitReflow::Config).to receive(:get).with("core.editor").and_return ""
48
48
 
49
- expect(subject).to eq 'vim'
49
+ expect(subject).to eq "vim"
50
50
  end
51
51
  end
52
52
 
53
53
  describe ".remote_user" do
54
54
  subject { Gitacular.remote_user }
55
55
 
56
- it { is_expected.to eq('reenhanced.spectacular') }
56
+ it { is_expected.to eq("reenhanced.spectacular") }
57
57
 
58
58
  context "remote origin url isn't set" do
59
- let(:origin_url) { '' }
60
- it { is_expected.to eq('') }
59
+ let(:origin_url) { "" }
60
+ it { is_expected.to eq("") }
61
61
  end
62
62
 
63
63
  context "remote origin uses HTTP" do
64
- let(:origin_url) { 'https://github.com/reenhanced.spectacular/this-is-the.shit.git' }
65
- it { is_expected.to eq('reenhanced.spectacular') }
64
+ let(:origin_url) { "https://github.com/reenhanced.spectacular/this-is-the.shit.git" }
65
+ it { is_expected.to eq("reenhanced.spectacular") }
66
66
  end
67
67
  end
68
68
 
69
69
  describe ".remote_repo_name" do
70
70
  subject { Gitacular.remote_repo_name }
71
71
 
72
- it { is_expected.to eq('this-is-the.shit') }
72
+ it { is_expected.to eq("this-is-the.shit") }
73
73
 
74
74
  context "remote origin url isn't set" do
75
- let(:origin_url) { '' }
76
- it { is_expected.to eq('') }
75
+ let(:origin_url) { "" }
76
+ it { is_expected.to eq("") }
77
77
  end
78
78
 
79
79
  context "remote origin uses HTTP" do
80
- let(:origin_url) { 'https://github.com/reenhanced.spectacular/this-is-the.shit.git' }
81
- it { is_expected.to eq('this-is-the.shit') }
80
+ let(:origin_url) { "https://github.com/reenhanced.spectacular/this-is-the.shit.git" }
81
+ it { is_expected.to eq("this-is-the.shit") }
82
82
  end
83
83
  end
84
84
 
85
- describe '.default_base_branch' do
85
+ describe ".default_base_branch" do
86
86
  subject { Gitacular.default_base_branch }
87
- it { is_expected.to eq('master') }
87
+ it { is_expected.to eq("master") }
88
88
 
89
- context 'when configured' do
90
- before { allow(GitReflow::Config).to receive(:get).with('reflow.base-branch').and_return('tuba') }
91
- it { is_expected.to eq('tuba') }
89
+ context "when configured" do
90
+ before { allow(GitReflow::Config).to receive(:get).with("reflow.base-branch").and_return("tuba") }
91
+ it { is_expected.to eq("tuba") }
92
92
  end
93
93
  end
94
94
 
95
95
  describe ".current_branch" do
96
96
  subject { Gitacular.current_branch }
97
- it { expect{ subject }.to have_run_command_silently "git branch --no-color | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g'" }
97
+ it {
98
+ expect { subject }
99
+ .to have_run_command_silently "git branch --no-color | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g'"
100
+ }
98
101
  end
99
102
 
100
103
  describe ".pull_request_template" do
@@ -119,36 +122,29 @@ describe GitReflow::GitHelpers do
119
122
 
120
123
  it { is_expected.to be_nil }
121
124
  end
122
- end
123
-
124
- describe ".pull_request_template" do
125
- subject { Gitacular.pull_request_template }
126
-
127
- context "template file exists" do
128
- let(:root_dir) { "/some_repo" }
129
- let(:template_content) { "Template content" }
130
125
 
126
+ context "custom template file configured" do
131
127
  before do
132
- allow(Gitacular).to receive(:git_root_dir).and_return(root_dir)
133
- allow(File).to receive(:exist?).with("#{root_dir}/.github/PULL_REQUEST_TEMPLATE.md").and_return(true)
134
- allow(File).to receive(:read).with("#{root_dir}/.github/PULL_REQUEST_TEMPLATE.md").and_return(template_content)
128
+ allow(GitReflow::Config).to receive(:get).with("templates.pull-request").and_return "pr_template_file.md"
135
129
  end
136
130
 
137
- it { is_expected.to eq template_content }
131
+ context "template file exists" do
132
+ let(:template_content) { "Template content" }
138
133
 
139
- context "when template has mustache tags" do
140
- let(:template_content) { "This is the coolest {{current_branch}}" }
141
- before { allow(GitReflow).to receive(:current_branch).and_return("tomato") }
142
- it { is_expected.to eq "This is the coolest tomato" }
134
+ before do
135
+ allow(File).to receive(:exist?).with("pr_template_file.md").and_return(true)
136
+ allow(File).to receive(:read).with("pr_template_file.md").and_return(template_content)
137
+ end
138
+ it { is_expected.to eq template_content }
143
139
  end
144
- end
145
140
 
146
- context "template file does not exist" do
147
- before do
148
- allow(File).to receive(:exist?).and_return(false)
149
- end
141
+ context "template file does not exist" do
142
+ before do
143
+ allow(File).to receive(:exist?).and_return(false)
144
+ end
150
145
 
151
- it { is_expected.to be_nil }
146
+ it { is_expected.to be_nil }
147
+ end
152
148
  end
153
149
  end
154
150
 
@@ -181,27 +177,51 @@ describe GitReflow::GitHelpers do
181
177
 
182
178
  it { is_expected.to be_nil }
183
179
  end
180
+
181
+ context "custom template file configured" do
182
+ before do
183
+ allow(GitReflow::Config).to receive(:get).with("templates.merge-commit").and_return "merge_template_file.md"
184
+ end
185
+
186
+ context "template file exists" do
187
+ let(:template_content) { "Template content" }
188
+
189
+ before do
190
+ allow(File).to receive(:exist?).with("merge_template_file.md").and_return(true)
191
+ allow(File).to receive(:read).with("merge_template_file.md").and_return(template_content)
192
+ end
193
+ it { is_expected.to eq template_content }
194
+ end
195
+
196
+ context "template file does not exist" do
197
+ before do
198
+ allow(File).to receive(:exist?).and_return(false)
199
+ end
200
+
201
+ it { is_expected.to be_nil }
202
+ end
203
+ end
184
204
  end
185
205
 
186
206
  describe ".get_first_commit_message" do
187
207
  subject { Gitacular.get_first_commit_message }
188
- it { expect{ subject }.to have_run_command_silently 'git log --pretty=format:"%s" --no-merges -n 1' }
208
+ it { expect { subject }.to have_run_command_silently 'git log --pretty=format:"%s" --no-merges -n 1' }
189
209
  end
190
210
 
191
211
  describe ".push_current_branch" do
192
212
  subject { Gitacular.push_current_branch }
193
- before { allow(Gitacular).to receive(:current_branch).and_return('bingo') }
194
- it { expect{ subject }.to have_run_command "git push origin bingo" }
213
+ before { allow(Gitacular).to receive(:current_branch).and_return("bingo") }
214
+ it { expect { subject }.to have_run_command "git push origin bingo" }
195
215
  end
196
216
 
197
217
  describe ".fetch_destination(destination_branch)" do
198
- subject { Gitacular.fetch_destination('new-feature') }
199
- it { expect{ subject }.to have_run_command "git fetch origin new-feature" }
218
+ subject { Gitacular.fetch_destination("new-feature") }
219
+ it { expect { subject }.to have_run_command "git fetch origin new-feature" }
200
220
  end
201
221
 
202
222
  describe ".update_destination(destination_branch)" do
203
- let(:current_branch) { 'bananas' }
204
- let(:destination_branch) { 'monkey-business' }
223
+ let(:current_branch) { "bananas" }
224
+ let(:destination_branch) { "monkey-business" }
205
225
 
206
226
  before { allow(Gitacular).to receive(:current_branch).and_return(current_branch) }
207
227
  subject { Gitacular.update_destination(destination_branch) }
@@ -217,7 +237,7 @@ describe GitReflow::GitHelpers do
217
237
 
218
238
  describe ".update_current_branch" do
219
239
  subject { Gitacular.update_current_branch }
220
- before { allow(Gitacular).to receive(:current_branch).and_return('new-feature') }
240
+ before { allow(Gitacular).to receive(:current_branch).and_return("new-feature") }
221
241
 
222
242
  it "updates the remote changes and pushes any local changes" do
223
243
  expect { subject }.to have_run_commands_in_order [
@@ -228,9 +248,9 @@ describe GitReflow::GitHelpers do
228
248
  end
229
249
 
230
250
  describe ".update_feature_branch" do
231
- options = {base: "base", remote: "remote"}
251
+ options = { base: "base", remote: "remote" }
232
252
  subject { Gitacular.update_feature_branch(options) }
233
- before { allow(Gitacular).to receive(:current_branch).and_return('feature') }
253
+ before { allow(Gitacular).to receive(:current_branch).and_return("feature") }
234
254
 
235
255
  it "calls the correct methods" do
236
256
  expect { subject }.to have_run_commands_in_order [
@@ -246,14 +266,14 @@ describe GitReflow::GitHelpers do
246
266
  describe ".append_to_merge_commit_message(message)" do
247
267
  let(:original_commit_message) { "Oooooo, SQUASH IT" }
248
268
  let(:message) { "do do the voodoo that you do" }
249
- let(:root_dir) { '/home/gitreflow' }
269
+ let(:root_dir) { "/home/gitreflow" }
250
270
  let(:merge_message_path) { "#{root_dir}/.git/SQUASH_MSG" }
251
271
  let(:tmp_merge_message_path) { "#{root_dir}/.git/tmp_merge_msg" }
252
272
  before { allow(Gitacular).to receive(:git_root_dir).and_return(root_dir) }
253
273
  subject { Gitacular.append_to_merge_commit_message(message) }
254
274
 
255
275
  it "appends the message to git's SQUASH_MSG temp file" do
256
- tmp_file = double('file')
276
+ tmp_file = double("file")
257
277
  allow(File).to receive(:open).with(tmp_merge_message_path, "w").and_yield(tmp_file)
258
278
  allow(File).to receive(:exists?).with(merge_message_path).and_return(true)
259
279
  allow(File).to receive(:foreach).with(merge_message_path).and_yield(original_commit_message)
@@ -269,7 +289,7 @@ describe GitReflow::GitHelpers do
269
289
  let(:merge_message_path) { "#{root_dir}/.git/MERGE_MSG" }
270
290
  subject { Gitacular.append_to_merge_commit_message(message, merge_method: "merge") }
271
291
  it "appends the message to git's MERGE_MSG temp file if using a direct merge" do
272
- tmp_file = double('file')
292
+ tmp_file = double("file")
273
293
  allow(File).to receive(:open).with(tmp_merge_message_path, "w").and_yield(tmp_file)
274
294
  allow(File).to receive(:exists?).with(merge_message_path).and_return(true)
275
295
  allow(File).to receive(:foreach).with(merge_message_path).and_yield(original_commit_message)
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.5
4
+ version: 0.9.6
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: 2021-03-25 00:00:00.000000000 Z
13
+ date: 2021-11-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: appraisal