teapot 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/README.md +19 -47
- data/bin/teapot +66 -127
- data/lib/teapot/build.rb +4 -4
- data/lib/teapot/build/targets/application.rb +1 -1
- data/lib/teapot/build/targets/external.rb +1 -1
- data/lib/teapot/build/targets/files.rb +1 -1
- data/lib/teapot/build/targets/library.rb +3 -3
- data/lib/teapot/commands.rb +1 -1
- data/lib/teapot/configuration.rb +174 -0
- data/lib/teapot/context.rb +103 -61
- data/lib/teapot/controller.rb +56 -0
- data/lib/teapot/controller/build.rb +71 -0
- data/lib/teapot/controller/clean.rb +35 -0
- data/lib/teapot/controller/create.rb +52 -0
- data/lib/teapot/controller/fetch.rb +167 -0
- data/lib/teapot/controller/generate.rb +40 -0
- data/lib/teapot/controller/list.rb +79 -0
- data/lib/teapot/definition.rb +61 -0
- data/lib/teapot/dependency.rb +1 -1
- data/lib/teapot/generator.rb +109 -0
- data/lib/teapot/loader.rb +135 -0
- data/lib/teapot/name.rb +37 -0
- data/lib/teapot/package.rb +109 -0
- data/lib/teapot/target.rb +14 -25
- data/lib/teapot/version.rb +1 -1
- data/teapot.gemspec +6 -1
- data/test/teapot.rb +33 -0
- data/test/{test_config.rb → test_teapot.rb} +12 -9
- metadata +23 -25
- data/lib/teapot/config.rb +0 -164
@@ -0,0 +1,109 @@
|
|
1
|
+
# Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
require 'pathname'
|
22
|
+
|
23
|
+
require 'teapot/context'
|
24
|
+
require 'teapot/environment'
|
25
|
+
require 'teapot/commands'
|
26
|
+
|
27
|
+
require 'teapot/definition'
|
28
|
+
|
29
|
+
module Teapot
|
30
|
+
class Package
|
31
|
+
def initialize(path, name, options = {})
|
32
|
+
# The path where the package is (or will be) located:
|
33
|
+
@path = path
|
34
|
+
|
35
|
+
# Get the name of the package from the options, if provided:
|
36
|
+
if options[:name]
|
37
|
+
@name = options[:name]
|
38
|
+
end
|
39
|
+
|
40
|
+
if Symbol === name
|
41
|
+
# If the name argument was symbolic, we convert it into a string, and use it for both the uri and the name itself:
|
42
|
+
@uri = name.to_s
|
43
|
+
@name ||= @uri
|
44
|
+
else
|
45
|
+
# Otherwise, we assume a path may have been given, and use that instead:
|
46
|
+
@name ||= File.basename(name)
|
47
|
+
@uri = name
|
48
|
+
end
|
49
|
+
|
50
|
+
# Copy the options provided:
|
51
|
+
@options = options
|
52
|
+
end
|
53
|
+
|
54
|
+
attr :name
|
55
|
+
attr :path
|
56
|
+
|
57
|
+
attr :uri
|
58
|
+
attr :options, true
|
59
|
+
|
60
|
+
def local?
|
61
|
+
@options.key? :local
|
62
|
+
end
|
63
|
+
|
64
|
+
def external?
|
65
|
+
@options.key? :source
|
66
|
+
end
|
67
|
+
|
68
|
+
def external_url(relative_root)
|
69
|
+
base_uri = URI(@options[:source].to_s)
|
70
|
+
|
71
|
+
if base_uri.scheme == nil || base_uri.scheme == 'file'
|
72
|
+
base_uri = URI "file://" + File.expand_path(base_uri.path, relative_root) + "/"
|
73
|
+
end
|
74
|
+
|
75
|
+
return relative_url(base_uri)
|
76
|
+
end
|
77
|
+
|
78
|
+
def to_s
|
79
|
+
"<#{self.class.name} #{@name.dump} path=#{path}>"
|
80
|
+
end
|
81
|
+
|
82
|
+
# Package may be used as hash key / in a set:
|
83
|
+
|
84
|
+
def hash
|
85
|
+
@path.hash
|
86
|
+
end
|
87
|
+
|
88
|
+
def eql?(other)
|
89
|
+
@path.eql?(other.path)
|
90
|
+
end
|
91
|
+
|
92
|
+
private
|
93
|
+
|
94
|
+
def relative_url(base_uri)
|
95
|
+
source_uri = URI(@uri)
|
96
|
+
|
97
|
+
unless source_uri.absolute?
|
98
|
+
source_uri = base_uri + source_uri
|
99
|
+
end
|
100
|
+
|
101
|
+
# Git can't handle the default formatting that Ruby uses for file URIs.
|
102
|
+
if source_uri.scheme == "file"
|
103
|
+
source_uri = "file://" + source_uri.path
|
104
|
+
end
|
105
|
+
|
106
|
+
return source_uri
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
data/lib/teapot/target.rb
CHANGED
@@ -21,48 +21,41 @@
|
|
21
21
|
require 'pathname'
|
22
22
|
require 'teapot/build'
|
23
23
|
require 'teapot/dependency'
|
24
|
+
require 'teapot/definition'
|
24
25
|
|
25
26
|
module Teapot
|
26
27
|
class BuildError < StandardError
|
27
28
|
end
|
28
29
|
|
29
|
-
class Target
|
30
|
+
class Target < Definition
|
30
31
|
include Dependency
|
31
32
|
|
32
33
|
def initialize(context, package, name)
|
33
|
-
|
34
|
-
@package = package
|
34
|
+
super context, package, name
|
35
35
|
|
36
|
-
@
|
37
|
-
|
38
|
-
@install = nil
|
39
|
-
|
40
|
-
@path = @package.path
|
36
|
+
@build = nil
|
41
37
|
end
|
42
38
|
|
43
|
-
attr :context
|
44
|
-
attr :package
|
45
|
-
attr :name
|
46
|
-
|
47
|
-
attr :path
|
48
|
-
|
49
39
|
def builder
|
50
40
|
Build.top(@path)
|
51
41
|
end
|
52
42
|
|
53
|
-
def
|
54
|
-
@
|
43
|
+
def build(&block)
|
44
|
+
@build = Proc.new(&block)
|
55
45
|
end
|
56
46
|
|
57
|
-
def
|
58
|
-
return unless @
|
47
|
+
def build!(configuration, config = {})
|
48
|
+
return unless @build
|
49
|
+
|
50
|
+
# Reduce the number of keystrokes for good health:
|
51
|
+
context = configuration.context
|
59
52
|
|
60
53
|
chain = Dependency::chain(context.selection, dependencies, context.targets.values)
|
61
54
|
|
62
55
|
environments = []
|
63
56
|
|
64
57
|
# The base configuration environment:
|
65
|
-
environments <<
|
58
|
+
# environments << configuration.environment
|
66
59
|
|
67
60
|
# Calculate the dependency chain's ordered environments:
|
68
61
|
environments += chain.provisions.collect do |provision|
|
@@ -76,7 +69,7 @@ module Teapot
|
|
76
69
|
environment = Environment.combine(*environments)
|
77
70
|
|
78
71
|
local_build = environment.merge do
|
79
|
-
default platforms_path
|
72
|
+
default platforms_path configuration.platforms_path
|
80
73
|
default build_prefix {platforms_path + "cache/#{platform_name}-#{variant}"}
|
81
74
|
default install_prefix {platforms_path + "#{platform_name}-#{variant}"}
|
82
75
|
|
@@ -84,11 +77,7 @@ module Teapot
|
|
84
77
|
append linkflags {"-L#{install_prefix + "lib"}"}
|
85
78
|
end
|
86
79
|
|
87
|
-
@
|
88
|
-
end
|
89
|
-
|
90
|
-
def to_s
|
91
|
-
"<Target: #{@name}>"
|
80
|
+
@build.call(local_build)
|
92
81
|
end
|
93
82
|
end
|
94
83
|
end
|
data/lib/teapot/version.rb
CHANGED
data/teapot.gemspec
CHANGED
@@ -20,9 +20,14 @@ Gem::Specification.new do |gem|
|
|
20
20
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
21
21
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
22
22
|
gem.require_paths = ["lib"]
|
23
|
-
|
23
|
+
|
24
|
+
gem.required_ruby_version = '>= 1.9.3'
|
25
|
+
|
24
26
|
gem.add_dependency "rainbow"
|
25
27
|
gem.add_dependency "rexec"
|
26
28
|
gem.add_dependency "trollop"
|
27
29
|
gem.add_dependency "facter"
|
30
|
+
|
31
|
+
# This could be a good option in the future for teapot fetch:
|
32
|
+
#gem.add_dependency "rugged"
|
28
33
|
end
|
data/test/teapot.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# This file is part of the "Teapot" project, and is released under the MIT license.
|
4
|
+
#
|
5
|
+
|
6
|
+
required_version "0.7"
|
7
|
+
|
8
|
+
define_configuration 'test' do |configuration|
|
9
|
+
configuration.public!
|
10
|
+
|
11
|
+
configuration[:source] = "../dream-framework"
|
12
|
+
|
13
|
+
configuration.require "variants"
|
14
|
+
|
15
|
+
configuration.require "platform-darwin-osx"
|
16
|
+
configuration.require "platform-darwin-ios"
|
17
|
+
|
18
|
+
configuration.require "unit-test"
|
19
|
+
configuration.require "euclid"
|
20
|
+
|
21
|
+
configuration.require "ogg"
|
22
|
+
configuration.require "vorbis"
|
23
|
+
|
24
|
+
configuration.require "jpeg"
|
25
|
+
configuration.require "png"
|
26
|
+
|
27
|
+
configuration.require "freetype"
|
28
|
+
|
29
|
+
configuration.require "dream"
|
30
|
+
configuration.require "tagged-format"
|
31
|
+
|
32
|
+
configuration.require "opencv"
|
33
|
+
end
|
@@ -22,20 +22,23 @@ require 'pathname'
|
|
22
22
|
require 'test/unit'
|
23
23
|
require 'stringio'
|
24
24
|
|
25
|
-
require 'teapot/
|
25
|
+
require 'teapot/context'
|
26
26
|
|
27
27
|
class TestConfig < Test::Unit::TestCase
|
28
28
|
ROOT = Pathname.new(__FILE__).dirname
|
29
29
|
|
30
|
-
def
|
31
|
-
|
30
|
+
def test_context
|
31
|
+
context = Teapot::Context.new(ROOT)
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
package "png"
|
36
|
-
end
|
33
|
+
# There is one configuration:
|
34
|
+
assert_equal 1, context.configurations.count
|
37
35
|
|
38
|
-
|
39
|
-
assert_equal
|
36
|
+
# No targets were defined:
|
37
|
+
assert_equal 0, context.targets.count
|
38
|
+
|
39
|
+
default_configuration = context.default_configuration
|
40
|
+
|
41
|
+
# 13 defined packages + 1 implicit package.
|
42
|
+
assert_equal 14, default_configuration.packages.count
|
40
43
|
end
|
41
44
|
end
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teapot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.7.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Samuel Williams
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-03-24 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rainbow
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ! '>='
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ! '>='
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rexec
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ! '>='
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ! '>='
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,7 +41,6 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: trollop
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ! '>='
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ! '>='
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,7 +55,6 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: facter
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - ! '>='
|
68
60
|
- !ruby/object:Gem::Version
|
@@ -70,7 +62,6 @@ dependencies:
|
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - ! '>='
|
76
67
|
- !ruby/object:Gem::Version
|
@@ -105,8 +96,16 @@ files:
|
|
105
96
|
- lib/teapot/build/targets/files.rb
|
106
97
|
- lib/teapot/build/targets/library.rb
|
107
98
|
- lib/teapot/commands.rb
|
108
|
-
- lib/teapot/
|
99
|
+
- lib/teapot/configuration.rb
|
109
100
|
- lib/teapot/context.rb
|
101
|
+
- lib/teapot/controller.rb
|
102
|
+
- lib/teapot/controller/build.rb
|
103
|
+
- lib/teapot/controller/clean.rb
|
104
|
+
- lib/teapot/controller/create.rb
|
105
|
+
- lib/teapot/controller/fetch.rb
|
106
|
+
- lib/teapot/controller/generate.rb
|
107
|
+
- lib/teapot/controller/list.rb
|
108
|
+
- lib/teapot/definition.rb
|
110
109
|
- lib/teapot/dependency.rb
|
111
110
|
- lib/teapot/environment.rb
|
112
111
|
- lib/teapot/environment/base.rb
|
@@ -114,43 +113,42 @@ files:
|
|
114
113
|
- lib/teapot/environment/evaluator.rb
|
115
114
|
- lib/teapot/environment/flatten.rb
|
116
115
|
- lib/teapot/environment/system.rb
|
116
|
+
- lib/teapot/generator.rb
|
117
|
+
- lib/teapot/loader.rb
|
118
|
+
- lib/teapot/name.rb
|
119
|
+
- lib/teapot/package.rb
|
117
120
|
- lib/teapot/target.rb
|
118
121
|
- lib/teapot/version.rb
|
119
122
|
- teapot.gemspec
|
120
|
-
- test/
|
123
|
+
- test/teapot.rb
|
121
124
|
- test/test_dependency.rb
|
122
125
|
- test/test_environment.rb
|
126
|
+
- test/test_teapot.rb
|
123
127
|
homepage: ''
|
124
128
|
licenses: []
|
129
|
+
metadata: {}
|
125
130
|
post_install_message:
|
126
131
|
rdoc_options: []
|
127
132
|
require_paths:
|
128
133
|
- lib
|
129
134
|
required_ruby_version: !ruby/object:Gem::Requirement
|
130
|
-
none: false
|
131
135
|
requirements:
|
132
136
|
- - ! '>='
|
133
137
|
- !ruby/object:Gem::Version
|
134
|
-
version:
|
135
|
-
segments:
|
136
|
-
- 0
|
137
|
-
hash: -3435379409085677514
|
138
|
+
version: 1.9.3
|
138
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
-
none: false
|
140
140
|
requirements:
|
141
141
|
- - ! '>='
|
142
142
|
- !ruby/object:Gem::Version
|
143
143
|
version: '0'
|
144
|
-
segments:
|
145
|
-
- 0
|
146
|
-
hash: -3435379409085677514
|
147
144
|
requirements: []
|
148
145
|
rubyforge_project:
|
149
|
-
rubygems_version:
|
146
|
+
rubygems_version: 2.0.2
|
150
147
|
signing_key:
|
151
|
-
specification_version:
|
148
|
+
specification_version: 4
|
152
149
|
summary: Teapot is a tool for managing complex cross-platform builds.
|
153
150
|
test_files:
|
154
|
-
- test/
|
151
|
+
- test/teapot.rb
|
155
152
|
- test/test_dependency.rb
|
156
153
|
- test/test_environment.rb
|
154
|
+
- test/test_teapot.rb
|
data/lib/teapot/config.rb
DELETED
@@ -1,164 +0,0 @@
|
|
1
|
-
# Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
-
#
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
# of this software and associated documentation files (the "Software"), to deal
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
20
|
-
|
21
|
-
require 'pathname'
|
22
|
-
|
23
|
-
require 'teapot/context'
|
24
|
-
require 'teapot/environment'
|
25
|
-
require 'teapot/commands'
|
26
|
-
|
27
|
-
module Teapot
|
28
|
-
class Config
|
29
|
-
include Dependency
|
30
|
-
|
31
|
-
class Package
|
32
|
-
def initialize(config, name, options = {})
|
33
|
-
@config = config
|
34
|
-
|
35
|
-
if options[:name]
|
36
|
-
@name = options[:name]
|
37
|
-
end
|
38
|
-
|
39
|
-
if Symbol === name
|
40
|
-
@uri = name.to_s
|
41
|
-
@name ||= @uri
|
42
|
-
else
|
43
|
-
@name ||= File.basename(name)
|
44
|
-
@uri = name
|
45
|
-
end
|
46
|
-
|
47
|
-
@options = options
|
48
|
-
@global = Environment.new
|
49
|
-
end
|
50
|
-
|
51
|
-
attr :name
|
52
|
-
attr :uri
|
53
|
-
attr :options
|
54
|
-
attr :global
|
55
|
-
|
56
|
-
def relative_url(base_uri)
|
57
|
-
source_uri = URI(@uri)
|
58
|
-
|
59
|
-
unless source_uri.absolute?
|
60
|
-
source_uri = base_uri + source_uri
|
61
|
-
end
|
62
|
-
|
63
|
-
# Git can't handle the default formatting that Ruby uses for file URIs.
|
64
|
-
if source_uri.scheme == "file"
|
65
|
-
source_uri = "file://" + source_uri.path
|
66
|
-
end
|
67
|
-
|
68
|
-
return source_uri
|
69
|
-
end
|
70
|
-
|
71
|
-
def local?
|
72
|
-
@options.key? :local
|
73
|
-
end
|
74
|
-
|
75
|
-
def loader_path
|
76
|
-
"teapot.rb"
|
77
|
-
end
|
78
|
-
|
79
|
-
def path
|
80
|
-
@config.packages_path + @name
|
81
|
-
end
|
82
|
-
|
83
|
-
def to_s
|
84
|
-
"<#{@name}>"
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
def initialize(root, options = {})
|
89
|
-
@root = Pathname.new(root)
|
90
|
-
@options = options
|
91
|
-
|
92
|
-
@packages = []
|
93
|
-
|
94
|
-
@environment = Environment.new
|
95
|
-
end
|
96
|
-
|
97
|
-
def name
|
98
|
-
:config
|
99
|
-
end
|
100
|
-
|
101
|
-
attr :root
|
102
|
-
attr :packages
|
103
|
-
attr :options
|
104
|
-
|
105
|
-
attr :environment
|
106
|
-
|
107
|
-
def packages_path
|
108
|
-
@root + (@options[:packages_path] || "packages")
|
109
|
-
end
|
110
|
-
|
111
|
-
def platforms_path
|
112
|
-
@root + (@options[:platforms_path] || "platforms")
|
113
|
-
end
|
114
|
-
|
115
|
-
def host(*args, &block)
|
116
|
-
name = @options[:host_platform] || RUBY_PLATFORM
|
117
|
-
|
118
|
-
if block_given?
|
119
|
-
if args.find{|arg| arg === name}
|
120
|
-
yield
|
121
|
-
end
|
122
|
-
else
|
123
|
-
name
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
attr :options
|
128
|
-
attr :packages
|
129
|
-
|
130
|
-
def source(path)
|
131
|
-
@options[:source] = path
|
132
|
-
end
|
133
|
-
|
134
|
-
def package(name, options = {})
|
135
|
-
@packages << Package.new(self, name, options)
|
136
|
-
end
|
137
|
-
|
138
|
-
def load(teapot_path)
|
139
|
-
instance_eval File.read(teapot_path), teapot_path
|
140
|
-
end
|
141
|
-
|
142
|
-
def self.load(root, options = {})
|
143
|
-
config = new(root, options)
|
144
|
-
|
145
|
-
yield config if block_given?
|
146
|
-
|
147
|
-
teapot_path = File.join(root, "Teapot")
|
148
|
-
config.load(teapot_path) if File.exist? teapot_path
|
149
|
-
|
150
|
-
return config
|
151
|
-
end
|
152
|
-
|
153
|
-
def self.load_default(root = Dir.getwd, options = {})
|
154
|
-
# Load project specific Teapot file
|
155
|
-
load(root, options) do |config|
|
156
|
-
user_path = File.expand_path("~/.Teapot")
|
157
|
-
|
158
|
-
if File.exist? user_path
|
159
|
-
config.load(user_path)
|
160
|
-
end
|
161
|
-
end
|
162
|
-
end
|
163
|
-
end
|
164
|
-
end
|