Class: Cany::Specification::DSL
- Inherits:
-
Object
- Object
- Cany::Specification::DSL
- Includes:
- Mixins::DependMixin
- Defined in:
- lib/cany/specification/dsl.rb
Class Method Summary collapse
Instance Method Summary collapse
- #binary(&block) ⇒ Object
- #build(&block) ⇒ Object
- #clean(&block) ⇒ Object
- #depend(*args) ⇒ Object
- #exec(&block) ⇒ Object
-
#initialize(specification) ⇒ DSL
constructor
A new instance of DSL.
- #prepare(&block) ⇒ Object
-
#require_cany(version) ⇒ Object
This directive ensures that Cany is used in a specific version.
-
#use(name, &block) ⇒ Object
This include the given recipe into the build process.
Methods included from Mixins::DependMixin
Constructor Details
#initialize(specification) ⇒ DSL
Returns a new instance of DSL.
4 5 6 |
# File 'lib/cany/specification/dsl.rb', line 4 def initialize(specification) @specification = specification end |
Class Method Details
.delegate(*methods) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/cany/specification/dsl.rb', line 12 def self.delegate(*methods) methods.each do |method| module_eval(<<-EOS, __FILE__, __LINE__) def #{method}(*args, &block) @specification.send :'#{method}=', *args, &block end EOS end end |
Instance Method Details
#binary(&block) ⇒ Object
53 54 55 |
# File 'lib/cany/specification/dsl.rb', line 53 def binary(&block) @specification.binary = block end |
#build(&block) ⇒ Object
49 50 51 |
# File 'lib/cany/specification/dsl.rb', line 49 def build(&block) @specification.build = block end |
#clean(&block) ⇒ Object
45 46 47 |
# File 'lib/cany/specification/dsl.rb', line 45 def clean(&block) @specification.clean = block end |
#depend(*args) ⇒ Object
62 63 64 |
# File 'lib/cany/specification/dsl.rb', line 62 def depend(*args) @specification.dependencies << create_dep(*args) end |
#exec(&block) ⇒ Object
8 9 10 |
# File 'lib/cany/specification/dsl.rb', line 8 def exec(&block) instance_eval(&block) end |
#prepare(&block) ⇒ Object
41 42 43 |
# File 'lib/cany/specification/dsl.rb', line 41 def prepare(&block) @specification.prepare = block end |
#require_cany(version) ⇒ Object
This directive ensures that Cany is used in a specific version. It will pass if the version match or raise an exception if it is an unsupported version.
28 29 30 31 32 33 |
# File 'lib/cany/specification/dsl.rb', line 28 def require_cany(version) unless Gem::Requirement.create(version).satisfied_by? Gem::Version.new(Cany::VERSION.to_s) raise UnsupportedVersion.new version end @specification.cany_version_constraint = version end |