Class: Indocker::Artifacts::Git
- Defined in:
- lib/indocker/artifacts/git.rb
Instance Attribute Summary collapse
-
#branch ⇒ Object
readonly
Returns the value of attribute branch.
-
#files ⇒ Object
readonly
Returns the value of attribute files.
-
#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.
Instance Method Summary collapse
- #build_source_path(path) ⇒ Object
-
#initialize(name:, remote_name:, remote_url:, branch:, files: [], source_path: nil, target_path: nil) ⇒ Git
constructor
A new instance of Git.
- #is_git? ⇒ Boolean
- #project_name(url) ⇒ Object
- #repository ⇒ Object
Constructor Details
#initialize(name:, remote_name:, remote_url:, branch:, files: [], source_path: nil, target_path: nil) ⇒ Git
Returns a new instance of Git.
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/indocker/artifacts/git.rb', line 4 def initialize(name:, remote_name:, remote_url:, branch:, files: [], source_path: nil, target_path: nil) @name = name @remote_name = remote_name @remote_url = remote_url @branch = branch @files = build_all_files( files: files, 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 |
#files ⇒ Object (readonly)
Returns the value of attribute files.
2 3 4 |
# File 'lib/indocker/artifacts/git.rb', line 2 def files @files 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 |
Instance Method Details
#build_source_path(path) ⇒ Object
34 35 36 |
# File 'lib/indocker/artifacts/git.rb', line 34 def build_source_path(path) File.join(self.repository.clone_path, path) end |
#is_git? ⇒ Boolean
30 31 32 |
# File 'lib/indocker/artifacts/git.rb', line 30 def is_git? true end |
#project_name(url) ⇒ Object
26 27 28 |
# File 'lib/indocker/artifacts/git.rb', line 26 def project_name(url) url.split('/').last.gsub('.git', '') end |
#repository ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/indocker/artifacts/git.rb', line 17 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 |