git_reflow 0.8.6 → 0.8.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +348 -348
- data/Gemfile.lock +13 -15
- data/LICENSE +20 -20
- data/README.rdoc +461 -461
- data/Rakefile +8 -8
- data/bin/console +7 -7
- data/bin/setup +6 -6
- data/circle.yml +5 -5
- data/exe/git-reflow +36 -36
- data/git_reflow.gemspec +1 -1
- data/lib/git_reflow/commands/deliver.rb +10 -10
- data/lib/git_reflow/commands/refresh.rb +20 -20
- data/lib/git_reflow/commands/review.rb +13 -13
- data/lib/git_reflow/commands/setup.rb +11 -11
- data/lib/git_reflow/commands/stage.rb +9 -9
- data/lib/git_reflow/commands/start.rb +22 -22
- data/lib/git_reflow/commands/status.rb +7 -7
- data/lib/git_reflow/config.rb +9 -9
- data/lib/git_reflow/git_server/base.rb +68 -68
- data/lib/git_reflow/git_server/bit_bucket/pull_request.rb +84 -84
- data/lib/git_reflow/git_server/bit_bucket.rb +101 -101
- data/lib/git_reflow/git_server/git_hub/pull_request.rb +4 -1
- data/lib/git_reflow/git_server/pull_request.rb +11 -2
- data/lib/git_reflow/git_server.rb +63 -63
- data/lib/git_reflow/logger.rb +49 -0
- data/lib/git_reflow/merge_error.rb +9 -9
- data/lib/git_reflow/os_detector.rb +23 -23
- data/lib/git_reflow/rspec/command_line_helpers.rb +12 -8
- data/lib/git_reflow/rspec/stub_helpers.rb +13 -13
- data/lib/git_reflow/rspec.rb +2 -2
- data/lib/git_reflow/sandbox.rb +11 -6
- data/lib/git_reflow/version.rb +1 -1
- data/lib/git_reflow/workflow.rb +59 -59
- data/lib/git_reflow/workflows/core.rb +238 -238
- data/lib/git_reflow/workflows/flat_merge.rb +10 -10
- data/lib/git_reflow.rb +11 -0
- data/spec/fixtures/awesome_workflow.rb +7 -0
- data/spec/fixtures/git/git_config +7 -0
- data/spec/fixtures/issues/comment.json.erb +27 -0
- data/spec/fixtures/issues/comments.json +29 -0
- data/spec/fixtures/issues/comments.json.erb +15 -0
- data/spec/fixtures/pull_requests/comment.json.erb +45 -0
- data/spec/fixtures/pull_requests/comments.json +47 -0
- data/spec/fixtures/pull_requests/comments.json.erb +15 -0
- data/spec/fixtures/pull_requests/commits.json +29 -0
- data/spec/fixtures/pull_requests/external_pull_request.json +145 -0
- data/spec/fixtures/pull_requests/pull_request.json +142 -0
- data/spec/fixtures/pull_requests/pull_request.json.erb +142 -0
- data/spec/fixtures/pull_requests/pull_request_exists_error.json +32 -0
- data/spec/fixtures/pull_requests/pull_requests.json +136 -0
- data/spec/fixtures/repositories/commit.json +53 -0
- data/spec/fixtures/repositories/commit.json.erb +53 -0
- data/spec/fixtures/repositories/commits.json.erb +13 -0
- data/spec/fixtures/repositories/statuses.json +31 -0
- data/spec/fixtures/workflow_with_super.rb +8 -0
- data/spec/lib/git_reflow/config_spec.rb +74 -0
- data/spec/lib/git_reflow/git_helpers_spec.rb +182 -0
- data/spec/lib/git_reflow/git_server/bit_bucket_spec.rb +81 -0
- data/spec/lib/git_reflow/git_server/git_hub/pull_request_spec.rb +587 -0
- data/spec/lib/git_reflow/git_server/git_hub_spec.rb +221 -0
- data/spec/lib/git_reflow/git_server/pull_request_spec.rb +524 -0
- data/spec/lib/git_reflow/git_server_spec.rb +101 -0
- data/spec/lib/git_reflow/logger_spec.rb +18 -0
- data/spec/lib/git_reflow/sandbox_spec.rb +15 -0
- data/spec/lib/git_reflow/workflow_spec.rb +59 -0
- data/spec/lib/git_reflow/workflows/core_spec.rb +665 -0
- data/spec/lib/git_reflow/workflows/flat_merge_spec.rb +59 -0
- data/spec/lib/git_reflow_spec.rb +75 -0
- data/spec/spec_helper.rb +38 -0
- data/spec/support/fake_github.rb +128 -0
- data/spec/support/fixtures.rb +54 -0
- data/spec/support/github_helpers.rb +109 -0
- data/spec/support/mock_pull_request.rb +17 -0
- data/spec/support/web_mocks.rb +39 -0
- metadata +83 -6
@@ -34,7 +34,7 @@ module GitReflow
|
|
34
34
|
|
35
35
|
def stub_run_for(module_to_stub)
|
36
36
|
allow(module_to_stub).to receive(:run) do |command, options|
|
37
|
-
options
|
37
|
+
options = { loud: true, blocking: true }.merge(options || {})
|
38
38
|
$commands_ran << Hashie::Mash.new(command: command, options: options)
|
39
39
|
ret_value = $stubbed_commands[command] || ""
|
40
40
|
command = "" # we need this due to a bug in rspec that will keep this assignment on subsequent runs of the stub
|
@@ -69,32 +69,36 @@ module GitReflow
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
-
RSpec::Matchers.define :have_run_command do |command|
|
72
|
+
RSpec::Matchers.define :have_run_command do |command, options|
|
73
|
+
options = { blocking: true, loud: true }.merge(options || {})
|
74
|
+
|
73
75
|
match do |block|
|
74
76
|
block.call
|
75
77
|
(
|
76
|
-
$commands_ran.include? Hashie::Mash.new(command: command, options:
|
77
|
-
$commands_ran.include? Hashie::Mash.new(command: command, options: {with_system: true})
|
78
|
+
$commands_ran.include? Hashie::Mash.new(command: command, options: options) or
|
79
|
+
$commands_ran.include? Hashie::Mash.new(command: command, options: options.merge({with_system: true}))
|
78
80
|
)
|
79
81
|
end
|
80
82
|
|
81
83
|
supports_block_expectations
|
82
84
|
|
83
85
|
failure_message do |block|
|
84
|
-
"expected to have run the command \`#{command}\` but instead ran:\n\t#{$commands_ran.inspect}"
|
86
|
+
"expected to have run the command \`#{command}\` with options \`#{options}\` but instead ran:\n\t#{$commands_ran.inspect}"
|
85
87
|
end
|
86
88
|
end
|
87
89
|
|
88
|
-
RSpec::Matchers.define :have_run_command_silently do |command|
|
90
|
+
RSpec::Matchers.define :have_run_command_silently do |command, options|
|
91
|
+
options = { blocking: true, loud: false }.merge(options || {})
|
92
|
+
|
89
93
|
match do |block|
|
90
94
|
block.call
|
91
|
-
$commands_ran.include? Hashie::Mash.new(command: command, options:
|
95
|
+
$commands_ran.include? Hashie::Mash.new(command: command, options: options)
|
92
96
|
end
|
93
97
|
|
94
98
|
supports_block_expectations
|
95
99
|
|
96
100
|
failure_message do |block|
|
97
|
-
"expected to have run the command \`#{command}\` silently but instead ran:\n\t#{$commands_ran.inspect}"
|
101
|
+
"expected to have run the command \`#{command}\` silently with options \`#{options}\` but instead ran:\n\t#{$commands_ran.inspect}"
|
98
102
|
end
|
99
103
|
end
|
100
104
|
|
@@ -1,13 +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
|
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/rspec.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
require_relative 'rspec/command_line_helpers'
|
2
|
-
require_relative 'rspec/stub_helpers'
|
1
|
+
require_relative 'rspec/command_line_helpers'
|
2
|
+
require_relative 'rspec/stub_helpers'
|
data/lib/git_reflow/sandbox.rb
CHANGED
@@ -12,16 +12,21 @@ module GitReflow
|
|
12
12
|
}
|
13
13
|
|
14
14
|
def run(command, options = {})
|
15
|
-
options = { loud: true }.merge(options)
|
15
|
+
options = { loud: true, blocking: true }.merge(options)
|
16
|
+
|
17
|
+
GitReflow.logger.debug "Running... #{command}"
|
16
18
|
|
17
19
|
if options[:with_system] == true
|
18
20
|
system(command)
|
19
|
-
elsif options[:loud] == true
|
20
|
-
output = %x{#{command}}
|
21
|
-
puts output
|
22
|
-
output
|
23
21
|
else
|
24
|
-
%x{#{command}}
|
22
|
+
output = %x{#{command}}
|
23
|
+
|
24
|
+
if options[:blocking] == true && !$?.success?
|
25
|
+
abort "\`#{command}\` failed to run."
|
26
|
+
else
|
27
|
+
puts output if options[:loud] == true
|
28
|
+
output
|
29
|
+
end
|
25
30
|
end
|
26
31
|
end
|
27
32
|
|
data/lib/git_reflow/version.rb
CHANGED
data/lib/git_reflow/workflow.rb
CHANGED
@@ -1,59 +1,59 @@
|
|
1
|
-
require 'git_reflow/sandbox'
|
2
|
-
require 'git_reflow/git_helpers'
|
3
|
-
|
4
|
-
module GitReflow
|
5
|
-
module Workflow
|
6
|
-
def self.included base
|
7
|
-
base.extend ClassMethods
|
8
|
-
end
|
9
|
-
|
10
|
-
# @nodoc
|
11
|
-
def self.current
|
12
|
-
workflow_file = GitReflow::Config.get('reflow.workflow')
|
13
|
-
if workflow_file.length > 0 and File.exists?(workflow_file)
|
14
|
-
eval(File.read(workflow_file))
|
15
|
-
else
|
16
|
-
GitReflow::Workflows::Core
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
module ClassMethods
|
21
|
-
include GitReflow::Sandbox
|
22
|
-
include GitReflow::GitHelpers
|
23
|
-
|
24
|
-
# Creates a singleton method on the inlcuded class
|
25
|
-
#
|
26
|
-
# This method will take any number of keyword parameters. If @defaults keyword is provided, and the given
|
27
|
-
# key(s) in the defaults are not provided as keyword parameters, then it will use the value given in the
|
28
|
-
# defaults for that parameter.
|
29
|
-
#
|
30
|
-
# @param name [Symbol] the name of the method to create
|
31
|
-
# @param defaults [Hash] keyword arguments to provide fallbacks for
|
32
|
-
#
|
33
|
-
# @yield [a:, b:, c:, ...] Invokes the block with an arbitrary number of keyword arguments
|
34
|
-
def command(name, **params, &block)
|
35
|
-
defaults = params[:defaults] || {}
|
36
|
-
self.define_singleton_method(name) do |**args|
|
37
|
-
args_with_defaults = {}
|
38
|
-
args.each do |name, value|
|
39
|
-
if "#{value}".length <= 0
|
40
|
-
args_with_defaults[name] = defaults[name]
|
41
|
-
else
|
42
|
-
args_with_defaults[name] = value
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
defaults.each do |name, value|
|
47
|
-
if "#{args_with_defaults[name]}".length <= 0
|
48
|
-
args_with_defaults[name] = value
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
block.call(**args_with_defaults)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
extend GitReflow::Workflow
|
1
|
+
require 'git_reflow/sandbox'
|
2
|
+
require 'git_reflow/git_helpers'
|
3
|
+
|
4
|
+
module GitReflow
|
5
|
+
module Workflow
|
6
|
+
def self.included base
|
7
|
+
base.extend ClassMethods
|
8
|
+
end
|
9
|
+
|
10
|
+
# @nodoc
|
11
|
+
def self.current
|
12
|
+
workflow_file = GitReflow::Config.get('reflow.workflow')
|
13
|
+
if workflow_file.length > 0 and File.exists?(workflow_file)
|
14
|
+
eval(File.read(workflow_file))
|
15
|
+
else
|
16
|
+
GitReflow::Workflows::Core
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
module ClassMethods
|
21
|
+
include GitReflow::Sandbox
|
22
|
+
include GitReflow::GitHelpers
|
23
|
+
|
24
|
+
# Creates a singleton method on the inlcuded class
|
25
|
+
#
|
26
|
+
# This method will take any number of keyword parameters. If @defaults keyword is provided, and the given
|
27
|
+
# key(s) in the defaults are not provided as keyword parameters, then it will use the value given in the
|
28
|
+
# defaults for that parameter.
|
29
|
+
#
|
30
|
+
# @param name [Symbol] the name of the method to create
|
31
|
+
# @param defaults [Hash] keyword arguments to provide fallbacks for
|
32
|
+
#
|
33
|
+
# @yield [a:, b:, c:, ...] Invokes the block with an arbitrary number of keyword arguments
|
34
|
+
def command(name, **params, &block)
|
35
|
+
defaults = params[:defaults] || {}
|
36
|
+
self.define_singleton_method(name) do |**args|
|
37
|
+
args_with_defaults = {}
|
38
|
+
args.each do |name, value|
|
39
|
+
if "#{value}".length <= 0
|
40
|
+
args_with_defaults[name] = defaults[name]
|
41
|
+
else
|
42
|
+
args_with_defaults[name] = value
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
defaults.each do |name, value|
|
47
|
+
if "#{args_with_defaults[name]}".length <= 0
|
48
|
+
args_with_defaults[name] = value
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
block.call(**args_with_defaults)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
extend GitReflow::Workflow
|