git_reflow 0.8.9 → 0.9.3
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 +5 -5
- data/.github/workflows/multi-ruby-tests.yml +33 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +2 -0
- data/.ruby-version +1 -0
- data/Appraisals +1 -6
- data/CHANGELOG.md +466 -348
- data/Gemfile.lock +99 -72
- data/LICENSE +20 -20
- data/README.md +481 -0
- data/Rakefile +15 -8
- data/Workflow +3 -0
- data/_config.yml +1 -0
- data/bin/console +7 -7
- data/bin/setup +6 -6
- data/exe/git-reflow +20 -36
- data/git_reflow.gemspec +26 -30
- data/lib/git_reflow.rb +3 -15
- data/lib/git_reflow/config.rb +48 -13
- data/lib/git_reflow/git_helpers.rb +69 -22
- data/lib/git_reflow/git_server.rb +63 -63
- data/lib/git_reflow/git_server/base.rb +68 -68
- data/lib/git_reflow/git_server/bit_bucket.rb +101 -101
- data/lib/git_reflow/git_server/bit_bucket/pull_request.rb +84 -84
- data/lib/git_reflow/git_server/git_hub.rb +53 -41
- data/lib/git_reflow/git_server/git_hub/pull_request.rb +16 -14
- data/lib/git_reflow/git_server/pull_request.rb +4 -2
- data/lib/git_reflow/merge_error.rb +9 -9
- data/lib/git_reflow/rspec.rb +3 -2
- 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 +304 -9
- data/lib/git_reflow/workflows/FlatMergeWorkflow +38 -0
- data/lib/git_reflow/workflows/core.rb +364 -238
- data/spec/fixtures/authentication_failure.json +3 -0
- data/spec/fixtures/awesome_workflow.rb +3 -7
- 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/bit_bucket_spec.rb +81 -81
- data/spec/lib/git_reflow/git_server/git_hub/pull_request_spec.rb +10 -10
- data/spec/lib/git_reflow/git_server/git_hub_spec.rb +77 -3
- data/spec/lib/git_reflow/git_server/pull_request_spec.rb +9 -3
- data/spec/lib/git_reflow/git_server_spec.rb +101 -101
- data/spec/lib/git_reflow/sandbox_spec.rb +1 -1
- data/spec/lib/git_reflow/workflow_spec.rb +304 -59
- data/spec/lib/git_reflow/workflows/core_spec.rb +225 -67
- data/spec/lib/git_reflow/workflows/flat_merge_spec.rb +71 -59
- data/spec/lib/git_reflow_spec.rb +2 -25
- data/spec/spec_helper.rb +3 -0
- data/spec/support/fixtures.rb +54 -54
- data/spec/support/github_helpers.rb +99 -109
- data/spec/support/mock_pull_request.rb +17 -17
- data/spec/support/web_mocks.rb +39 -39
- metadata +51 -74
- data/README.rdoc +0 -461
- 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/os_detector.rb +0 -23
- data/lib/git_reflow/workflows/flat_merge.rb +0 -10
- data/spec/fixtures/workflow_with_super.rb +0 -8
@@ -1,63 +1,63 @@
|
|
1
|
-
module GitReflow
|
2
|
-
module GitServer
|
3
|
-
autoload :Base, 'git_reflow/git_server/base'
|
4
|
-
autoload :GitHub, 'git_reflow/git_server/git_hub'
|
5
|
-
autoload :PullRequest, 'git_reflow/git_server/pull_request'
|
6
|
-
|
7
|
-
extend self
|
8
|
-
|
9
|
-
class ConnectionError < StandardError; end
|
10
|
-
|
11
|
-
def connect(options = {})
|
12
|
-
options ||= {}
|
13
|
-
options[:provider] = 'GitHub' if "#{options[:provider]}".length <= 0
|
14
|
-
begin
|
15
|
-
provider_name = options[:provider]
|
16
|
-
provider = provider_class_for(options.delete(:provider)).new(options)
|
17
|
-
provider.authenticate(options.keep_if {|key, value| key == :silent })
|
18
|
-
provider
|
19
|
-
rescue ConnectionError => e
|
20
|
-
GitReflow.say "Error connecting to #{provider_name}: #{e.message}", :error
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def connection
|
25
|
-
return nil unless current_provider
|
26
|
-
current_provider.connection
|
27
|
-
end
|
28
|
-
|
29
|
-
def current_provider
|
30
|
-
provider = "#{GitReflow::Config.get('reflow.git-server', local: true) || GitReflow::Config.get('reflow.git-server')}"
|
31
|
-
if provider.length > 0
|
32
|
-
begin
|
33
|
-
provider_class_for(provider)
|
34
|
-
rescue ConnectionError => e
|
35
|
-
GitReflow.say e.message, :error
|
36
|
-
nil
|
37
|
-
end
|
38
|
-
else
|
39
|
-
GitReflow.say "Reflow hasn't been setup yet. Run 'git reflow setup' to continue", :notice
|
40
|
-
nil
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def can_connect_to?(provider)
|
45
|
-
GitReflow::GitServer.const_defined?(provider)
|
46
|
-
end
|
47
|
-
|
48
|
-
def create_pull_request(options = {})
|
49
|
-
raise "#{self.class.to_s}#create_pull_request method must be implemented"
|
50
|
-
end
|
51
|
-
|
52
|
-
def find_open_pull_request(options = {})
|
53
|
-
raise "#{self.class.to_s}#find_open_pull_request method must be implemented"
|
54
|
-
end
|
55
|
-
|
56
|
-
private
|
57
|
-
|
58
|
-
def provider_class_for(provider)
|
59
|
-
raise ConnectionError, "GitServer not setup for \"#{provider}\"" unless self.can_connect_to?(provider)
|
60
|
-
GitReflow::GitServer.const_get(provider)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
1
|
+
module GitReflow
|
2
|
+
module GitServer
|
3
|
+
autoload :Base, 'git_reflow/git_server/base'
|
4
|
+
autoload :GitHub, 'git_reflow/git_server/git_hub'
|
5
|
+
autoload :PullRequest, 'git_reflow/git_server/pull_request'
|
6
|
+
|
7
|
+
extend self
|
8
|
+
|
9
|
+
class ConnectionError < StandardError; end
|
10
|
+
|
11
|
+
def connect(options = {})
|
12
|
+
options ||= {}
|
13
|
+
options[:provider] = 'GitHub' if "#{options[:provider]}".length <= 0
|
14
|
+
begin
|
15
|
+
provider_name = options[:provider]
|
16
|
+
provider = provider_class_for(options.delete(:provider)).new(options)
|
17
|
+
provider.authenticate(options.keep_if {|key, value| key == :silent })
|
18
|
+
provider
|
19
|
+
rescue ConnectionError => e
|
20
|
+
GitReflow.say "Error connecting to #{provider_name}: #{e.message}", :error
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def connection
|
25
|
+
return nil unless current_provider
|
26
|
+
current_provider.connection
|
27
|
+
end
|
28
|
+
|
29
|
+
def current_provider
|
30
|
+
provider = "#{GitReflow::Config.get('reflow.git-server', local: true) || GitReflow::Config.get('reflow.git-server')}"
|
31
|
+
if provider.length > 0
|
32
|
+
begin
|
33
|
+
provider_class_for(provider)
|
34
|
+
rescue ConnectionError => e
|
35
|
+
GitReflow.say e.message, :error
|
36
|
+
nil
|
37
|
+
end
|
38
|
+
else
|
39
|
+
GitReflow.say "Reflow hasn't been setup yet. Run 'git reflow setup' to continue", :notice
|
40
|
+
nil
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def can_connect_to?(provider)
|
45
|
+
GitReflow::GitServer.const_defined?(provider)
|
46
|
+
end
|
47
|
+
|
48
|
+
def create_pull_request(options = {})
|
49
|
+
raise "#{self.class.to_s}#create_pull_request method must be implemented"
|
50
|
+
end
|
51
|
+
|
52
|
+
def find_open_pull_request(options = {})
|
53
|
+
raise "#{self.class.to_s}#find_open_pull_request method must be implemented"
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def provider_class_for(provider)
|
59
|
+
raise ConnectionError, "GitServer not setup for \"#{provider}\"" unless self.can_connect_to?(provider)
|
60
|
+
GitReflow::GitServer.const_get(provider)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -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
|
@@ -1,101 +1,101 @@
|
|
1
|
-
require 'bitbucket_rest_api'
|
2
|
-
require 'git_reflow/git_helpers'
|
3
|
-
|
4
|
-
module GitReflow
|
5
|
-
module GitServer
|
6
|
-
class BitBucket < Base
|
7
|
-
require_relative 'bit_bucket/pull_request'
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
def initialize(config_options = {})
|
12
|
-
project_only = !!config_options.delete(:project_only)
|
13
|
-
|
14
|
-
# We remove any existing setup first, then setup our required config settings
|
15
|
-
GitReflow::Config.unset('reflow.local-projects', value: "#{self.class.remote_user}/#{self.class.remote_repo_name}")
|
16
|
-
GitReflow::Config.add('reflow.local-projects', "#{self.class.remote_user}/#{self.class.remote_repo_name}") if project_only
|
17
|
-
GitReflow::Config.set('reflow.git-server', 'BitBucket', local: project_only)
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.connection
|
21
|
-
if api_key_setup?
|
22
|
-
@connection ||= ::BitBucket.new login: remote_user, password: api_key
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.api_endpoint
|
27
|
-
endpoint = GitReflow::Config.get("bitbucket.endpoint", local: project_only?)
|
28
|
-
(endpoint.length > 0) ? endpoint : ::BitBucket::Configuration::DEFAULT_ENDPOINT
|
29
|
-
end
|
30
|
-
|
31
|
-
def self.site_url
|
32
|
-
site_url = GitReflow::Config.get("bitbucket.site", local: project_only?)
|
33
|
-
(site_url.length > 0) ? site_url : 'https://bitbucket.org'
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.api_key
|
37
|
-
GitReflow::Config.get("bitbucket.api-key", reload: true, local: project_only?)
|
38
|
-
end
|
39
|
-
|
40
|
-
def self.api_key=(key)
|
41
|
-
GitReflow::Config.set("bitbucket.api-key", key, local: project_only?)
|
42
|
-
end
|
43
|
-
def self.api_key_setup?
|
44
|
-
(self.api_key.length > 0)
|
45
|
-
end
|
46
|
-
|
47
|
-
def self.user
|
48
|
-
GitReflow::Config.get('bitbucket.user', local: project_only?)
|
49
|
-
end
|
50
|
-
|
51
|
-
def self.user=(bitbucket_user)
|
52
|
-
GitReflow::Config.set('bitbucket.user', bitbucket_user, local: project_only?)
|
53
|
-
end
|
54
|
-
|
55
|
-
def authenticate(options = {silent: false})
|
56
|
-
begin
|
57
|
-
if connection and self.class.api_key_setup?
|
58
|
-
unless options[:silent]
|
59
|
-
GitReflow.say "\nYour BitBucket account was already setup with:"
|
60
|
-
GitReflow.say "\tUser Name: #{self.class.user}"
|
61
|
-
end
|
62
|
-
else
|
63
|
-
self.class.user = options[:user] || ask("Please enter your BitBucket username: ")
|
64
|
-
GitReflow.say "\nIn order to connect your BitBucket account,"
|
65
|
-
GitReflow.say "you'll need to generate an API key for your team"
|
66
|
-
GitReflow.say "Visit #{self.class.site_url}/account/user/#{self.class.remote_user}/api-key/, to generate it\n"
|
67
|
-
self.class.api_key = ask("Please enter your team's API key: ")
|
68
|
-
connection.repos.all(self.class.remote_user).count
|
69
|
-
GitReflow.say "Connected to BitBucket\!", :success
|
70
|
-
end
|
71
|
-
rescue ::BitBucket::Error::Unauthorized => e
|
72
|
-
GitReflow::Config.unset('bitbucket.api-key', local: self.class.project_only?)
|
73
|
-
GitReflow.say "Invalid API key for team #{self.class.remote_user}.", :error
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
def connection
|
78
|
-
@connection ||= self.class.connection
|
79
|
-
end
|
80
|
-
|
81
|
-
def get_build_status(sha)
|
82
|
-
# BitBucket does not currently support build status via API
|
83
|
-
# for updates: https://bitbucket.org/site/master/issue/8548/better-ci-integration-add-a-build-status
|
84
|
-
return nil
|
85
|
-
end
|
86
|
-
|
87
|
-
def colorized_build_description(state, description)
|
88
|
-
""
|
89
|
-
end
|
90
|
-
|
91
|
-
def create_pull_request(options = {})
|
92
|
-
PullRequest.create(options)
|
93
|
-
end
|
94
|
-
|
95
|
-
def find_open_pull_request(options = {})
|
96
|
-
PullRequest.find_open(options)
|
97
|
-
end
|
98
|
-
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
1
|
+
require 'bitbucket_rest_api'
|
2
|
+
require 'git_reflow/git_helpers'
|
3
|
+
|
4
|
+
module GitReflow
|
5
|
+
module GitServer
|
6
|
+
class BitBucket < Base
|
7
|
+
require_relative 'bit_bucket/pull_request'
|
8
|
+
|
9
|
+
attr_reader :connection
|
10
|
+
|
11
|
+
def initialize(config_options = {})
|
12
|
+
project_only = !!config_options.delete(:project_only)
|
13
|
+
|
14
|
+
# We remove any existing setup first, then setup our required config settings
|
15
|
+
GitReflow::Config.unset('reflow.local-projects', value: "#{self.class.remote_user}/#{self.class.remote_repo_name}")
|
16
|
+
GitReflow::Config.add('reflow.local-projects', "#{self.class.remote_user}/#{self.class.remote_repo_name}") if project_only
|
17
|
+
GitReflow::Config.set('reflow.git-server', 'BitBucket', local: project_only)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.connection
|
21
|
+
if api_key_setup?
|
22
|
+
@connection ||= ::BitBucket.new login: remote_user, password: api_key
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.api_endpoint
|
27
|
+
endpoint = GitReflow::Config.get("bitbucket.endpoint", local: project_only?)
|
28
|
+
(endpoint.length > 0) ? endpoint : ::BitBucket::Configuration::DEFAULT_ENDPOINT
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.site_url
|
32
|
+
site_url = GitReflow::Config.get("bitbucket.site", local: project_only?)
|
33
|
+
(site_url.length > 0) ? site_url : 'https://bitbucket.org'
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.api_key
|
37
|
+
GitReflow::Config.get("bitbucket.api-key", reload: true, local: project_only?)
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.api_key=(key)
|
41
|
+
GitReflow::Config.set("bitbucket.api-key", key, local: project_only?)
|
42
|
+
end
|
43
|
+
def self.api_key_setup?
|
44
|
+
(self.api_key.length > 0)
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.user
|
48
|
+
GitReflow::Config.get('bitbucket.user', local: project_only?)
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.user=(bitbucket_user)
|
52
|
+
GitReflow::Config.set('bitbucket.user', bitbucket_user, local: project_only?)
|
53
|
+
end
|
54
|
+
|
55
|
+
def authenticate(options = {silent: false})
|
56
|
+
begin
|
57
|
+
if connection and self.class.api_key_setup?
|
58
|
+
unless options[:silent]
|
59
|
+
GitReflow.say "\nYour BitBucket account was already setup with:"
|
60
|
+
GitReflow.say "\tUser Name: #{self.class.user}"
|
61
|
+
end
|
62
|
+
else
|
63
|
+
self.class.user = options[:user] || ask("Please enter your BitBucket username: ")
|
64
|
+
GitReflow.say "\nIn order to connect your BitBucket account,"
|
65
|
+
GitReflow.say "you'll need to generate an API key for your team"
|
66
|
+
GitReflow.say "Visit #{self.class.site_url}/account/user/#{self.class.remote_user}/api-key/, to generate it\n"
|
67
|
+
self.class.api_key = ask("Please enter your team's API key: ")
|
68
|
+
connection.repos.all(self.class.remote_user).count
|
69
|
+
GitReflow.say "Connected to BitBucket\!", :success
|
70
|
+
end
|
71
|
+
rescue ::BitBucket::Error::Unauthorized => e
|
72
|
+
GitReflow::Config.unset('bitbucket.api-key', local: self.class.project_only?)
|
73
|
+
GitReflow.say "Invalid API key for team #{self.class.remote_user}.", :error
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def connection
|
78
|
+
@connection ||= self.class.connection
|
79
|
+
end
|
80
|
+
|
81
|
+
def get_build_status(sha)
|
82
|
+
# BitBucket does not currently support build status via API
|
83
|
+
# for updates: https://bitbucket.org/site/master/issue/8548/better-ci-integration-add-a-build-status
|
84
|
+
return nil
|
85
|
+
end
|
86
|
+
|
87
|
+
def colorized_build_description(state, description)
|
88
|
+
""
|
89
|
+
end
|
90
|
+
|
91
|
+
def create_pull_request(options = {})
|
92
|
+
PullRequest.create(options)
|
93
|
+
end
|
94
|
+
|
95
|
+
def find_open_pull_request(options = {})
|
96
|
+
PullRequest.find_open(options)
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|