Class: Bosh::Workspace::Release

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh/workspace/release.rb

Constant Summary collapse

REFSPEC =
['HEAD:refs/remotes/origin/HEAD','*:refs/remotes/origin/*']

Instance Attribute Summary collapse

Instance Method Summary collapse

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, options = {})
  @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              = options[:offline]
end

Instance Attribute Details

#git_urlObject (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

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/bosh/workspace/release.rb', line 4

def name
  @name
end

#repo_dirObject (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

#manifestObject



29
30
31
# File 'lib/bosh/workspace/release.rb', line 29

def manifest
  release[:manifest]
end

#manifest_fileObject



25
26
27
# File 'lib/bosh/workspace/release.rb', line 25

def manifest_file
  File.join(repo_dir, manifest)
end

#name_versionObject



33
34
35
# File 'lib/bosh/workspace/release.rb', line 33

def name_version
  "#{name}/#{version}"
end

#refObject



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_dirObject



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(options = {})
  fetch_repo
  hash = ref || release[:commit]
  update_repo_with_ref(repo, hash)
  update_submodules
end

#urlObject



52
53
54
# File 'lib/bosh/workspace/release.rb', line 52

def url
  @url && @url.gsub("^VERSION^", version)
end

#versionObject



37
38
39
# File 'lib/bosh/workspace/release.rb', line 37

def version
  release[:version]
end