git_reflow 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +35 -6
- data/Gemfile.lock +8 -6
- data/circle.yml +20 -10
- data/lib/git_reflow/commands/deliver.rb +6 -2
- data/lib/git_reflow/commands/setup.rb +3 -3
- data/lib/git_reflow/config.rb +1 -1
- data/lib/git_reflow/git_helpers.rb +16 -1
- data/{spec/support → lib/git_reflow/rspec}/command_line_helpers.rb +57 -51
- data/lib/git_reflow/rspec/stub_helpers.rb +13 -0
- data/lib/git_reflow/rspec.rb +2 -0
- data/lib/git_reflow/version.rb +1 -1
- data/lib/git_reflow.rb +7 -5
- data/spec/fixtures/pull_requests/comments.json.erb +1 -1
- data/spec/fixtures/repositories/commits.json.erb +1 -1
- data/spec/lib/git_reflow/config_spec.rb +3 -3
- data/spec/lib/git_reflow/git_helpers_spec.rb +41 -0
- data/spec/{git_reflow_spec.rb → lib/git_reflow_spec.rb} +8 -0
- data/spec/spec_helper.rb +4 -3
- data/spec/support/fake_github.rb +3 -3
- metadata +7 -8
- data/spec/support/rspec_stub_helpers.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3b0fe812dbfd336ccb9e40f083419d607300978
|
4
|
+
data.tar.gz: 876d2c887f6b2a68487dcb1fa8cca1ea34e32550
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 021be79b7f91b842c1d18ddd9af022dcbde108c644ed6eb9e2a7acca2e754083d8d80b22d060003c8e63c3857b9b4ecc0ec27c9dc3ba609a281895707ca14c6c
|
7
|
+
data.tar.gz: 0c45b168febf5b66177b034ac54868c55bdcc9bbad012110eb03f7dc5e349c619922eb2cb0f30945c7c0a34a8a79e210251a6c277a53a2e4b4ab7bf3504f8b7f
|
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,45 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [v0.8.
|
3
|
+
## [v0.8.2](https://github.com/reenhanced/gitreflow/tree/v0.8.2) (2016-08-01)
|
4
4
|
|
5
|
+
[Full Changelog](https://github.com/reenhanced/gitreflow/compare/v0.8.1...v0.8.2)
|
6
|
+
|
7
|
+
**Fixed bugs:**
|
8
|
+
|
9
|
+
- git-reflow setup not working on Windows [\#187](https://github.com/reenhanced/gitreflow/issues/187)
|
10
|
+
|
11
|
+
**Closed issues:**
|
12
|
+
|
13
|
+
- GitHub authentication issues [\#193](https://github.com/reenhanced/gitreflow/issues/193)
|
14
|
+
- non-master base branch does not work for the deliver command [\#192](https://github.com/reenhanced/gitreflow/issues/192)
|
15
|
+
- git-reflow fork command [\#188](https://github.com/reenhanced/gitreflow/issues/188)
|
16
|
+
- Bitbucket setup not working [\#186](https://github.com/reenhanced/gitreflow/issues/186)
|
17
|
+
- Default approval regex not respecting :+1: [\#182](https://github.com/reenhanced/gitreflow/issues/182)
|
18
|
+
- \[SOLVED\] Unable To Install the GEM \(install nokogiri manually to solve the issue\) [\#178](https://github.com/reenhanced/gitreflow/issues/178)
|
19
|
+
- Can we switch off LGTM reviews? [\#177](https://github.com/reenhanced/gitreflow/issues/177)
|
20
|
+
- gitreflow does not cache github token? [\#173](https://github.com/reenhanced/gitreflow/issues/173)
|
21
|
+
- message below the fold in review [\#105](https://github.com/reenhanced/gitreflow/issues/105)
|
22
|
+
|
23
|
+
**Merged pull requests:**
|
24
|
+
|
25
|
+
- \[\#187\] Update git-reflow config file path to use $HOME for windows support [\#195](https://github.com/reenhanced/gitreflow/pull/195) ([codenamev](https://github.com/codenamev))
|
26
|
+
- \[192\] Allow delivery to custom base branch [\#194](https://github.com/reenhanced/gitreflow/pull/194) ([codenamev](https://github.com/codenamev))
|
27
|
+
- Refactor tests to allow for use of reflow test helpers in third-party gems [\#189](https://github.com/reenhanced/gitreflow/pull/189) ([codenamev](https://github.com/codenamev))
|
28
|
+
- \[Issue \#182\] Fix LGTM Expression [\#185](https://github.com/reenhanced/gitreflow/pull/185) ([simonzhu24](https://github.com/simonzhu24))
|
29
|
+
- Use $EDITOR as text editor fallback [\#184](https://github.com/reenhanced/gitreflow/pull/184) ([timraasveld](https://github.com/timraasveld))
|
30
|
+
- Respect GitHub pull request template [\#179](https://github.com/reenhanced/gitreflow/pull/179) ([timraasveld](https://github.com/timraasveld))
|
31
|
+
|
32
|
+
## [v0.8.1](https://github.com/reenhanced/gitreflow/tree/v0.8.1) (2016-05-26)
|
5
33
|
[Full Changelog](https://github.com/reenhanced/gitreflow/compare/v0.8.0...v0.8.1)
|
6
34
|
|
7
35
|
**Closed issues:**
|
8
36
|
|
9
|
-
-
|
37
|
+
- undefined method `git\_editor\_comand' for GitReflow:Module [\#176](https://github.com/reenhanced/gitreflow/issues/176)
|
38
|
+
- github PR ends up "closed" instead of "merged" [\#149](https://github.com/reenhanced/gitreflow/issues/149)
|
39
|
+
- Update README to mention how to update an in-progress feature branch from origin/master [\#125](https://github.com/reenhanced/gitreflow/issues/125)
|
40
|
+
- Option to silence the offer to open the PR in my browser? [\#117](https://github.com/reenhanced/gitreflow/issues/117)
|
41
|
+
- command for merging updates from base branch [\#74](https://github.com/reenhanced/gitreflow/issues/74)
|
42
|
+
- Support for non-master branch [\#73](https://github.com/reenhanced/gitreflow/issues/73)
|
10
43
|
|
11
44
|
## [v0.8.0](https://github.com/reenhanced/gitreflow/tree/v0.8.0) (2016-05-26)
|
12
45
|
[Full Changelog](https://github.com/reenhanced/gitreflow/compare/v0.7.5...v0.8.0)
|
@@ -222,10 +255,6 @@
|
|
222
255
|
## [v0.4.0](https://github.com/reenhanced/gitreflow/tree/v0.4.0) (2014-10-16)
|
223
256
|
[Full Changelog](https://github.com/reenhanced/gitreflow/compare/v0.3.5...v0.4.0)
|
224
257
|
|
225
|
-
**Closed issues:**
|
226
|
-
|
227
|
-
- f has already been specified as a switch in the command deliver \(ArgumentError\) [\#59](https://github.com/reenhanced/gitreflow/issues/59)
|
228
|
-
|
229
258
|
**Merged pull requests:**
|
230
259
|
|
231
260
|
- Make sure to create feature branch with current branch as base [\#64](https://github.com/reenhanced/gitreflow/pull/64) ([esposito](https://github.com/esposito))
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
git_reflow (0.8.
|
4
|
+
git_reflow (0.8.2)
|
5
5
|
colorize (>= 0.7.0)
|
6
6
|
github_api (= 0.14.0)
|
7
7
|
gli (= 2.14.0)
|
@@ -44,18 +44,20 @@ GEM
|
|
44
44
|
json (1.8.3)
|
45
45
|
jwt (1.5.1)
|
46
46
|
method_source (0.8.2)
|
47
|
-
mini_portile2 (2.
|
47
|
+
mini_portile2 (2.1.0)
|
48
48
|
multi_json (1.12.1)
|
49
49
|
multi_xml (0.5.5)
|
50
50
|
multipart-post (2.0.0)
|
51
|
-
nokogiri (1.6.
|
52
|
-
mini_portile2 (~> 2.
|
51
|
+
nokogiri (1.6.8)
|
52
|
+
mini_portile2 (~> 2.1.0)
|
53
|
+
pkg-config (~> 1.1.7)
|
53
54
|
oauth2 (1.1.0)
|
54
55
|
faraday (>= 0.8, < 0.10)
|
55
56
|
jwt (~> 1.0, < 1.5.2)
|
56
57
|
multi_json (~> 1.3)
|
57
58
|
multi_xml (~> 0.5)
|
58
59
|
rack (>= 1.2, < 3)
|
60
|
+
pkg-config (1.1.7)
|
59
61
|
pry (0.10.3)
|
60
62
|
coderay (~> 1.1.0)
|
61
63
|
method_source (~> 0.8.1)
|
@@ -63,7 +65,7 @@ GEM
|
|
63
65
|
pry-byebug (3.4.0)
|
64
66
|
byebug (~> 9.0)
|
65
67
|
pry (~> 0.10)
|
66
|
-
rack (
|
68
|
+
rack (2.0.1)
|
67
69
|
rake (11.1.2)
|
68
70
|
rdoc (4.2.2)
|
69
71
|
json (~> 1.4)
|
@@ -114,4 +116,4 @@ DEPENDENCIES
|
|
114
116
|
wwtd (= 1.3.0)
|
115
117
|
|
116
118
|
BUNDLED WITH
|
117
|
-
1.12.
|
119
|
+
1.12.5
|
data/circle.yml
CHANGED
@@ -1,16 +1,26 @@
|
|
1
1
|
dependencies:
|
2
|
-
|
3
|
-
- rvm
|
4
|
-
-
|
5
|
-
- rvm install 2.3.1
|
2
|
+
cache_directories:
|
3
|
+
- '~/.rvm/rubies'
|
4
|
+
- 'vendor'
|
6
5
|
|
7
6
|
override:
|
8
|
-
-
|
9
|
-
|
10
|
-
|
7
|
+
- >
|
8
|
+
case $CIRCLE_NODE_INDEX in
|
9
|
+
0)
|
10
|
+
rvm-exec 2.1.9 gem install bundler
|
11
|
+
rvm-exec 2.1.9 bash -c "bundle check --path=vendor/bundle_2.1 || bundle install --path=vendor/bundle_2.1"
|
12
|
+
;;
|
13
|
+
1)
|
14
|
+
rvm-exec 2.2.5 gem install bundler
|
15
|
+
rvm-exec 2.2.5 bash -c "bundle check --path=vendor/bundle_2.2 || bundle install --path=vendor/bundle_2.2"
|
16
|
+
;;
|
17
|
+
2)
|
18
|
+
rvm-exec ruby-head gem install bundler
|
19
|
+
rvm-exec ruby-head bash -c "bundle check --path=vendor/bundle_head || bundle install --path=vendor/bundle_head"
|
20
|
+
;;
|
21
|
+
esac
|
11
22
|
|
12
23
|
test:
|
13
24
|
override:
|
14
|
-
-
|
15
|
-
|
16
|
-
- 'rvm-exec 2.3.1 bundle exec rake'
|
25
|
+
- case $CIRCLE_NODE_INDEX in 0) rvm-exec 2.1.9 bundle exec rake ;; 1) rvm-exec 2.2.5 bundle exec rake ;; 2) rvm-exec ruby-head bundle exec rake ;; esac:
|
26
|
+
parallel: true
|
@@ -4,8 +4,12 @@ long_desc 'merge your feature branch down to your base branch, and cleanup your
|
|
4
4
|
command :deliver do |c|
|
5
5
|
c.desc 'merge your feature branch down to your base branch, and cleanup your feature branch'
|
6
6
|
c.switch [:f, :'skip-lgtm'], desc: 'skip the lgtm checks and deliver your feature branch'
|
7
|
-
c.action do |global_options,options,args|
|
8
|
-
deliver_options = {
|
7
|
+
c.action do |global_options, options, args|
|
8
|
+
deliver_options = {
|
9
|
+
base: args[0],
|
10
|
+
skip_lgtm: options[:'skip-lgtm']
|
11
|
+
}
|
12
|
+
|
9
13
|
GitReflow.deliver deliver_options
|
10
14
|
end
|
11
15
|
end
|
@@ -23,11 +23,11 @@ command :setup do |c|
|
|
23
23
|
end
|
24
24
|
|
25
25
|
GitReflow::Config.set "constants.minimumApprovals", ask("Set the minimum number of approvals (leaving blank will require approval from all commenters): "), local: reflow_options[:project_only]
|
26
|
-
GitReflow::Config.set "constants.approvalRegex", GitReflow::GitServer::PullRequest::DEFAULT_APPROVAL_REGEX
|
26
|
+
GitReflow::Config.set "constants.approvalRegex", GitReflow::GitServer::PullRequest::DEFAULT_APPROVAL_REGEX, local: reflow_options[:project_only]
|
27
27
|
|
28
28
|
if GitReflow::Config.get('core.editor').length <= 0
|
29
|
-
GitReflow::Config.set('core.editor', GitReflow
|
30
|
-
GitReflow.say "Updated git's editor (via git config key 'core.editor') to: #{GitReflow
|
29
|
+
GitReflow::Config.set('core.editor', GitReflow.default_editor, local: reflow_options[:project_only])
|
30
|
+
GitReflow.say "Updated git's editor (via git config key 'core.editor') to: #{GitReflow.default_editor}.", :notice
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
data/lib/git_reflow/config.rb
CHANGED
@@ -2,7 +2,7 @@ module GitReflow
|
|
2
2
|
module Config
|
3
3
|
extend self
|
4
4
|
|
5
|
-
CONFIG_FILE_PATH = "
|
5
|
+
CONFIG_FILE_PATH = "$HOME/.gitconfig.reflow".freeze
|
6
6
|
|
7
7
|
def get(key, reload: false, all: false, local: false)
|
8
8
|
if reload == false and cached_key_value = instance_variable_get(:"@#{key.tr('.-', '_')}")
|
@@ -10,7 +10,7 @@ module GitReflow
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def git_editor_command
|
13
|
-
|
13
|
+
GitReflow::Config.get('core.editor') || GitReflow.default_editor
|
14
14
|
end
|
15
15
|
|
16
16
|
def remote_user
|
@@ -27,6 +27,21 @@ module GitReflow
|
|
27
27
|
run("git branch --no-color | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g'", loud: false).strip
|
28
28
|
end
|
29
29
|
|
30
|
+
def pull_request_template
|
31
|
+
filenames_to_try = %w( github/PULL_REQUEST_TEMPLATE.md
|
32
|
+
github/PULL_REQUEST_TEMPLATE
|
33
|
+
PULL_REQUEST_TEMPLATE.md
|
34
|
+
PULL_REQUEST_TEMPLATE ).map do |file|
|
35
|
+
"#{git_root_dir}/#{file}"
|
36
|
+
end
|
37
|
+
|
38
|
+
filename = filenames_to_try.detect do |file|
|
39
|
+
File.exist? file
|
40
|
+
end
|
41
|
+
|
42
|
+
File.read filename if filename
|
43
|
+
end
|
44
|
+
|
30
45
|
def get_first_commit_message
|
31
46
|
run('git log --pretty=format:"%s" --no-merges -n 1', loud: false).strip
|
32
47
|
end
|
@@ -1,59 +1,65 @@
|
|
1
|
-
module
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
1
|
+
module GitReflow
|
2
|
+
module RSpec
|
3
|
+
module CommandLineHelpers
|
4
|
+
|
5
|
+
def stub_command_line
|
6
|
+
$commands_ran = []
|
7
|
+
$stubbed_commands = {}
|
8
|
+
$output = []
|
9
|
+
$says = []
|
10
|
+
|
11
|
+
stub_run_for GitReflow
|
12
|
+
stub_run_for GitReflow::Sandbox
|
13
|
+
|
14
|
+
stub_output_for(GitReflow)
|
15
|
+
stub_output_for(GitReflow::Sandbox)
|
16
|
+
|
17
|
+
allow_any_instance_of(GitReflow::GitServer::PullRequest).to receive(:printf) do |format, *output|
|
18
|
+
$output << Array(output).join(" ")
|
19
|
+
output = ''
|
20
|
+
end.and_return("")
|
21
|
+
end
|
19
22
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
def stub_output_for(object_to_stub, method_to_stub = :puts)
|
24
|
+
allow_any_instance_of(object_to_stub).to receive(method_to_stub) do |output|
|
25
|
+
$output << output
|
26
|
+
output = ''
|
27
|
+
end
|
28
|
+
end
|
26
29
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
30
|
+
def stub_run_for(module_to_stub)
|
31
|
+
allow(module_to_stub).to receive(:run) do |command, options|
|
32
|
+
options ||= {}
|
33
|
+
$commands_ran << Hashie::Mash.new(command: command, options: options)
|
34
|
+
ret_value = $stubbed_commands[command] || ""
|
35
|
+
command = "" # we need this due to a bug in rspec that will keep this assignment on subsequent runs of the stub
|
36
|
+
ret_value
|
37
|
+
end
|
38
|
+
allow(module_to_stub).to receive(:say) do |output, type|
|
39
|
+
$says << {message: output, type: type}
|
40
|
+
end
|
41
|
+
end
|
39
42
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
def reset_stubbed_command_line
|
44
|
+
$commands_ran = []
|
45
|
+
$stubbed_commands = {}
|
46
|
+
$output = []
|
47
|
+
$says = []
|
48
|
+
end
|
46
49
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
50
|
+
def stub_command(command, return_value)
|
51
|
+
$stubbed_commands[command] = return_value
|
52
|
+
allow(GitReflow::Sandbox).to receive(:run).with(command).and_return(return_value)
|
53
|
+
end
|
54
|
+
|
55
|
+
def stub_command_line_inputs(inputs)
|
56
|
+
allow_any_instance_of(HighLine).to receive(:ask) do |terminal, question|
|
57
|
+
return_value = inputs[question]
|
58
|
+
question = ""
|
59
|
+
return_value
|
60
|
+
end
|
61
|
+
end
|
51
62
|
|
52
|
-
def stub_command_line_inputs(inputs)
|
53
|
-
allow_any_instance_of(HighLine).to receive(:ask) do |terminal, question|
|
54
|
-
return_value = inputs[question]
|
55
|
-
question = ""
|
56
|
-
return_value
|
57
63
|
end
|
58
64
|
end
|
59
65
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module GitReflow
|
2
|
+
module RSpec
|
3
|
+
module StubHelpers
|
4
|
+
|
5
|
+
def stub_with_fallback(obj, method)
|
6
|
+
original_method = obj.method(method)
|
7
|
+
allow(obj).to receive(method).with(anything()) { |*args| original_method.call(*args) }
|
8
|
+
return allow(obj).to receive(method)
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/git_reflow/version.rb
CHANGED
data/lib/git_reflow.rb
CHANGED
@@ -21,7 +21,9 @@ module GitReflow
|
|
21
21
|
include GitHelpers
|
22
22
|
extend self
|
23
23
|
|
24
|
-
|
24
|
+
def default_editor
|
25
|
+
"#{ENV['EDITOR']}".freeze || "vi".freeze
|
26
|
+
end
|
25
27
|
|
26
28
|
def status(destination_branch)
|
27
29
|
pull_request = git_server.find_open_pull_request( :from => current_branch, :to => destination_branch )
|
@@ -53,7 +55,7 @@ module GitReflow
|
|
53
55
|
pull_request_msg_file = "#{GitReflow.git_root_dir}/.git/GIT_REFLOW_PR_MSG"
|
54
56
|
|
55
57
|
File.open(pull_request_msg_file, 'w') do |file|
|
56
|
-
file.write(options[:title] || GitReflow.current_branch)
|
58
|
+
file.write(options[:title] || GitReflow.pull_request_template || GitReflow.current_branch)
|
57
59
|
end
|
58
60
|
|
59
61
|
GitReflow.run("#{GitReflow.git_editor_command} #{pull_request_msg_file}", with_system: true)
|
@@ -98,10 +100,10 @@ module GitReflow
|
|
98
100
|
end
|
99
101
|
|
100
102
|
def deliver(options = {})
|
101
|
-
|
103
|
+
options[:base] ||= 'master'
|
102
104
|
|
103
105
|
begin
|
104
|
-
existing_pull_request = git_server.find_open_pull_request( :
|
106
|
+
existing_pull_request = git_server.find_open_pull_request( from: current_branch, to: options[:base] )
|
105
107
|
|
106
108
|
if existing_pull_request.nil?
|
107
109
|
say "No pull request exists for #{remote_user}:#{current_branch}\nPlease submit your branch for review first with \`git reflow review\`", :deliver_halted
|
@@ -109,7 +111,7 @@ module GitReflow
|
|
109
111
|
|
110
112
|
if existing_pull_request.good_to_merge?(force: options[:skip_lgtm])
|
111
113
|
# displays current status and prompts user for confirmation
|
112
|
-
self.status
|
114
|
+
self.status options[:base]
|
113
115
|
existing_pull_request.merge!(options)
|
114
116
|
else
|
115
117
|
say existing_pull_request.rejection_message, :deliver_halted
|
@@ -8,7 +8,7 @@
|
|
8
8
|
repo_owner: repo_owner,
|
9
9
|
repo_name: repo_name,
|
10
10
|
body: comment[:body] || 'Hammer time',
|
11
|
-
created_at: comment[:created_at] || Chronic.parse('
|
11
|
+
created_at: comment[:created_at] || Chronic.parse('October 21, 2015 07:28:00')
|
12
12
|
).to_s %>
|
13
13
|
<% end %>
|
14
14
|
<%= comments_json.join(", ") %>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
author: commit[:author],
|
7
7
|
repo_owner: repo_owner,
|
8
8
|
repo_name: repo_name,
|
9
|
-
created_at: commit[:created_at] || Chronic.parse("
|
9
|
+
created_at: commit[:created_at] || Chronic.parse("October 21, 2015 07:28:00")
|
10
10
|
).to_s %>
|
11
11
|
<% end %>
|
12
12
|
<%= commits_json.join(", ") %>
|
@@ -29,7 +29,7 @@ describe GitReflow::Config do
|
|
29
29
|
|
30
30
|
describe ".set(key)" do
|
31
31
|
subject { GitReflow::Config.set('chucknorris.roundhouse', 'to the face') }
|
32
|
-
it { expect{ subject }.to have_run_command_silently 'git config -f
|
32
|
+
it { expect{ subject }.to have_run_command_silently 'git config -f $HOME/.gitconfig.reflow --replace-all chucknorris.roundhouse "to the face"' }
|
33
33
|
|
34
34
|
context "for current project only" do
|
35
35
|
subject { GitReflow::Config.set('chucknorris.roundhouse', 'to the face', local: true) }
|
@@ -39,11 +39,11 @@ describe GitReflow::Config do
|
|
39
39
|
|
40
40
|
describe ".unset(key)" do
|
41
41
|
subject { GitReflow::Config.unset('chucknorris.roundhouse') }
|
42
|
-
it { expect{ subject }.to have_run_command_silently 'git config -f
|
42
|
+
it { expect{ subject }.to have_run_command_silently 'git config -f $HOME/.gitconfig.reflow --unset-all chucknorris.roundhouse ' }
|
43
43
|
|
44
44
|
context "for multi-value keys" do
|
45
45
|
subject { GitReflow::Config.unset('chucknorris.roundhouse', value: 'to the face') }
|
46
|
-
it { expect{ subject }.to have_run_command_silently 'git config -f
|
46
|
+
it { expect{ subject }.to have_run_command_silently 'git config -f $HOME/.gitconfig.reflow --unset-all chucknorris.roundhouse "to the face"' }
|
47
47
|
end
|
48
48
|
|
49
49
|
context "for current project only" do
|
@@ -19,6 +19,23 @@ describe GitReflow::GitHelpers do
|
|
19
19
|
it { expect{ subject }.to have_run_command_silently "git rev-parse --show-toplevel" }
|
20
20
|
end
|
21
21
|
|
22
|
+
describe '.git_editor_command' do
|
23
|
+
subject { Gitacular.git_editor_command }
|
24
|
+
before { ENV['EDITOR'] = 'vim' }
|
25
|
+
|
26
|
+
it 'defaults to GitReflow config' do
|
27
|
+
allow(GitReflow::Config).to receive(:get).with('core.editor').and_return 'nano'
|
28
|
+
|
29
|
+
expect(subject).to eq 'nano'
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'falls back to the environment variable $EDITOR' do
|
33
|
+
allow(GitReflow::Config).to receive(:get).with('core.editor').and_return nil
|
34
|
+
|
35
|
+
expect(subject).to eq 'vim'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
22
39
|
describe ".remote_user" do
|
23
40
|
subject { Gitacular.remote_user }
|
24
41
|
|
@@ -56,6 +73,30 @@ describe GitReflow::GitHelpers do
|
|
56
73
|
it { expect{ subject }.to have_run_command_silently "git branch --no-color | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g'" }
|
57
74
|
end
|
58
75
|
|
76
|
+
describe ".pull_request_template" do
|
77
|
+
subject { Gitacular.pull_request_template }
|
78
|
+
|
79
|
+
context "template file exists" do
|
80
|
+
let(:root_dir) { "/some_repo" }
|
81
|
+
let(:template_content) { "Template content" }
|
82
|
+
|
83
|
+
before do
|
84
|
+
allow(Gitacular).to receive(:git_root_dir).and_return(root_dir)
|
85
|
+
allow(File).to receive(:exist?).with("#{root_dir}/github/PULL_REQUEST_TEMPLATE.md").and_return(true)
|
86
|
+
allow(File).to receive(:read).with("#{root_dir}/github/PULL_REQUEST_TEMPLATE.md").and_return(template_content)
|
87
|
+
end
|
88
|
+
it { is_expected.to eq template_content }
|
89
|
+
end
|
90
|
+
|
91
|
+
context "template file does not exist" do
|
92
|
+
before do
|
93
|
+
allow(File).to receive(:exist?).and_return(false)
|
94
|
+
end
|
95
|
+
|
96
|
+
it { is_expected.to be_nil }
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
59
100
|
describe ".get_first_commit_message" do
|
60
101
|
subject { Gitacular.get_first_commit_message }
|
61
102
|
it { expect{ subject }.to have_run_command_silently 'git log --pretty=format:"%s" --no-merges -n 1' }
|
@@ -207,6 +207,14 @@ describe GitReflow do
|
|
207
207
|
subject
|
208
208
|
end
|
209
209
|
|
210
|
+
context "and a base branch is provided" do
|
211
|
+
let(:inputs) { { title: "new-feature", message: "message", head: "reenhanced:new-feature", base: 'live'}}
|
212
|
+
it "looks for a pull request with the custom base branch" do
|
213
|
+
expect(github).to receive(:find_open_pull_request).with(from: branch, to: inputs[:base])
|
214
|
+
subject
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
210
218
|
context "and pull request exists for the feature branch to the destination branch" do
|
211
219
|
before do
|
212
220
|
allow(github).to receive(:build_status).and_return(build_status)
|
data/spec/spec_helper.rb
CHANGED
@@ -7,14 +7,15 @@ require 'pry'
|
|
7
7
|
$LOAD_PATH << 'lib'
|
8
8
|
require 'git_reflow'
|
9
9
|
|
10
|
+
require 'git_reflow/rspec'
|
11
|
+
|
10
12
|
Dir[File.expand_path('../support/**/*.rb', __FILE__)].each {|f| require f}
|
11
13
|
|
12
14
|
RSpec.configure do |config|
|
13
|
-
config.include GithubHelpers
|
14
15
|
config.include WebMock::API
|
15
|
-
config.include CommandLineHelpers
|
16
|
+
config.include GitReflow::RSpec::CommandLineHelpers
|
16
17
|
config.include GithubHelpers
|
17
|
-
config.include
|
18
|
+
config.include GitReflow::RSpec::StubHelpers
|
18
19
|
|
19
20
|
config.expect_with :rspec do |c|
|
20
21
|
c.syntax = [:should, :expect]
|
data/spec/support/fake_github.rb
CHANGED
@@ -8,7 +8,7 @@ class FakeGitHub
|
|
8
8
|
attr_accessor :repo_owner, :repo_name
|
9
9
|
|
10
10
|
DEFAULT_COMMIT_AUTHOR = "reenhanced".freeze
|
11
|
-
DEFAULT_COMMIT_TIME = "
|
11
|
+
DEFAULT_COMMIT_TIME = "October 21, 2015 07:28:00".freeze
|
12
12
|
|
13
13
|
# EXAMPLE:
|
14
14
|
#
|
@@ -75,7 +75,7 @@ class FakeGitHub
|
|
75
75
|
comments: object_data[:comments],
|
76
76
|
pull_request_number: object_data[:number] || 1,
|
77
77
|
body: object_data[:body] || 'Hammer time',
|
78
|
-
created_at: object_data[:created_at] || Chronic.parse(
|
78
|
+
created_at: object_data[:created_at] || Chronic.parse(DEFAULT_COMMIT_TIME)).to_s,
|
79
79
|
status: 201,
|
80
80
|
headers: {content_type: "application/json; charset=utf-8"})
|
81
81
|
else
|
@@ -113,7 +113,7 @@ class FakeGitHub
|
|
113
113
|
repo_name: self.repo_name,
|
114
114
|
comments: object_data[:comments],
|
115
115
|
pull_request_number: object_data[:number] || 1,
|
116
|
-
created_at: object_data[:created_at] ||
|
116
|
+
created_at: object_data[:created_at] || Chronic.parse(DEFAULT_COMMIT_TIME)).to_s,
|
117
117
|
status: 201,
|
118
118
|
headers: {content_type: "application/json; charset=utf-8"})
|
119
119
|
end
|
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.8.
|
4
|
+
version: 0.8.2
|
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: 2016-
|
13
|
+
date: 2016-08-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: appraisal
|
@@ -264,6 +264,9 @@ files:
|
|
264
264
|
- lib/git_reflow/git_server/pull_request.rb
|
265
265
|
- lib/git_reflow/merge_error.rb
|
266
266
|
- lib/git_reflow/os_detector.rb
|
267
|
+
- lib/git_reflow/rspec.rb
|
268
|
+
- lib/git_reflow/rspec/command_line_helpers.rb
|
269
|
+
- lib/git_reflow/rspec/stub_helpers.rb
|
267
270
|
- lib/git_reflow/sandbox.rb
|
268
271
|
- lib/git_reflow/version.rb
|
269
272
|
- spec/fixtures/git/git_config
|
@@ -283,21 +286,19 @@ files:
|
|
283
286
|
- spec/fixtures/repositories/commit.json.erb
|
284
287
|
- spec/fixtures/repositories/commits.json.erb
|
285
288
|
- spec/fixtures/repositories/statuses.json
|
286
|
-
- spec/git_reflow_spec.rb
|
287
289
|
- spec/lgtm_git_reflow_spec.rb
|
288
290
|
- spec/lib/git_reflow/config_spec.rb
|
289
291
|
- spec/lib/git_reflow/git_helpers_spec.rb
|
290
292
|
- spec/lib/git_reflow/git_server_spec.rb
|
293
|
+
- spec/lib/git_reflow_spec.rb
|
291
294
|
- spec/lib/git_server/bit_bucket_spec.rb
|
292
295
|
- spec/lib/git_server/git_hub/pull_request_spec.rb
|
293
296
|
- spec/lib/git_server/git_hub_spec.rb
|
294
297
|
- spec/lib/git_server/pull_request_spec.rb
|
295
298
|
- spec/spec_helper.rb
|
296
|
-
- spec/support/command_line_helpers.rb
|
297
299
|
- spec/support/fake_github.rb
|
298
300
|
- spec/support/fixtures.rb
|
299
301
|
- spec/support/github_helpers.rb
|
300
|
-
- spec/support/rspec_stub_helpers.rb
|
301
302
|
- spec/support/web_mocks.rb
|
302
303
|
homepage: http://github.com/reenhanced/gitreflow
|
303
304
|
licenses:
|
@@ -348,19 +349,17 @@ test_files:
|
|
348
349
|
- spec/fixtures/repositories/commit.json.erb
|
349
350
|
- spec/fixtures/repositories/commits.json.erb
|
350
351
|
- spec/fixtures/repositories/statuses.json
|
351
|
-
- spec/git_reflow_spec.rb
|
352
352
|
- spec/lgtm_git_reflow_spec.rb
|
353
353
|
- spec/lib/git_reflow/config_spec.rb
|
354
354
|
- spec/lib/git_reflow/git_helpers_spec.rb
|
355
355
|
- spec/lib/git_reflow/git_server_spec.rb
|
356
|
+
- spec/lib/git_reflow_spec.rb
|
356
357
|
- spec/lib/git_server/bit_bucket_spec.rb
|
357
358
|
- spec/lib/git_server/git_hub/pull_request_spec.rb
|
358
359
|
- spec/lib/git_server/git_hub_spec.rb
|
359
360
|
- spec/lib/git_server/pull_request_spec.rb
|
360
361
|
- spec/spec_helper.rb
|
361
|
-
- spec/support/command_line_helpers.rb
|
362
362
|
- spec/support/fake_github.rb
|
363
363
|
- spec/support/fixtures.rb
|
364
364
|
- spec/support/github_helpers.rb
|
365
|
-
- spec/support/rspec_stub_helpers.rb
|
366
365
|
- spec/support/web_mocks.rb
|