Class: Omnibus::Fetcher

Inherits:
Object
  • Object
show all
Extended by:
Util
Includes:
Digestable, Logging, Util
Defined in:
lib/omnibus/fetcher.rb

Direct Known Subclasses

GitFetcher, NetFetcher, NullFetcher, PathFetcher

Constant Summary

Constants included from Util

Util::SHELLOUT_OPTIONS

Instance Attribute Summary collapse

Abstract methods collapse

Instance Method Summary collapse

Methods included from Util

copy_file, create_directory, create_file, create_link, included, remove_directory, remove_file, shellout, shellout!, windows_safe_path

Methods included from Logging

included

Methods included from Digestable

#digest, #digest_directory, included

Constructor Details

#initialize(manifest_entry, project_dir, build_dir) ⇒ Fetcher

Create a new Fetcher object from the given software.

To preserve the original interface, this still takes a software-like argument, but to avoid coupling with the software object, we pull out what we need and don't touch it again.

Parameters:



74
75
76
77
78
79
80
81
# File 'lib/omnibus/fetcher.rb', line 74

def initialize(manifest_entry, project_dir, build_dir)
  @name    = manifest_entry.name
  @source  = manifest_entry.locked_source
  @resolved_version = manifest_entry.locked_version
  @described_version = manifest_entry.described_version
  @project_dir = project_dir
  @build_dir = build_dir
end

Instance Attribute Details

#build_dirObject (readonly)

Returns the value of attribute build_dir



63
64
65
# File 'lib/omnibus/fetcher.rb', line 63

def build_dir
  @build_dir
end

#described_versionString (readonly)

The upstream version as described before resolution.

This will usually be the same as resolved_version but may refer toa remote ref name or tag for a source such as git.

Returns:

  • (String)


55
56
57
# File 'lib/omnibus/fetcher.rb', line 55

def described_version
  @described_version
end

#nameString (readonly)

The name of the software this fetcher shall fetch

Returns:

  • (String)


29
30
31
# File 'lib/omnibus/fetcher.rb', line 29

def name
  @name
end

#project_dirString (readonly)

The path where extracted software should live.

Returns:

  • (String)


62
63
64
# File 'lib/omnibus/fetcher.rb', line 62

def project_dir
  @project_dir
end

#resolved_versionString (readonly)

The exact upstream version that a fetcher should fetch.

For sources that allow aliases (branch name, tags, etc). Users should use the class method resolve_version to determine this before constructing a fetcher.

Returns:

  • (String)


46
47
48
# File 'lib/omnibus/fetcher.rb', line 46

def resolved_version
  @resolved_version
end

#sourceHash (readonly)

The source for this fetcher.

Returns:

  • (Hash)


36
37
38
# File 'lib/omnibus/fetcher.rb', line 36

def source
  @source
end

Instance Method Details

#cleanObject

This method is abstract.

Raises:

  • (NotImplementedError)


100
101
102
# File 'lib/omnibus/fetcher.rb', line 100

def clean
  raise NotImplementedError
end

#fetchObject

This method is abstract.

Raises:

  • (NotImplementedError)


107
108
109
# File 'lib/omnibus/fetcher.rb', line 107

def fetch
  raise NotImplementedError
end

#fetch_required?Boolean

This method is abstract.

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


93
94
95
# File 'lib/omnibus/fetcher.rb', line 93

def fetch_required?
  raise NotImplementedError
end

#fetcherObject




129
130
131
# File 'lib/omnibus/fetcher.rb', line 129

def fetcher
  self
end

#versionObject

All fetchers should prefer resolved_version to version this is provided for compatibility.



137
138
139
# File 'lib/omnibus/fetcher.rb', line 137

def version
  resolved_version
end

#version_for_cacheObject

This method is abstract.

Raises:

  • (NotImplementedError)


121
122
123
# File 'lib/omnibus/fetcher.rb', line 121

def version_for_cache
  raise NotImplementedError
end

#version_guidObject

This method is abstract.

Raises:

  • (NotImplementedError)


114
115
116
# File 'lib/omnibus/fetcher.rb', line 114

def version_guid
  raise NotImplementedError
end