Module: GitReflow::GitServer

Extended by:
GitServer
Included in:
GitServer
Defined in:
lib/git_reflow/git_server.rb,
lib/git_reflow/merge_error.rb,
lib/git_reflow/git_server/git_hub.rb,
lib/git_reflow/git_server/bit_bucket.rb,
lib/git_reflow/git_server/pull_request.rb,
lib/git_reflow/git_server/git_hub/pull_request.rb,
lib/git_reflow/git_server/bit_bucket/pull_request.rb

Defined Under Namespace

Classes: Base, BitBucket, ConnectionError, GitHub, MergeError, PullRequest

Instance Method Summary collapse

Instance Method Details

#can_connect_to?(provider) ⇒ Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/git_reflow/git_server.rb', line 44

def can_connect_to?(provider)
  GitReflow::GitServer.const_defined?(provider)
end

#connect(options = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/git_reflow/git_server.rb', line 11

def connect(options = {})
  options ||= {}
  options[:provider] = 'GitHub' if "#{options[:provider]}".length <= 0
  begin
    provider_name = options[:provider]
    provider = provider_class_for(options.delete(:provider)).new(options)
    provider.authenticate(options.keep_if {|key, value| key == :silent })
    provider
  rescue ConnectionError => e
    GitReflow.say "Error connecting to #{provider_name}: #{e.message}", :error
  end
end

#connectionObject



24
25
26
27
# File 'lib/git_reflow/git_server.rb', line 24

def connection
  return nil unless current_provider
  current_provider.connection
end

#create_pull_request(options = {}) ⇒ Object



48
49
50
# File 'lib/git_reflow/git_server.rb', line 48

def create_pull_request(options = {})
  raise "#{self.class.to_s}#create_pull_request method must be implemented"
end

#current_providerObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/git_reflow/git_server.rb', line 29

def current_provider
  provider = "#{GitReflow::Config.get('reflow.git-server', local: true)  || GitReflow::Config.get('reflow.git-server')}"
  if provider.length > 0
    begin
      provider_class_for(provider)
    rescue ConnectionError => e
      GitReflow.say e.message, :error
      nil
    end
  else
    GitReflow.say "Reflow hasn't been setup yet.  Run 'git reflow setup' to continue", :notice
    nil
  end
end

#find_open_pull_request(options = {}) ⇒ Object



52
53
54
# File 'lib/git_reflow/git_server.rb', line 52

def find_open_pull_request(options = {})
  raise "#{self.class.to_s}#find_open_pull_request method must be implemented"
end