Class: Indocker::Artifacts::Git
- Inherits:
-
Object
- Object
- Indocker::Artifacts::Git
- Defined in:
- lib/indocker/artifacts/git.rb
Instance Attribute Summary collapse
-
#branch ⇒ Object
readonly
Returns the value of attribute branch.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#remote_name ⇒ Object
readonly
Returns the value of attribute remote_name.
-
#remote_url ⇒ Object
readonly
Returns the value of attribute remote_url.
-
#source_path ⇒ Object
readonly
Returns the value of attribute source_path.
-
#target_path ⇒ Object
readonly
Returns the value of attribute target_path.
Instance Method Summary collapse
-
#initialize(name:, remote_name:, remote_url:, branch:, source_path:, target_path:) ⇒ Git
constructor
A new instance of Git.
- #project_name(url) ⇒ Object
- #repository ⇒ Object
Constructor Details
#initialize(name:, remote_name:, remote_url:, branch:, source_path:, target_path:) ⇒ Git
Returns a new instance of Git.
4 5 6 7 8 9 10 11 |
# File 'lib/indocker/artifacts/git.rb', line 4 def initialize(name:, remote_name:, remote_url:, branch:, source_path:, target_path:) @name = name @remote_name = remote_name @remote_url = remote_url @branch = branch @source_path = source_path @target_path = target_path end |
Instance Attribute Details
#branch ⇒ Object (readonly)
Returns the value of attribute branch.
2 3 4 |
# File 'lib/indocker/artifacts/git.rb', line 2 def branch @branch end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
2 3 4 |
# File 'lib/indocker/artifacts/git.rb', line 2 def name @name end |
#remote_name ⇒ Object (readonly)
Returns the value of attribute remote_name.
2 3 4 |
# File 'lib/indocker/artifacts/git.rb', line 2 def remote_name @remote_name end |
#remote_url ⇒ Object (readonly)
Returns the value of attribute remote_url.
2 3 4 |
# File 'lib/indocker/artifacts/git.rb', line 2 def remote_url @remote_url end |
#source_path ⇒ Object (readonly)
Returns the value of attribute source_path.
2 3 4 |
# File 'lib/indocker/artifacts/git.rb', line 2 def source_path @source_path end |
#target_path ⇒ Object (readonly)
Returns the value of attribute target_path.
2 3 4 |
# File 'lib/indocker/artifacts/git.rb', line 2 def target_path @target_path end |
Instance Method Details
#project_name(url) ⇒ Object
22 23 24 |
# File 'lib/indocker/artifacts/git.rb', line 22 def project_name(url) url.split('/').last.gsub('.git', '') end |
#repository ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/indocker/artifacts/git.rb', line 13 def repository @repository ||= Indocker::Repositories::Git.new(@name).setup( remote_name: remote_name, remote_url: remote_url, branch: branch, clone_path: "/tmp/#{Indocker.configuration.name}/artifacts/git/#{project_name(remote_url)}/#{branch}" ) end |