git_reflow 0.8.10 → 0.9.4
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 +33 -0
- data/.rubocop.yml +2 -0
- data/.ruby-version +1 -1
- data/Appraisals +1 -6
- data/CHANGELOG.md +466 -348
- data/Gemfile.lock +100 -70
- data/LICENSE +20 -20
- data/README.md +36 -12
- data/Rakefile +15 -8
- data/Workflow +3 -0
- data/bin/console +7 -7
- data/bin/setup +6 -6
- data/exe/git-reflow +14 -30
- data/git_reflow.gemspec +25 -24
- data/lib/git_reflow.rb +3 -14
- data/lib/git_reflow/config.rb +52 -17
- data/lib/git_reflow/git_helpers.rb +69 -22
- data/lib/git_reflow/git_server/base.rb +68 -68
- data/lib/git_reflow/git_server/git_hub.rb +53 -40
- data/lib/git_reflow/git_server/git_hub/pull_request.rb +25 -17
- data/lib/git_reflow/git_server/pull_request.rb +19 -3
- data/lib/git_reflow/merge_error.rb +9 -9
- data/lib/git_reflow/rspec.rb +1 -0
- data/lib/git_reflow/rspec/command_line_helpers.rb +23 -6
- data/lib/git_reflow/rspec/stub_helpers.rb +13 -13
- data/lib/git_reflow/rspec/workflow_helpers.rb +18 -0
- data/lib/git_reflow/sandbox.rb +16 -6
- data/lib/git_reflow/version.rb +1 -1
- data/lib/git_reflow/workflow.rb +305 -10
- data/lib/git_reflow/workflows/FlatMergeWorkflow +38 -0
- data/lib/git_reflow/workflows/core.rb +208 -79
- data/spec/fixtures/authentication_failure.json +3 -0
- data/spec/fixtures/awesome_workflow.rb +2 -6
- data/spec/fixtures/git/git_config +7 -7
- data/spec/fixtures/issues/comment.json.erb +27 -27
- data/spec/fixtures/issues/comments.json +29 -29
- data/spec/fixtures/issues/comments.json.erb +15 -15
- data/spec/fixtures/pull_requests/comment.json.erb +45 -45
- data/spec/fixtures/pull_requests/comments.json +47 -47
- data/spec/fixtures/pull_requests/comments.json.erb +15 -15
- data/spec/fixtures/pull_requests/commits.json +29 -29
- data/spec/fixtures/pull_requests/external_pull_request.json +145 -145
- data/spec/fixtures/pull_requests/pull_request.json +142 -142
- data/spec/fixtures/pull_requests/pull_request.json.erb +142 -142
- data/spec/fixtures/pull_requests/pull_request_branch_nonexistent_error.json +32 -0
- data/spec/fixtures/pull_requests/pull_request_exists_error.json +32 -32
- data/spec/fixtures/pull_requests/pull_requests.json +136 -136
- data/spec/fixtures/repositories/commit.json +53 -53
- data/spec/fixtures/repositories/commit.json.erb +53 -53
- data/spec/fixtures/repositories/commits.json.erb +13 -13
- data/spec/fixtures/repositories/statuses.json +31 -31
- data/spec/fixtures/users/user.json +32 -0
- data/spec/lib/git_reflow/git_helpers_spec.rb +115 -12
- data/spec/lib/git_reflow/git_server/git_hub/pull_request_spec.rb +6 -6
- data/spec/lib/git_reflow/git_server/git_hub_spec.rb +77 -3
- data/spec/lib/git_reflow/git_server/pull_request_spec.rb +41 -7
- data/spec/lib/git_reflow/workflow_spec.rb +259 -14
- data/spec/lib/git_reflow/workflows/core_spec.rb +224 -65
- data/spec/lib/git_reflow/workflows/flat_merge_spec.rb +17 -6
- data/spec/lib/git_reflow_spec.rb +2 -25
- data/spec/spec_helper.rb +3 -0
- data/spec/support/github_helpers.rb +1 -1
- data/spec/support/mock_pull_request.rb +17 -17
- data/spec/support/web_mocks.rb +39 -39
- metadata +52 -53
- data/circle.yml +0 -26
- data/lib/git_reflow/commands/deliver.rb +0 -10
- data/lib/git_reflow/commands/refresh.rb +0 -20
- data/lib/git_reflow/commands/review.rb +0 -13
- data/lib/git_reflow/commands/setup.rb +0 -11
- data/lib/git_reflow/commands/stage.rb +0 -9
- data/lib/git_reflow/commands/start.rb +0 -18
- data/lib/git_reflow/commands/status.rb +0 -7
- data/lib/git_reflow/workflows/flat_merge.rb +0 -10
- data/spec/fixtures/workflow_with_super.rb +0 -8
data/git_reflow.gemspec
CHANGED
@@ -1,39 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Ensure we require the local version and not one we might have installed already
|
2
|
-
require File.join([File.dirname(__FILE__),'lib','git_reflow/version.rb'])
|
4
|
+
require File.join([File.dirname(__FILE__), 'lib', 'git_reflow/version.rb'])
|
3
5
|
Gem::Specification.new do |s|
|
4
|
-
s.name
|
5
|
-
s.version
|
6
|
-
s.license
|
7
|
-
s.authors
|
8
|
-
s.email
|
9
|
-
s.homepage
|
10
|
-
s.summary
|
11
|
-
s.description
|
12
|
-
s.platform
|
13
|
-
s.files
|
14
|
-
s.test_files
|
15
|
-
s.executables
|
16
|
-
s.
|
17
|
-
s.
|
18
|
-
s.
|
19
|
-
s.rdoc_options << '--title' << 'git_reflow' << '-ri'
|
6
|
+
s.name = 'git_reflow'
|
7
|
+
s.version = GitReflow::VERSION
|
8
|
+
s.license = 'MIT'
|
9
|
+
s.authors = ['Valentino Stoll', 'Robert Stern', 'Nicholas Hance']
|
10
|
+
s.email = ['dev@reenhanced.com']
|
11
|
+
s.homepage = 'http://github.com/reenhanced/gitreflow'
|
12
|
+
s.summary = 'A better git process'
|
13
|
+
s.description = 'Git Reflow manages your git workflow.'
|
14
|
+
s.platform = Gem::Platform::RUBY
|
15
|
+
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
|
+
s.bindir = 'exe'
|
19
|
+
s.require_paths = ['lib']
|
20
|
+
s.rdoc_options << '--title' << 'git_reflow' << '-ri'
|
20
21
|
|
21
22
|
s.add_development_dependency('appraisal', '2.2.0')
|
22
|
-
s.add_development_dependency('bundler', "~> 1.16")
|
23
23
|
s.add_development_dependency('chronic')
|
24
|
+
s.add_development_dependency('github_changelog_generator')
|
24
25
|
s.add_development_dependency('pry-byebug')
|
25
|
-
s.add_development_dependency('rake',
|
26
|
+
s.add_development_dependency('rake', '~> 13.0.1')
|
26
27
|
s.add_development_dependency('rdoc')
|
27
|
-
s.add_development_dependency('rspec',
|
28
|
+
s.add_development_dependency('rspec', '~> 3.9')
|
28
29
|
s.add_development_dependency('webmock')
|
29
|
-
s.add_development_dependency('wwtd', '1.
|
30
|
+
s.add_development_dependency('wwtd', '1.4')
|
30
31
|
|
32
|
+
s.add_dependency('bundler', '>= 1.10.0')
|
33
|
+
s.add_dependency('codenamev_bitbucket_api', '0.4.1')
|
31
34
|
s.add_dependency('colorize', '>= 0.7.0')
|
32
|
-
s.add_dependency('
|
35
|
+
s.add_dependency('github_api', '0.19')
|
33
36
|
s.add_dependency('highline')
|
34
37
|
s.add_dependency('httpclient')
|
35
|
-
s.add_dependency('github_api', '0.15.0')
|
36
|
-
s.add_dependency('reenhanced_bitbucket_api', '0.3.2')
|
37
38
|
|
38
39
|
s.post_install_message = "You need to setup your GitHub OAuth token\nPlease run 'git-reflow setup'"
|
39
40
|
end
|
data/lib/git_reflow.rb
CHANGED
@@ -6,13 +6,6 @@ require 'httpclient'
|
|
6
6
|
require 'json'
|
7
7
|
require 'colorize'
|
8
8
|
|
9
|
-
# XXX: work around logger spam from hashie (required by github api)
|
10
|
-
# https://github.com/intridea/hashie/issues/394
|
11
|
-
require "hashie"
|
12
|
-
require "hashie/logger"
|
13
|
-
Hashie.logger = Logger.new(nil)
|
14
|
-
|
15
|
-
|
16
9
|
require 'github_api'
|
17
10
|
require 'git_reflow/version.rb' unless defined?(GitReflow::VERSION)
|
18
11
|
require 'git_reflow/config'
|
@@ -46,20 +39,16 @@ module GitReflow
|
|
46
39
|
Workflow.current
|
47
40
|
end
|
48
41
|
|
49
|
-
def default_editor
|
50
|
-
"#{ENV['EDITOR'] || 'vi'}".freeze
|
51
|
-
end
|
52
|
-
|
53
42
|
def git_server
|
54
43
|
@git_server ||= GitServer.connect provider: GitReflow::Config.get('reflow.git-server').strip, silent: true
|
55
44
|
end
|
56
45
|
|
57
|
-
def
|
58
|
-
(workflow
|
46
|
+
def respond_to_missing?(method_sym, include_all = false)
|
47
|
+
(workflow && workflow.respond_to?(method_sym, include_all)) || super(method_sym, include_all)
|
59
48
|
end
|
60
49
|
|
61
50
|
def method_missing(method_sym, *arguments, &block)
|
62
|
-
if workflow
|
51
|
+
if workflow && workflow.respond_to?(method_sym, false)
|
63
52
|
workflow.send method_sym, *arguments, &block
|
64
53
|
else
|
65
54
|
super
|
data/lib/git_reflow/config.rb
CHANGED
@@ -1,25 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module GitReflow
|
4
|
+
# This is a utility module for getting and setting git-config variables.
|
2
5
|
module Config
|
3
|
-
|
6
|
+
CONFIG_FILE_PATH = "#{ENV['HOME']}/.gitconfig.reflow"
|
7
|
+
|
8
|
+
module_function
|
4
9
|
|
5
|
-
|
10
|
+
# Gets the reqested git configuration variable.
|
11
|
+
#
|
12
|
+
# @param [String] key The key to get the value(s) for
|
13
|
+
# @option options [Boolean] :reload (false) whether to reload the value or use a cached value if available
|
14
|
+
# @option options [Boolean] :all (false) whether to return all keys for a multi-valued key
|
15
|
+
# @option options [Boolean] :local (false) whether to get the value specific to the current project
|
16
|
+
# @return the value of the git configuration
|
17
|
+
def get(key, reload: false, all: false, local: false, **_other_options)
|
18
|
+
return cached_git_config_value(key) unless reload || cached_git_config_value(key).empty?
|
6
19
|
|
7
|
-
|
8
|
-
if
|
9
|
-
|
20
|
+
local = local ? '--local ' : ''
|
21
|
+
if all
|
22
|
+
new_value = GitReflow::Sandbox.run("git config #{local}--get-all #{key}", loud: false, blocking: false)
|
10
23
|
else
|
11
|
-
|
12
|
-
if all
|
13
|
-
new_value = GitReflow::Sandbox.run("git config #{local}--get-all #{key}", loud: false, blocking: false)
|
14
|
-
else
|
15
|
-
new_value = GitReflow::Sandbox.run("git config #{local}--get #{key}", loud: false, blocking: false)
|
16
|
-
end
|
17
|
-
instance_variable_set(:"@#{key.tr('.-', '_')}", new_value.strip)
|
24
|
+
new_value = GitReflow::Sandbox.run("git config #{local}--get #{key}", loud: false, blocking: false)
|
18
25
|
end
|
26
|
+
cache_git_config_key(key, new_value)
|
19
27
|
end
|
20
28
|
|
21
|
-
|
22
|
-
|
29
|
+
# Sets the reqested git configuration variable.
|
30
|
+
#
|
31
|
+
# @param [String] key The key to set the value for
|
32
|
+
# @param [String] value The value to set it to
|
33
|
+
# @option options [Boolean] :local (false) whether to set the value specific to the current project
|
34
|
+
# @return the value of the git configuration
|
35
|
+
def set(key, value, local: false, **_other_options)
|
36
|
+
value = value.to_s.strip
|
23
37
|
if local
|
24
38
|
GitReflow::Sandbox.run "git config --replace-all #{key} \"#{value}\"", loud: false, blocking: false
|
25
39
|
else
|
@@ -27,8 +41,14 @@ module GitReflow
|
|
27
41
|
end
|
28
42
|
end
|
29
43
|
|
30
|
-
|
31
|
-
|
44
|
+
# Remove values of the reqested git configuration variable.
|
45
|
+
#
|
46
|
+
# @param [String] key The key to remove
|
47
|
+
# @option options [Boolean] :value (nil) The value of the key to remove
|
48
|
+
# @option options [Boolean] :local (false) whether to remove the value specific to the current project
|
49
|
+
# @return the result of running the git command
|
50
|
+
def unset(key, value: nil, local: false, **_other_options)
|
51
|
+
value = value.nil? ? '' : "\"#{value}\""
|
32
52
|
if local
|
33
53
|
GitReflow::Sandbox.run "git config --unset-all #{key} #{value}", loud: false, blocking: false
|
34
54
|
else
|
@@ -36,7 +56,14 @@ module GitReflow
|
|
36
56
|
end
|
37
57
|
end
|
38
58
|
|
39
|
-
|
59
|
+
# Adds a new git configuration variable.
|
60
|
+
#
|
61
|
+
# @param [String] key The new key to set the value for
|
62
|
+
# @param [String] value The value to set it to
|
63
|
+
# @option options [Boolean] :local (false) whether to set the value specific to the current project
|
64
|
+
# @option options [Boolean] :global (false) whether to set the value globaly. if neither local or global is set gitreflow will default to using a configuration file
|
65
|
+
# @return the result of running the git command
|
66
|
+
def add(key, value, local: false, global: false, **_other_options)
|
40
67
|
if global
|
41
68
|
GitReflow::Sandbox.run "git config --global --add #{key} \"#{value}\"", loud: false, blocking: false
|
42
69
|
elsif local
|
@@ -45,5 +72,13 @@ module GitReflow
|
|
45
72
|
GitReflow::Sandbox.run "git config -f #{CONFIG_FILE_PATH} --add #{key} \"#{value}\"", loud: false, blocking: false
|
46
73
|
end
|
47
74
|
end
|
75
|
+
|
76
|
+
def cached_git_config_value(key)
|
77
|
+
instance_variable_get(:"@#{key.tr('.-', '_')}").to_s
|
78
|
+
end
|
79
|
+
|
80
|
+
def cache_git_config_key(key, value)
|
81
|
+
instance_variable_set(:"@#{key.tr('.-', '_')}", value.to_s.strip)
|
82
|
+
end
|
48
83
|
end
|
49
84
|
end
|
@@ -1,51 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'git_reflow/config'
|
2
4
|
require 'git_reflow/sandbox'
|
3
5
|
|
4
6
|
module GitReflow
|
7
|
+
# Includes many helper methods for common tasks within a git repository.
|
5
8
|
module GitHelpers
|
6
9
|
include Sandbox
|
7
10
|
|
11
|
+
def default_editor
|
12
|
+
ENV['EDITOR'] || 'vi'
|
13
|
+
end
|
14
|
+
|
8
15
|
def git_root_dir
|
9
|
-
return @git_root_dir
|
16
|
+
return @git_root_dir unless @git_root_dir.to_s.empty?
|
10
17
|
@git_root_dir = run('git rev-parse --show-toplevel', loud: false).strip
|
11
18
|
end
|
12
19
|
|
13
20
|
def git_editor_command
|
14
|
-
git_editor =
|
15
|
-
if git_editor.
|
21
|
+
git_editor = GitReflow::Config.get('core.editor')
|
22
|
+
if !git_editor.empty?
|
16
23
|
git_editor
|
17
24
|
else
|
18
|
-
|
25
|
+
default_editor
|
19
26
|
end
|
20
27
|
end
|
21
28
|
|
22
29
|
def remote_user
|
23
|
-
return
|
30
|
+
return '' if GitReflow::Config.get('remote.origin.url').empty?
|
24
31
|
extract_remote_user_and_repo_from_remote_url(GitReflow::Config.get('remote.origin.url'))[:user]
|
25
32
|
end
|
26
33
|
|
27
34
|
def remote_repo_name
|
28
|
-
return
|
35
|
+
return '' if GitReflow::Config.get('remote.origin.url').empty?
|
29
36
|
extract_remote_user_and_repo_from_remote_url(GitReflow::Config.get('remote.origin.url'))[:repo]
|
30
37
|
end
|
31
38
|
|
39
|
+
def default_base_branch
|
40
|
+
base_branch_name = GitReflow::Config.get('reflow.base-branch')
|
41
|
+
return 'master' if base_branch_name.empty?
|
42
|
+
base_branch_name
|
43
|
+
end
|
44
|
+
|
32
45
|
def current_branch
|
33
46
|
run("git branch --no-color | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g'", loud: false).strip
|
34
47
|
end
|
35
48
|
|
36
49
|
def pull_request_template
|
37
|
-
filenames_to_try = %w
|
38
|
-
|
39
|
-
|
40
|
-
|
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|
|
41
54
|
"#{git_root_dir}/#{file}"
|
42
55
|
end
|
43
56
|
|
44
|
-
|
45
|
-
|
57
|
+
parse_first_matching_template_file(filenames_to_try)
|
58
|
+
end
|
59
|
+
|
60
|
+
def merge_commit_template
|
61
|
+
filenames_to_try = %w[.github/MERGE_COMMIT_TEMPLATE.md
|
62
|
+
.github/MERGE_COMMIT_TEMPLATE
|
63
|
+
MERGE_COMMIT_TEMPLATE.md
|
64
|
+
MERGE_COMMIT_TEMPLATE].map do |file|
|
65
|
+
"#{git_root_dir}/#{file}"
|
46
66
|
end
|
47
67
|
|
48
|
-
|
68
|
+
parse_first_matching_template_file(filenames_to_try)
|
49
69
|
end
|
50
70
|
|
51
71
|
def get_first_commit_message
|
@@ -53,12 +73,12 @@ module GitReflow
|
|
53
73
|
end
|
54
74
|
|
55
75
|
def push_current_branch(options = {})
|
56
|
-
remote = options[:remote] ||
|
76
|
+
remote = options[:remote] || 'origin'
|
57
77
|
run_command_with_label "git push #{remote} #{current_branch}"
|
58
78
|
end
|
59
79
|
|
60
80
|
def update_current_branch(options = {})
|
61
|
-
remote = options[:remote] ||
|
81
|
+
remote = options[:remote] || 'origin'
|
62
82
|
run_command_with_label "git pull #{remote} #{current_branch}"
|
63
83
|
push_current_branch(options)
|
64
84
|
end
|
@@ -86,23 +106,50 @@ module GitReflow
|
|
86
106
|
run_command_with_label "git merge #{base_branch}"
|
87
107
|
end
|
88
108
|
|
89
|
-
def
|
90
|
-
|
91
|
-
|
92
|
-
|
109
|
+
def append_to_merge_commit_message(message = '', merge_method: "squash")
|
110
|
+
tmp_merge_message_path = "#{git_root_dir}/.git/tmp_merge_msg"
|
111
|
+
dest_merge_message_path = merge_message_path(merge_method: merge_method)
|
112
|
+
|
113
|
+
run "touch #{tmp_merge_message_path}"
|
114
|
+
|
115
|
+
File.open(tmp_merge_message_path, "w") do |file_content|
|
93
116
|
file_content.puts message
|
94
|
-
if File.exists?
|
95
|
-
File.foreach(
|
117
|
+
if File.exists? dest_merge_message_path
|
118
|
+
File.foreach(dest_merge_message_path) do |line|
|
96
119
|
file_content.puts line
|
97
120
|
end
|
98
121
|
end
|
99
122
|
end
|
100
123
|
|
101
|
-
run "mv #{
|
124
|
+
run "mv #{tmp_merge_message_path} #{dest_merge_message_path}"
|
125
|
+
end
|
126
|
+
|
127
|
+
def merge_message_path(merge_method: nil)
|
128
|
+
merge_method = merge_method || GitReflow::Config.get("reflow.merge-method")
|
129
|
+
merge_method = "squash" if "#{merge_method}".length < 1
|
130
|
+
if merge_method =~ /squash/i
|
131
|
+
"#{git_root_dir}/.git/SQUASH_MSG"
|
132
|
+
else
|
133
|
+
"#{git_root_dir}/.git/MERGE_MSG"
|
134
|
+
end
|
102
135
|
end
|
103
136
|
|
104
137
|
private
|
105
138
|
|
139
|
+
def parse_first_matching_template_file(template_file_names)
|
140
|
+
filename = template_file_names.detect do |file|
|
141
|
+
File.exist? file
|
142
|
+
end
|
143
|
+
|
144
|
+
# Thanks to @Shalmezad for contribuiting the template `gsub` snippet :-)
|
145
|
+
# https://github.com/reenhanced/gitreflow/issues/51#issuecomment-253535093
|
146
|
+
if filename
|
147
|
+
template_content = File.read filename
|
148
|
+
template_content.gsub!(/\{\{([a-zA-Z_]+[a-zA-Z0-9_]*)\}\}/) { GitReflow.public_send($1) }
|
149
|
+
template_content
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
106
153
|
def extract_remote_user_and_repo_from_remote_url(remote_url)
|
107
154
|
result = { user: '', repo: '' }
|
108
155
|
return result unless "#{remote_url}".length > 0
|
@@ -1,68 +1,68 @@
|
|
1
|
-
require 'git_reflow/config'
|
2
|
-
|
3
|
-
module GitReflow
|
4
|
-
class GitServer::Base
|
5
|
-
extend GitHelpers
|
6
|
-
|
7
|
-
@@connection = nil
|
8
|
-
|
9
|
-
def initialize(options)
|
10
|
-
site_url = self.class.site_url
|
11
|
-
api_endpoint = self.class.api_endpoint
|
12
|
-
|
13
|
-
self.class.site_url = site_url
|
14
|
-
self.class.api_endpoint = api_endpoint
|
15
|
-
|
16
|
-
authenticate
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.connection
|
20
|
-
raise "#{self.class.to_s}.connection method must be implemented"
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.user
|
24
|
-
raise "#{self.class.to_s}.user method must be implemented"
|
25
|
-
end
|
26
|
-
|
27
|
-
def self.api_endpoint
|
28
|
-
raise "#{self.class.to_s}.api_endpoint method must be implemented"
|
29
|
-
end
|
30
|
-
|
31
|
-
def self.api_endpoint=(api_endpoint, options = {local: false})
|
32
|
-
raise "#{self.class.to_s}.api_endpoint= method must be implemented"
|
33
|
-
end
|
34
|
-
|
35
|
-
def self.site_url
|
36
|
-
raise "#{self.class.to_s}.site_url method must be implemented"
|
37
|
-
end
|
38
|
-
|
39
|
-
def self.site_url=(site_url, options = {local: false})
|
40
|
-
raise "#{self.class.to_s}.site_url= method must be implemented"
|
41
|
-
end
|
42
|
-
|
43
|
-
def self.project_only?
|
44
|
-
GitReflow::Config.get("reflow.local-projects", all: true).include? "#{remote_user}/#{remote_repo_name}"
|
45
|
-
end
|
46
|
-
|
47
|
-
def connection
|
48
|
-
@connection ||= self.class.connection
|
49
|
-
end
|
50
|
-
|
51
|
-
def authenticate
|
52
|
-
raise "#{self.class.to_s}#authenticate method must be implemented"
|
53
|
-
end
|
54
|
-
|
55
|
-
def find_open_pull_request(options)
|
56
|
-
raise "#{self.class.to_s}#find_open_pull_request(options) method must be implemented"
|
57
|
-
end
|
58
|
-
|
59
|
-
def get_build_status sha
|
60
|
-
raise "#{self.class.to_s}#get_build_status(sha) method must be implemented"
|
61
|
-
end
|
62
|
-
|
63
|
-
def colorized_build_description status
|
64
|
-
raise "#{self.class.to_s}#colorized_build_description(status) method must be implemented"
|
65
|
-
end
|
66
|
-
|
67
|
-
end
|
68
|
-
end
|
1
|
+
require 'git_reflow/config'
|
2
|
+
|
3
|
+
module GitReflow
|
4
|
+
class GitServer::Base
|
5
|
+
extend GitHelpers
|
6
|
+
|
7
|
+
@@connection = nil
|
8
|
+
|
9
|
+
def initialize(options)
|
10
|
+
site_url = self.class.site_url
|
11
|
+
api_endpoint = self.class.api_endpoint
|
12
|
+
|
13
|
+
self.class.site_url = site_url
|
14
|
+
self.class.api_endpoint = api_endpoint
|
15
|
+
|
16
|
+
authenticate
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.connection
|
20
|
+
raise "#{self.class.to_s}.connection method must be implemented"
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.user
|
24
|
+
raise "#{self.class.to_s}.user method must be implemented"
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.api_endpoint
|
28
|
+
raise "#{self.class.to_s}.api_endpoint method must be implemented"
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.api_endpoint=(api_endpoint, options = {local: false})
|
32
|
+
raise "#{self.class.to_s}.api_endpoint= method must be implemented"
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.site_url
|
36
|
+
raise "#{self.class.to_s}.site_url method must be implemented"
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.site_url=(site_url, options = {local: false})
|
40
|
+
raise "#{self.class.to_s}.site_url= method must be implemented"
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.project_only?
|
44
|
+
GitReflow::Config.get("reflow.local-projects", all: true).include? "#{remote_user}/#{remote_repo_name}"
|
45
|
+
end
|
46
|
+
|
47
|
+
def connection
|
48
|
+
@connection ||= self.class.connection
|
49
|
+
end
|
50
|
+
|
51
|
+
def authenticate
|
52
|
+
raise "#{self.class.to_s}#authenticate method must be implemented"
|
53
|
+
end
|
54
|
+
|
55
|
+
def find_open_pull_request(options)
|
56
|
+
raise "#{self.class.to_s}#find_open_pull_request(options) method must be implemented"
|
57
|
+
end
|
58
|
+
|
59
|
+
def get_build_status sha
|
60
|
+
raise "#{self.class.to_s}#get_build_status(sha) method must be implemented"
|
61
|
+
end
|
62
|
+
|
63
|
+
def colorized_build_description status
|
64
|
+
raise "#{self.class.to_s}#colorized_build_description(status) method must be implemented"
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|