Class: Vendorificator::Vendor
- Inherits:
-
Object
- Object
- Vendorificator::Vendor
- Defined in:
- lib/vendorificator/vendor.rb
Defined Under Namespace
Classes: Archive, ChefCookbook, Download, Git, Tool
Class Attribute Summary collapse
-
.group ⇒ Object
Returns the value of attribute group.
-
.method_name ⇒ Object
Returns the value of attribute method_name.
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#git ⇒ Object
writeonly
Sets the attribute git.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#segment ⇒ Object
readonly
Returns the value of attribute segment.
Class Method Summary collapse
Instance Method Summary collapse
- #===(other) ⇒ Object
- #before_conjure! ⇒ Object
- #compute_dependencies! ⇒ Object
- #conjure! ⇒ Object
- #conjure_commit_message ⇒ Object
-
#git_add_extra_paths ⇒ Object
Hook points.
- #group ⇒ Object
-
#initialize(environment, name, args = {}, &block) ⇒ Vendor
constructor
A new instance of Vendor.
- #inspect ⇒ Object
- #metadata ⇒ Object
- #upstream_version ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(environment, name, args = {}, &block) ⇒ Vendor
Returns a new instance of Vendor.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/vendorificator/vendor.rb', line 26 def initialize(environment, name, args = {}, &block) @environment = environment @name = name @block = block @metadata = { :unparsed_args => args.clone } @metadata[:parsed_args] = @args = parse_initialize_args(args) @metadata[:module_annotations] = @args[:annotate] if @args[:annotate] @segment = Segment::Vendor.new(vendor: self, overlay: config.) if config. config..segments << @segment else @environment.segments << @segment end end |
Class Attribute Details
.group ⇒ Object
Returns the value of attribute group.
11 12 13 |
# File 'lib/vendorificator/vendor.rb', line 11 def group @group end |
.method_name ⇒ Object
Returns the value of attribute method_name.
11 12 13 |
# File 'lib/vendorificator/vendor.rb', line 11 def method_name @method_name end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
22 23 24 |
# File 'lib/vendorificator/vendor.rb', line 22 def args @args end |
#block ⇒ Object (readonly)
Returns the value of attribute block.
22 23 24 |
# File 'lib/vendorificator/vendor.rb', line 22 def block @block end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
22 23 24 |
# File 'lib/vendorificator/vendor.rb', line 22 def environment @environment end |
#git=(value) ⇒ Object
Sets the attribute git
23 24 25 |
# File 'lib/vendorificator/vendor.rb', line 23 def git=(value) @git = value end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
22 23 24 |
# File 'lib/vendorificator/vendor.rb', line 22 def name @name end |
#segment ⇒ Object (readonly)
Returns the value of attribute segment.
22 23 24 |
# File 'lib/vendorificator/vendor.rb', line 22 def segment @segment end |
Class Method Details
.arg_reader(*names) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/vendorificator/vendor.rb', line 13 def arg_reader(*names) names.each do |name| define_method(name) do args[name] end end end |
Instance Method Details
#===(other) ⇒ Object
44 45 46 |
# File 'lib/vendorificator/vendor.rb', line 44 def ===(other) other === name || File.(other.to_s) == work_dir end |
#before_conjure! ⇒ Object
68 |
# File 'lib/vendorificator/vendor.rb', line 68 def before_conjure! ; end |
#compute_dependencies! ⇒ Object
69 |
# File 'lib/vendorificator/vendor.rb', line 69 def compute_dependencies! ; end |
#conjure! ⇒ Object
62 63 64 |
# File 'lib/vendorificator/vendor.rb', line 62 def conjure! block.call(self) if block end |
#conjure_commit_message ⇒ Object
81 82 83 |
# File 'lib/vendorificator/vendor.rb', line 81 def "Conjured vendor module #{name} version #{version}" end |
#git_add_extra_paths ⇒ Object
Hook points
67 |
# File 'lib/vendorificator/vendor.rb', line 67 def git_add_extra_paths ; [] ; end |
#group ⇒ Object
48 49 50 |
# File 'lib/vendorificator/vendor.rb', line 48 def group defined?(@group) ? @group : self.class.group end |
#inspect ⇒ Object
52 53 54 |
# File 'lib/vendorificator/vendor.rb', line 52 def inspect "#<#{self.class} #{self}>" end |
#metadata ⇒ Object
72 73 74 75 76 77 78 79 |
# File 'lib/vendorificator/vendor.rb', line 72 def default = { :module_name => @name, :module_version => version, :module_group => @group, } default.merge @metadata end |
#upstream_version ⇒ Object
70 |
# File 'lib/vendorificator/vendor.rb', line 70 def upstream_version ; end |
#version ⇒ Object
56 57 58 59 60 |
# File 'lib/vendorificator/vendor.rb', line 56 def version @args[:version] || (!config[:use_upstream_version] && segment.merged_version) || upstream_version end |