teapot 0.9.8 → 0.9.9
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/bin/teapot +6 -0
- data/lib/teapot/controller/visualize.rb +102 -0
- data/lib/teapot/version.rb +1 -1
- data/teapot.gemspec +2 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 09184fb53086c06b569d1d5bdb3467f279213cfe
|
4
|
+
data.tar.gz: c279be319f6eef1eabc954c201b5f2f2f7eee777
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acecea7259829609c6507a2d2d095d6d838c307846be48e41b824153b02861ce943451ecaaa844364045c429c957aa096d3bfb04887a3a3c0255b2af0251b5dc
|
7
|
+
data.tar.gz: 446c2438293e98666bf2a6c59094c2fa1b747f8107c218a9672387eca40d07f52d2d547262f2f213dbb24cfe2fe5fdafcee2081d26e65020310491ce4e224444
|
data/bin/teapot
CHANGED
@@ -28,6 +28,8 @@ require 'teapot/controller/fetch'
|
|
28
28
|
require 'teapot/controller/generate'
|
29
29
|
require 'teapot/controller/list'
|
30
30
|
require 'teapot/controller/run'
|
31
|
+
require 'teapot/controller/visualize'
|
32
|
+
|
31
33
|
require 'teapot/repository'
|
32
34
|
|
33
35
|
require 'time'
|
@@ -74,6 +76,10 @@ module Application
|
|
74
76
|
make_controller.list
|
75
77
|
end
|
76
78
|
|
79
|
+
def self.visualize(targets = ARGV)
|
80
|
+
make_controller.visualize(targets)
|
81
|
+
end
|
82
|
+
|
77
83
|
def self.create
|
78
84
|
project_name = ARGV.shift
|
79
85
|
project_directory = project_name.gsub(/\s+/, '-').downcase
|
@@ -0,0 +1,102 @@
|
|
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 'teapot/controller'
|
22
|
+
|
23
|
+
require 'graphviz'
|
24
|
+
require 'yaml'
|
25
|
+
|
26
|
+
module Teapot
|
27
|
+
class Controller
|
28
|
+
def visualize(dependency_names = [])
|
29
|
+
configuration = context.configuration
|
30
|
+
|
31
|
+
chain = context.dependency_chain(dependency_names, context.configuration)
|
32
|
+
|
33
|
+
g = Graphviz::Graph.new
|
34
|
+
g.attributes[:ratio] = :auto
|
35
|
+
|
36
|
+
base_attributes = {
|
37
|
+
:shape => 'box',
|
38
|
+
}
|
39
|
+
|
40
|
+
provision_attributes = base_attributes.dup
|
41
|
+
|
42
|
+
alias_attributes = {
|
43
|
+
:shape => 'box',
|
44
|
+
:color => 'grey',
|
45
|
+
}
|
46
|
+
|
47
|
+
chain.ordered.each do |(provider, name)|
|
48
|
+
# Provider is the target that provides the dependency referred to by name.
|
49
|
+
node = g.add_node(name.to_s, base_attributes.dup)
|
50
|
+
|
51
|
+
if chain.dependencies.include?(name)
|
52
|
+
node.attributes[:color] = 'blue'
|
53
|
+
node.attributes[:penwidth] = 2.0
|
54
|
+
elsif chain.selection.include?(provider.name)
|
55
|
+
node.attributes[:color] = 'brown'
|
56
|
+
end
|
57
|
+
|
58
|
+
# A provision has dependencies...
|
59
|
+
provider.dependencies.each do |dependency|
|
60
|
+
dependency_node = g.nodes[dependency.to_s]
|
61
|
+
|
62
|
+
node.connect(dependency_node) if dependency_node
|
63
|
+
end
|
64
|
+
|
65
|
+
# A provision provides other provisions...
|
66
|
+
provider.provisions.each do |(provision_name, provision)|
|
67
|
+
next if name == provision_name
|
68
|
+
|
69
|
+
provides_node = g.nodes[provision_name.to_s] || g.add_node(provision_name.to_s, provision_attributes)
|
70
|
+
|
71
|
+
if Dependency::Alias === provision
|
72
|
+
provides_node.attributes = alias_attributes
|
73
|
+
end
|
74
|
+
|
75
|
+
unless provides_node.connected?(node)
|
76
|
+
edge = provides_node.connect(node)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# Put all dependencies at the same level so as to not make the graph too confusing.
|
82
|
+
done = Set.new
|
83
|
+
chain.ordered.each do |(provider, name)|
|
84
|
+
p = g.graphs[provider.name] || g.add_subgraph(provider.name, :rank => :same)
|
85
|
+
|
86
|
+
provider.dependencies.each do |dependency|
|
87
|
+
next if done.include? dependency
|
88
|
+
|
89
|
+
done << dependency
|
90
|
+
|
91
|
+
dependency_node = g.nodes[dependency.to_s]
|
92
|
+
|
93
|
+
p.add_node(dependency_node.name)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# Graphviz::output(g, :path => "graph.pdf")
|
98
|
+
|
99
|
+
puts g.to_dot
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
data/lib/teapot/version.rb
CHANGED
data/teapot.gemspec
CHANGED
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: 0.9.
|
4
|
+
version: 0.9.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: graphviz
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
description: "\tTeapot is a tool for managing complex cross-platform builds. It provides\n\tadvanced
|
70
84
|
dependency management via the Teapot file and is supported by\n\tthe infusions ecosystem
|
71
85
|
of packages and platform tooling.\n"
|
@@ -107,6 +121,7 @@ files:
|
|
107
121
|
- lib/teapot/controller/generate.rb
|
108
122
|
- lib/teapot/controller/list.rb
|
109
123
|
- lib/teapot/controller/run.rb
|
124
|
+
- lib/teapot/controller/visualize.rb
|
110
125
|
- lib/teapot/definition.rb
|
111
126
|
- lib/teapot/dependency.rb
|
112
127
|
- lib/teapot/environment.rb
|