Class: GitCompound::Component::Source
- Inherits:
-
Object
- Object
- GitCompound::Component::Source
- Extended by:
- Forwardable
- Defined in:
- lib/git_compound/component/source.rb
Overview
Component source
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #clone(destination) ⇒ Object
-
#initialize(origin, version, strategy, options, component) ⇒ Source
constructor
A new instance of Source.
-
#manifest ⇒ Object
Loads manifest from source repository.
Constructor Details
#initialize(origin, version, strategy, options, component) ⇒ Source
Returns a new instance of Source.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/git_compound/component/source.rb', line 12 def initialize(origin, version, strategy, , component) raise CompoundSyntaxError, 'Source cannot be empty' if origin.nil? || origin.empty? @origin = origin @strategy = strategy @options = @component = component @repository = Repository.factory(@origin) @version = strategy.new(@repository, version) end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/git_compound/component/source.rb', line 10 def @options end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
10 11 12 |
# File 'lib/git_compound/component/source.rb', line 10 def origin @origin end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
10 11 12 |
# File 'lib/git_compound/component/source.rb', line 10 def repository @repository end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
10 11 12 |
# File 'lib/git_compound/component/source.rb', line 10 def version @version end |
Instance Method Details
#clone(destination) ⇒ Object
36 37 38 |
# File 'lib/git_compound/component/source.rb', line 36 def clone(destination) @repository.clone(destination, clone_args) end |
#manifest ⇒ Object
Loads manifest from source repository
26 27 28 29 30 31 32 33 34 |
# File 'lib/git_compound/component/source.rb', line 26 def manifest raise DependencyError, "Version #{@version} unreachable" unless @version.reachable? contents = @repository.files_contents(Manifest::FILENAMES, @version.ref) Manifest.new(contents, @component) rescue FileNotFoundError Manifest.new(nil, @component) end |