Class: Teapot::Script
- Inherits:
-
Object
- Object
- Teapot::Script
- Defined in:
- lib/teapot/loader.rb
Overview
The DSL exposed to the teapot.rb file.
Constant Summary collapse
- Files =
Build::Files
- Rule =
Build::Rule
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#default_configuration ⇒ Object
readonly
Returns the value of attribute default_configuration.
-
#default_project ⇒ Object
readonly
Returns the value of attribute default_project.
-
#defined ⇒ Object
readonly
Returns the value of attribute defined.
-
#package ⇒ Object
readonly
Returns the value of attribute package.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #define_configuration(*args) {|configuration| ... } ⇒ Object
- #define_project(*args) {|project| ... } ⇒ Object
- #define_target(*args) {|target| ... } ⇒ Object
-
#host(*args, &block) ⇒ Object
Checks the host patterns and executes the block if they match.
-
#initialize(context, package, path = TEAPOT_FILE) ⇒ Script
constructor
A new instance of Script.
- #teapot_version(version) ⇒ Object (also: #required_version)
Constructor Details
#initialize(context, package, path = TEAPOT_FILE) ⇒ Script
Returns a new instance of Script.
62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/teapot/loader.rb', line 62 def initialize(context, package, path = TEAPOT_FILE) @context = context @package = package @defined = [] @version = nil @default_project = nil @default_configuration = nil @mtime = nil end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
75 76 77 |
# File 'lib/teapot/loader.rb', line 75 def context @context end |
#default_configuration ⇒ Object (readonly)
Returns the value of attribute default_configuration.
81 82 83 |
# File 'lib/teapot/loader.rb', line 81 def default_configuration @default_configuration end |
#default_project ⇒ Object (readonly)
Returns the value of attribute default_project.
80 81 82 |
# File 'lib/teapot/loader.rb', line 80 def default_project @default_project end |
#defined ⇒ Object (readonly)
Returns the value of attribute defined.
77 78 79 |
# File 'lib/teapot/loader.rb', line 77 def defined @defined end |
#package ⇒ Object (readonly)
Returns the value of attribute package.
76 77 78 |
# File 'lib/teapot/loader.rb', line 76 def package @package end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
78 79 80 |
# File 'lib/teapot/loader.rb', line 78 def version @version end |
Instance Method Details
#define_configuration(*args) {|configuration| ... } ⇒ Object
112 113 114 115 116 117 118 119 |
# File 'lib/teapot/loader.rb', line 112 def define_configuration(*args) configuration = Configuration.new(@context, @package, *args) yield configuration @default_configuration ||= configuration @defined << configuration end |
#define_project(*args) {|project| ... } ⇒ Object
95 96 97 98 99 100 101 102 |
# File 'lib/teapot/loader.rb', line 95 def define_project(*args) project = Project.new(@context, @package, *args) yield project @default_project = project @defined << project end |
#define_target(*args) {|target| ... } ⇒ Object
104 105 106 107 108 109 110 |
# File 'lib/teapot/loader.rb', line 104 def define_target(*args) target = Target.new(@context, @package, *args) yield target @defined << target end |
#host(*args, &block) ⇒ Object
Checks the host patterns and executes the block if they match.
122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/teapot/loader.rb', line 122 def host(*args, &block) name = @context.[:host_platform] || RUBY_PLATFORM if block_given? if args.find{|arg| arg === name} yield end else name end end |
#teapot_version(version) ⇒ Object Also known as: required_version
83 84 85 86 87 88 89 90 91 |
# File 'lib/teapot/loader.rb', line 83 def teapot_version(version) version = version[0..2] if version >= MINIMUM_LOADER_VERSION && version <= LOADER_VERSION @version = version else raise IncompatibleTeapotError.new(package, version) end end |