teapot 1.0.1 → 1.0.2
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 +4 -4
- data/lib/teapot/context.rb +2 -2
- data/lib/teapot/controller/build.rb +35 -8
- data/lib/teapot/version.rb +1 -1
- data/spec/teapot/target_spec.rb +1 -2
- data/spec/teapot/wait_spec.rb +55 -0
- data/spec/teapot/wait_spec/teapot.rb +41 -0
- data/teapot.gemspec +1 -1
- metadata +9 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 82c11fa3631f5f64272f82742fc2e2a605915050
|
|
4
|
+
data.tar.gz: 482fc59f950b17490993fa10561290beb0963369
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c817753effc821940fc78ec441d4534414392e59c34f6d1ce3c8ad28d64941ca25bd257d1095545a965b37b7a8f7b6f470ce8fcaa59e2adcf674a41bd6ec9e8e
|
|
7
|
+
data.tar.gz: 4fc45e4498e1ac51e42cc9bed6fca53c6629af3dac8c3edb537d8a62faa425a0f9b91030020e76b0347fd16424e2e94aafb4ade7759c3cd57b909f556aa7223f
|
data/lib/teapot/context.rb
CHANGED
|
@@ -21,18 +21,49 @@
|
|
|
21
21
|
require 'teapot/controller'
|
|
22
22
|
require 'build/controller'
|
|
23
23
|
|
|
24
|
-
$TEAPOT_DEBUG_GRAPH = false
|
|
25
24
|
|
|
26
25
|
module Teapot
|
|
27
26
|
class Controller
|
|
28
27
|
class BuildFailedError < StandardError
|
|
29
28
|
end
|
|
30
29
|
|
|
30
|
+
def show_dependencies(walker)
|
|
31
|
+
outputs = {}
|
|
32
|
+
|
|
33
|
+
walker.tasks.each do |node, task|
|
|
34
|
+
# puts "Task #{task} (#{node}) outputs:"
|
|
35
|
+
|
|
36
|
+
task.outputs.each do |path|
|
|
37
|
+
path = path.to_s
|
|
38
|
+
|
|
39
|
+
# puts "\t#{path}"
|
|
40
|
+
|
|
41
|
+
outputs[path] = task
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
walker.tasks.each do |node, task|
|
|
46
|
+
dependencies = {}
|
|
47
|
+
task.inputs.each do |path|
|
|
48
|
+
path = path.to_s
|
|
49
|
+
|
|
50
|
+
if generating_task = outputs[path]
|
|
51
|
+
dependencies[path] = generating_task
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
puts "Task #{task.inspect} has #{dependencies.count} dependencies."
|
|
56
|
+
dependencies.each do |path, task|
|
|
57
|
+
puts "\t#{task.inspect}: #{path}"
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
31
62
|
def build(dependency_names)
|
|
32
63
|
chain = context.dependency_chain(dependency_names, context.configuration)
|
|
33
|
-
|
|
64
|
+
|
|
34
65
|
ordered = chain.ordered
|
|
35
|
-
|
|
66
|
+
|
|
36
67
|
if @options[:only]
|
|
37
68
|
ordered = context.direct_targets(ordered)
|
|
38
69
|
end
|
|
@@ -54,11 +85,7 @@ module Teapot
|
|
|
54
85
|
# We need to catch interrupt here, and exit with the correct exit code:
|
|
55
86
|
begin
|
|
56
87
|
controller.run do |walker|
|
|
57
|
-
|
|
58
|
-
controller.nodes.each do |key, node|
|
|
59
|
-
puts "#{node.status} #{node.inspect}" unless node.clean?
|
|
60
|
-
end
|
|
61
|
-
end
|
|
88
|
+
show_dependencies(walker)
|
|
62
89
|
|
|
63
90
|
# Only run once is asked:
|
|
64
91
|
unless @options[:continuous]
|
data/lib/teapot/version.rb
CHANGED
data/spec/teapot/target_spec.rb
CHANGED
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
# THE SOFTWARE.
|
|
20
20
|
|
|
21
21
|
require 'teapot/context'
|
|
22
|
-
require 'pry'
|
|
23
22
|
|
|
24
23
|
module Teapot::TargetSpec
|
|
25
24
|
ROOT = Build::Files::Path.new(__dir__) + "target_spec"
|
|
@@ -29,7 +28,7 @@ module Teapot::TargetSpec
|
|
|
29
28
|
context = Teapot::Context.new(ROOT)
|
|
30
29
|
|
|
31
30
|
target = context.targets['target_spec']
|
|
32
|
-
expect(target).to_not be nil
|
|
31
|
+
expect(target).to_not be == nil
|
|
33
32
|
|
|
34
33
|
chain = context.dependency_chain(["Test/TargetSpec"])
|
|
35
34
|
expect(chain.providers.size).to be == 4
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Copyright, 2016, 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 'teapot/context'
|
|
22
|
+
require 'build/controller'
|
|
23
|
+
|
|
24
|
+
module Teapot::WaitSpec
|
|
25
|
+
ROOT = Build::Files::Path.join(__dir__, "wait_spec")
|
|
26
|
+
|
|
27
|
+
describe Teapot::Target do
|
|
28
|
+
let(:logger) {Logger.new($stdout).tap{|logger| logger.level = Logger::DEBUG; logger.formatter = Build::CompactFormatter.new}}
|
|
29
|
+
|
|
30
|
+
it "should wait on completion of dependent targets" do
|
|
31
|
+
context = Teapot::Context.new(ROOT)
|
|
32
|
+
|
|
33
|
+
a, b, c = context.targets.values_at('A', 'B', 'C')
|
|
34
|
+
|
|
35
|
+
chain = context.dependency_chain(["Teapot/C"])
|
|
36
|
+
ordered = chain.ordered
|
|
37
|
+
|
|
38
|
+
controller = Build::Controller.new(logger: logger) do |controller|
|
|
39
|
+
ordered.each do |resolution|
|
|
40
|
+
target = resolution.provider
|
|
41
|
+
|
|
42
|
+
environment = target.environment(context.configuration)
|
|
43
|
+
|
|
44
|
+
if target.build
|
|
45
|
+
controller.add_target(target, environment.flatten)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
controller.update
|
|
51
|
+
|
|
52
|
+
puts $log
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
teapot_version "1.0"
|
|
3
|
+
|
|
4
|
+
$log = []
|
|
5
|
+
|
|
6
|
+
define_target "A" do |target|
|
|
7
|
+
target.build do
|
|
8
|
+
$log << :a_enter
|
|
9
|
+
run! "sleep 1"
|
|
10
|
+
$log << :a_exit
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
target.provides "Teapot/A"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
define_target "B" do |target|
|
|
17
|
+
target.build do
|
|
18
|
+
$log << :b_enter
|
|
19
|
+
run! "sleep 1"
|
|
20
|
+
$log << :b_exit
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
target.provides "Teapot/B"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
define_target "C" do |target|
|
|
27
|
+
target.build do
|
|
28
|
+
$log << :c_enter
|
|
29
|
+
# This should not execute until A and B have completed.
|
|
30
|
+
run! "sleep 1"
|
|
31
|
+
$log << :c_exit
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
target.depends "Teapot/A"
|
|
35
|
+
target.depends "Teapot/B"
|
|
36
|
+
|
|
37
|
+
target.provides "Teapot/C"
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
define_configuration "wait_spec" do |configuration|
|
|
41
|
+
end
|
data/teapot.gemspec
CHANGED
|
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
|
|
|
35
35
|
|
|
36
36
|
spec.add_dependency "graphviz", "~> 0.2.0"
|
|
37
37
|
|
|
38
|
-
spec.add_dependency "build", "~> 1.0.
|
|
38
|
+
spec.add_dependency "build", "~> 1.0.6"
|
|
39
39
|
|
|
40
40
|
# This could be a good option in the future for teapot fetch:
|
|
41
41
|
#spec.add_dependency "rugged"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: teapot
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Samuel Williams
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-02-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rainbow
|
|
@@ -72,14 +72,14 @@ dependencies:
|
|
|
72
72
|
requirements:
|
|
73
73
|
- - "~>"
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: 1.0.
|
|
75
|
+
version: 1.0.6
|
|
76
76
|
type: :runtime
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
80
|
- - "~>"
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: 1.0.
|
|
82
|
+
version: 1.0.6
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
84
|
name: bundler
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -182,6 +182,8 @@ files:
|
|
|
182
182
|
- spec/teapot/substitutions_spec.rb
|
|
183
183
|
- spec/teapot/target_spec.rb
|
|
184
184
|
- spec/teapot/target_spec/teapot.rb
|
|
185
|
+
- spec/teapot/wait_spec.rb
|
|
186
|
+
- spec/teapot/wait_spec/teapot.rb
|
|
185
187
|
- teapot.gemspec
|
|
186
188
|
homepage: http://www.teapot.nz
|
|
187
189
|
licenses:
|
|
@@ -203,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
203
205
|
version: '0'
|
|
204
206
|
requirements: []
|
|
205
207
|
rubyforge_project:
|
|
206
|
-
rubygems_version: 2.
|
|
208
|
+
rubygems_version: 2.5.1
|
|
207
209
|
signing_key:
|
|
208
210
|
specification_version: 4
|
|
209
211
|
summary: Teapot is a tool for managing complex cross-platform builds.
|
|
@@ -220,3 +222,5 @@ test_files:
|
|
|
220
222
|
- spec/teapot/substitutions_spec.rb
|
|
221
223
|
- spec/teapot/target_spec.rb
|
|
222
224
|
- spec/teapot/target_spec/teapot.rb
|
|
225
|
+
- spec/teapot/wait_spec.rb
|
|
226
|
+
- spec/teapot/wait_spec/teapot.rb
|