Class: Teapot::Loader
- Inherits:
-
Object
- Object
- Teapot::Loader
- Includes:
- Build::Helpers
- Defined in:
- lib/teapot/context.rb
Instance Attribute Summary collapse
-
#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_target(*args) {|target| ... } ⇒ Object
-
#initialize(context, package) ⇒ Loader
constructor
A new instance of Loader.
- #load(path) ⇒ Object
- #required_version(version) ⇒ Object
Methods included from Build::Helpers
#install_directory, #install_external
Constructor Details
#initialize(context, package) ⇒ Loader
Returns a new instance of Loader.
38 39 40 41 42 43 44 |
# File 'lib/teapot/context.rb', line 38 def initialize(context, package) @context = context @package = package @defined = [] @version = nil end |
Instance Attribute Details
#defined ⇒ Object (readonly)
Returns the value of attribute defined.
47 48 49 |
# File 'lib/teapot/context.rb', line 47 def defined @defined end |
#package ⇒ Object (readonly)
Returns the value of attribute package.
46 47 48 |
# File 'lib/teapot/context.rb', line 46 def package @package end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
48 49 50 |
# File 'lib/teapot/context.rb', line 48 def version @version end |
Instance Method Details
#define_target(*args) {|target| ... } ⇒ Object
59 60 61 62 63 64 65 66 67 |
# File 'lib/teapot/context.rb', line 59 def define_target(*args, &block) target = Target.new(@context, @package, *args) yield target @context.targets[target.name] = target @defined << target end |
#load(path) ⇒ Object
69 70 71 |
# File 'lib/teapot/context.rb', line 69 def load(path) self.instance_eval(File.read(path), path) end |
#required_version(version) ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/teapot/context.rb', line 50 def required_version(version) if version >= MINIMUM_LOADER_VERSION && version <= LOADER_VERSION @version = version else raise IncompatibleTeapot.new("Version #{version} isn't compatible with current loader!\n" \ "Minimum supported version: #{MINIMUM_LOADER_VERSION}; Current version: #{LOADER_VERSION}.") end end |