Class: Plus4uCodebase::Gitolite

Inherits:
Object
  • Object
show all
Defined in:
lib/plus4u_codebase/gitolite.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session, options = nil) ⇒ Gitolite

Creates a new instance of Gitolite.

Parameters:

  • session (UU::OS::Security::Session)

    Session to use for remote calls.

  • options (Hash) (defaults to: nil)

    Options for UU::OS::CMD::CommandClient.



11
12
13
# File 'lib/plus4u_codebase/gitolite.rb', line 11

def initialize(session, options = nil)
  @cmd = UU::OS::CMD::CommandClient.new("plus4u-codebase", session, options)
end

Class Method Details

.set_server_ssh_key(hub_or_repositroy_uri, params = {}) ⇒ void

This method returns an undefined value.

Sets server private ssh key. Key is used to ssh access to gitolite server.

Examples:

# read existing private key
private_ssh_key = File.read('/path/to/key/13-666-1') # String '-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEAxVu3AQL9M4Fk...'

# set private ssh key
gitolite = Plus4uCodebase::Gitolite.new(UU::OS::Security::Session.current_session)
gitolite.set_server_ssh_key('ues:TER:HUB', key: private_ssh_key)

Parameters:

  • hub_or_repositroy_uri (String, UU::OS::UESURI)

    URI of the hub or repository.

  • params (Hash) (defaults to: {})

    Ssh key attributes.

Options Hash (params):

  • :key (String)

    Private key as String.



49
50
51
52
# File 'lib/plus4u_codebase/gitolite.rb', line 49

def self.set_server_ssh_key(hub_or_repositroy_uri, params = {})
  session = UU::OS::Security::Session.current_session
  self.new(session).set_server_ssh_key(hub_or_repositroy_uri, params)
end

Instance Method Details

#set_server_ssh_key(hub_or_repositroy_uri, params = {}) ⇒ void

This method returns an undefined value.

Sets server private ssh key. Key is used to ssh access to gitolite server.

Examples:

# read existing private key
private_ssh_key = File.read('/path/to/key/13-666-1') # String '-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEAxVu3AQL9M4Fk...'

# set private ssh key
Plus4uCodebase::Gitolite.set_server_ssh_key('ues:TER:HUB', key: private_ssh_key)

Parameters:

  • hub_or_repositroy_uri (String, UU::OS::UESURI)

    URI of the hub or repository.

  • params (Hash) (defaults to: {})

    Ssh key attributes.

Options Hash (params):

  • :key (String)

    Private key as String.



28
29
30
31
32
33
# File 'lib/plus4u_codebase/gitolite.rb', line 28

def set_server_ssh_key(hub_or_repositroy_uri, params = {})
  if params.nil? || params[:key].nil? || params[:key].empty?
    raise "Private key can not be empty."
  end
  return @cmd.invoke('Gitolite/setServerSshKey', hub_or_repositroy_uri, parameters: {sshKey: params[:key]})
end