Class: Indocker::Repositories::Git

Inherits:
Abstract
  • Object
show all
Defined in:
lib/indocker/repositories/git.rb

Constant Summary collapse

DEFAULT_SSH_KEY =
"id_rsa"

Instance Attribute Summary collapse

Attributes inherited from Abstract

#name

Instance Method Summary collapse

Methods inherited from Abstract

#initialize, #is_git?, #is_local?, #is_no_sync?

Methods included from Concerns::Inspectable

#inspect

Constructor Details

This class inherits a constructor from Indocker::Repositories::Abstract

Instance Attribute Details

#branchObject (readonly)

Returns the value of attribute branch.



2
3
4
# File 'lib/indocker/repositories/git.rb', line 2

def branch
  @branch
end

#emailObject (readonly)

Returns the value of attribute email.



2
3
4
# File 'lib/indocker/repositories/git.rb', line 2

def email
  @email
end

#passwordObject (readonly)

Returns the value of attribute password.



2
3
4
# File 'lib/indocker/repositories/git.rb', line 2

def password
  @password
end

#remote_nameObject (readonly)

Returns the value of attribute remote_name.



2
3
4
# File 'lib/indocker/repositories/git.rb', line 2

def remote_name
  @remote_name
end

#remote_urlObject (readonly)

Returns the value of attribute remote_url.



2
3
4
# File 'lib/indocker/repositories/git.rb', line 2

def remote_url
  @remote_url
end

#ssh_keyObject (readonly)

Returns the value of attribute ssh_key.



2
3
4
# File 'lib/indocker/repositories/git.rb', line 2

def ssh_key
  @ssh_key
end

Instance Method Details

#clone_pathObject



21
22
23
# File 'lib/indocker/repositories/git.rb', line 21

def clone_path
  @clone_path || "/tmp/#{Indocker.configuration.name}/repositories/git/#{project_name}/#{branch}"
end

#project_nameObject



17
18
19
# File 'lib/indocker/repositories/git.rb', line 17

def project_name
  @remote_url.split('/').last.gsub('.git', '')
end

#setup(remote_name:, remote_url:, email: nil, password: nil, branch:, clone_path: nil, ssh_key: DEFAULT_SSH_KEY) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/indocker/repositories/git.rb', line 6

def setup(remote_name:, remote_url:, email: nil, password: nil, branch:, clone_path: nil, ssh_key: DEFAULT_SSH_KEY)
  @remote_name = remote_name
  @remote_url = remote_url
  @email = email
  @password = password
  @branch = branch
  @clone_path = clone_path
  @ssh_key = ssh_key
  self
end