class Teapot::Script

The DSL exposed to the `teapot.rb` file.

Constants

Files
Rule

Attributes

configurations[R]
context[R]
default_configuration[R]
default_project[R]
defined[R]
package[R]
version[R]

Public Class Methods

new(context, package, path = TEAPOT_FILE) click to toggle source
# File lib/teapot/loader.rb, line 63
def initialize(context, package, path = TEAPOT_FILE)
        @context = context
        @package = package
        
        @defined = []
        @version = nil
        
        @configurations = Build::Dependency::Set.new
        
        @default_project = nil
        @default_configuration = nil
        
        @mtime = nil
end

Public Instance Methods

define_configuration(*args) { |configuration| ... } click to toggle source
# File lib/teapot/loader.rb, line 119
def define_configuration(*args)
        configuration = Configuration.new(@context, @package, *args)

        yield configuration

        @default_configuration ||= configuration
        @defined << configuration
        @configurations << configuration
end
define_project(*args) { |project| ... } click to toggle source
# File lib/teapot/loader.rb, line 100
def define_project(*args)
        project = Project.new(@context, @package, *args)
        
        yield project
        
        @default_project = project
        @defined << project
end
define_target(*args) { |target| ... } click to toggle source
# File lib/teapot/loader.rb, line 109
def define_target(*args)
        target = Target.new(@context, @package, *args)
        
        yield target
        
        target.update_environments!
        
        @defined << target
end
host(*args) { || ... } click to toggle source

Checks the host patterns and executes the block if they match.

# File lib/teapot/loader.rb, line 130
def host(*args, &block)
        name = @context.options[:host_platform] || RUBY_PLATFORM
        
        if block_given?
                if args.find{|arg| arg === name}
                        yield
                end
        else
                name
        end
end
required_version(version)
Alias for: teapot_version
teapot_version(version) click to toggle source
# File lib/teapot/loader.rb, line 88
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
Also aliased as: required_version