Class: Vendor::VendorFile::DSL
- Inherits:
-
Object
- Object
- Vendor::VendorFile::DSL
- Defined in:
- lib/vendor/vendor_file/dsl.rb
Defined Under Namespace
Classes: UnknownLibraryType
Instance Attribute Summary collapse
-
#libraries ⇒ Object
readonly
Returns the value of attribute libraries.
-
#sources ⇒ Object
readonly
Returns the value of attribute sources.
Instance Method Summary collapse
-
#initialize ⇒ DSL
constructor
A new instance of DSL.
- #lib(name, version = nil, options = nil) ⇒ Object
- #source(source) ⇒ Object
- #target(*targets, &block) ⇒ Object
Constructor Details
#initialize ⇒ DSL
Returns a new instance of DSL.
12 13 14 15 |
# File 'lib/vendor/vendor_file/dsl.rb', line 12 def initialize @sources = [] @libraries = [] end |
Instance Attribute Details
#libraries ⇒ Object (readonly)
Returns the value of attribute libraries.
10 11 12 |
# File 'lib/vendor/vendor_file/dsl.rb', line 10 def libraries @libraries end |
#sources ⇒ Object (readonly)
Returns the value of attribute sources.
9 10 11 |
# File 'lib/vendor/vendor_file/dsl.rb', line 9 def sources @sources end |
Instance Method Details
#lib(name, version = nil, options = nil) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/vendor/vendor_file/dsl.rb', line 23 def lib(name, version = nil, = nil) if .nil? && version.kind_of?(Hash) = version version = nil end klass = Vendor::VendorFile::Library::Remote if if .has_key?(:git) klass = Vendor::VendorFile::Library::Git elsif .has_key?(:path) klass = Vendor::VendorFile::Library::Local end end opts = { :name => name }.merge( || {}) opts[:targets] = @with_targets if @with_targets && !opts.has_key?(:target) && !opts.has_key?(:targets) opts[:version] = version if version @libraries << klass.new(opts) end |
#source(source) ⇒ Object
17 18 19 20 21 |
# File 'lib/vendor/vendor_file/dsl.rb', line 17 def source(source) Vendor.ui.warn "Having multiple vendor sources is currently not supported. It will be in a future release." @sources << Vendor::VendorFile::Source.new(source) end |
#target(*targets, &block) ⇒ Object
46 47 48 49 50 |
# File 'lib/vendor/vendor_file/dsl.rb', line 46 def target(*targets, &block) @with_targets = targets yield @with_targets = nil end |