Class: Bosh::Workspace::Release
- Inherits:
-
Object
- Object
- Bosh::Workspace::Release
- Defined in:
- lib/bosh/workspace/release.rb
Constant Summary collapse
- REFSPEC =
['HEAD:refs/remotes/origin/HEAD','*:refs/remotes/origin/*']
Instance Attribute Summary collapse
-
#git_url ⇒ Object
readonly
Returns the value of attribute git_url.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#repo_dir ⇒ Object
readonly
Returns the value of attribute repo_dir.
Instance Method Summary collapse
-
#initialize(release, releases_dir, credentials_callback, options = {}) ⇒ Release
constructor
A new instance of Release.
- #manifest ⇒ Object
- #manifest_file ⇒ Object
- #name_version ⇒ Object
- #ref ⇒ Object
- #release_dir ⇒ Object
- #update_repo(options = {}) ⇒ Object
- #url ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(release, releases_dir, credentials_callback, options = {}) ⇒ Release
Returns a new instance of Release.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/bosh/workspace/release.rb', line 6 def initialize(release, releases_dir, credentials_callback, = {}) @name = release["name"] @ref = release["ref"] @path = release["path"] @spec_version = release["version"].to_s @git_url = release["git"] @repo_dir = File.join(releases_dir, @name) @url = release["url"] @credentials_callback = credentials_callback @offline = [:offline] end |
Instance Attribute Details
#git_url ⇒ Object (readonly)
Returns the value of attribute git_url.
4 5 6 |
# File 'lib/bosh/workspace/release.rb', line 4 def git_url @git_url end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/bosh/workspace/release.rb', line 4 def name @name end |
#repo_dir ⇒ Object (readonly)
Returns the value of attribute repo_dir.
4 5 6 |
# File 'lib/bosh/workspace/release.rb', line 4 def repo_dir @repo_dir end |
Instance Method Details
#manifest ⇒ Object
29 30 31 |
# File 'lib/bosh/workspace/release.rb', line 29 def manifest release[:manifest] end |
#manifest_file ⇒ Object
25 26 27 |
# File 'lib/bosh/workspace/release.rb', line 25 def manifest_file File.join(repo_dir, manifest) end |
#name_version ⇒ Object
33 34 35 |
# File 'lib/bosh/workspace/release.rb', line 33 def name_version "#{name}/#{version}" end |
#ref ⇒ Object
41 42 43 44 45 46 |
# File 'lib/bosh/workspace/release.rb', line 41 def ref return nil unless @ref return find_commit_sha(repo.ref(@ref)) if Rugged::Reference.valid_name?(@ref) && repo.ref(@ref) repo.lookup(@ref).oid end |
#release_dir ⇒ Object
48 49 50 |
# File 'lib/bosh/workspace/release.rb', line 48 def release_dir @path ? File.join(@repo_dir, @path) : @repo_dir end |
#update_repo(options = {}) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/bosh/workspace/release.rb', line 18 def update_repo( = {}) fetch_repo hash = ref || release[:commit] update_repo_with_ref(repo, hash) update_submodules end |
#url ⇒ Object
52 53 54 |
# File 'lib/bosh/workspace/release.rb', line 52 def url @url && @url.gsub("^VERSION^", version) end |
#version ⇒ Object
37 38 39 |
# File 'lib/bosh/workspace/release.rb', line 37 def version release[:version] end |