class LearnOpen::GitSSHConnector
Constants
- GIT_SSH_USER
Attributes
environment[R]
ssh_connection[R]
Public Class Methods
call(git_server:, environment:)
click to toggle source
# File lib/learn_open/services/git_ssh_connector.rb, line 7 def self.call(git_server:, environment:) self.new(git_server: git_server, environment: environment).call end
new(git_server:, environment:)
click to toggle source
# File lib/learn_open/services/git_ssh_connector.rb, line 11 def initialize(git_server:, environment:) @ssh_connection = LearnOpen.ssh_adapter.new(user: GIT_SSH_USER, hostname: git_server) @environment = environment end
Public Instance Methods
call()
click to toggle source
# File lib/learn_open/services/git_ssh_connector.rb, line 16 def call if managed_environment? && ssh_unauthenticated? upload_ssh_keys! end ssh_authenticated? end
managed_environment?()
click to toggle source
# File lib/learn_open/services/git_ssh_connector.rb, line 28 def managed_environment? environment.managed? end
ssh_authenticated?()
click to toggle source
# File lib/learn_open/services/git_ssh_connector.rb, line 36 def ssh_authenticated? ssh_connection.authenticated? end
ssh_unauthenticated?()
click to toggle source
# File lib/learn_open/services/git_ssh_connector.rb, line 32 def ssh_unauthenticated? !ssh_authenticated? end
upload_ssh_keys!()
click to toggle source
# File lib/learn_open/services/git_ssh_connector.rb, line 24 def upload_ssh_keys! LearnOpen.learn_web_client.add_ssh_key(key: ssh_connection.public_key) end