Class: Omnibus::Fetcher
- Inherits:
-
Object
- Object
- Omnibus::Fetcher
- Extended by:
- Util
- Includes:
- Digestable, Logging, Util
- Defined in:
- lib/omnibus/fetcher.rb
Direct Known Subclasses
FileFetcher, GitFetcher, NetFetcher, NullFetcher, PathFetcher
Constant Summary
Constants included from Util
Instance Attribute Summary collapse
-
#build_dir ⇒ Object
readonly
Returns the value of attribute build_dir.
-
#described_version ⇒ String
readonly
The upstream version as described before resolution.
-
#name ⇒ String
readonly
The name of the software this fetcher shall fetch.
-
#project_dir ⇒ String
readonly
The path where fetched software should live.
-
#resolved_version ⇒ String
readonly
The exact upstream version that a fetcher should fetch.
-
#source ⇒ Hash
readonly
The source for this fetcher.
Abstract methods collapse
- #clean ⇒ Object abstract
- #fetch ⇒ Object abstract
- #fetch_required? ⇒ Boolean abstract
- #version_for_cache ⇒ Object abstract
- #version_guid ⇒ Object abstract
Instance Method Summary collapse
-
#fetcher ⇒ Object
————————————————–.
-
#initialize(manifest_entry, project_dir, build_dir) ⇒ Fetcher
constructor
Create a new Fetcher object from the given software.
-
#version ⇒ Object
All fetchers should prefer resolved_version to version this is provided for compatibility.
Methods included from Util
compiler_safe_path, copy_file, create_directory, create_file, create_link, included, path_key, remove_directory, remove_file, retry_block, shellout, shellout!, windows_safe_path
Methods included from Logging
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.
The parameters correspond to the relevant portions of a software definition that a fetcher needs access to. This avoids strongly coupling the software object with all fetchers.
86 87 88 89 90 91 92 93 |
# File 'lib/omnibus/fetcher.rb', line 86 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_dir ⇒ Object (readonly)
Returns the value of attribute build_dir.
73 74 75 |
# File 'lib/omnibus/fetcher.rb', line 73 def build_dir @build_dir end |
#described_version ⇒ String (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.
55 56 57 |
# File 'lib/omnibus/fetcher.rb', line 55 def described_version @described_version end |
#name ⇒ String (readonly)
The name of the software this fetcher shall fetch
29 30 31 |
# File 'lib/omnibus/fetcher.rb', line 29 def name @name end |
#project_dir ⇒ String (readonly)
The path where fetched software should live.
Only files under this directory are modified. If the source to fetch is a directory, it is staged rooted here. If it’s a file, it’s copied underneath this directory. If it’s a tarball, it’s extracted here. If it’s a repo, its checkout is rooted here. You get the idea.
It’s named project_dir instead of extract_dir/extract_path because of legacy reasons. This has nothing to do with project definitions or the underlying relative_path for a software definition (except for legacy behavior).
72 73 74 |
# File 'lib/omnibus/fetcher.rb', line 72 def project_dir @project_dir end |
#resolved_version ⇒ String (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.
46 47 48 |
# File 'lib/omnibus/fetcher.rb', line 46 def resolved_version @resolved_version end |
#source ⇒ Hash (readonly)
The source for this fetcher.
36 37 38 |
# File 'lib/omnibus/fetcher.rb', line 36 def source @source end |
Instance Method Details
#clean ⇒ Object
112 113 114 |
# File 'lib/omnibus/fetcher.rb', line 112 def clean raise NotImplementedError end |
#fetch ⇒ Object
119 120 121 |
# File 'lib/omnibus/fetcher.rb', line 119 def fetch raise NotImplementedError end |
#fetch_required? ⇒ Boolean
105 106 107 |
# File 'lib/omnibus/fetcher.rb', line 105 def fetch_required? raise NotImplementedError end |
#fetcher ⇒ Object
141 142 143 |
# File 'lib/omnibus/fetcher.rb', line 141 def fetcher self end |
#version ⇒ Object
All fetchers should prefer resolved_version to version this is provided for compatibility.
149 150 151 |
# File 'lib/omnibus/fetcher.rb', line 149 def version resolved_version end |
#version_for_cache ⇒ Object
133 134 135 |
# File 'lib/omnibus/fetcher.rb', line 133 def version_for_cache raise NotImplementedError end |
#version_guid ⇒ Object
126 127 128 |
# File 'lib/omnibus/fetcher.rb', line 126 def version_guid raise NotImplementedError end |