bowler 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bowler/dependency_tree.rb +7 -6
- data/lib/bowler/version.rb +1 -1
- data/spec/dependency_tree_spec.rb +12 -0
- data/spec/dsl_spec.rb +1 -0
- data/spec/fixtures/dependency_tree_pinfile +4 -1
- metadata +10 -10
@@ -13,18 +13,19 @@ module Bowler
|
|
13
13
|
@definition = definition
|
14
14
|
end
|
15
15
|
|
16
|
-
def dependencies_for(processes)
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
def dependencies_for(processes, visited = [])
|
17
|
+
return [] unless processes
|
18
|
+
(processes - visited).map { |p|
|
19
|
+
[dependencies_for(@definition.tree[p], visited + [p]), p]
|
20
|
+
}.flatten.compact.uniq
|
20
21
|
end
|
21
22
|
|
22
23
|
def process_list_for(processes)
|
23
24
|
on = dependencies_for(processes)
|
24
|
-
off = @definition.processes
|
25
|
+
off = @definition.processes - on
|
25
26
|
|
26
27
|
[ on.map {|x| "#{x}=1" }, off.map {|x| "#{x}=0" } ].flatten.sort.join(',')
|
27
28
|
end
|
28
29
|
|
29
30
|
end
|
30
|
-
end
|
31
|
+
end
|
data/lib/bowler/version.rb
CHANGED
@@ -15,6 +15,18 @@ module Bowler
|
|
15
15
|
tree.dependencies_for([:foo]).should =~ [:bar, :foo, :required]
|
16
16
|
tree.dependencies_for([:nyan]).should =~ [:bar, :foo, :nyan, :required]
|
17
17
|
end
|
18
|
+
|
19
|
+
it "should find the dependencies of dependencies" do
|
20
|
+
tree = DependencyTree.load File.join( File.dirname(__FILE__), 'fixtures', 'dependency_tree_pinfile' )
|
21
|
+
|
22
|
+
tree.dependencies_for([:cat]).should =~ [:cat, :nyan, :bar, :foo, :required]
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should correctly handle recursive dependencies" do
|
26
|
+
tree = DependencyTree.load File.join( File.dirname(__FILE__), 'fixtures', 'dependency_tree_pinfile' )
|
27
|
+
|
28
|
+
tree.dependencies_for([:loop1]).should =~ [:loop1, :loop2, :required]
|
29
|
+
end
|
18
30
|
end
|
19
31
|
|
20
32
|
context "given an array of one process" do
|
data/spec/dsl_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bowler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-04-16 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: foreman
|
16
|
-
requirement: &
|
16
|
+
requirement: &70208968322280 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70208968322280
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70208968321020 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.9.2.2
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70208968321020
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70208968319640 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: 2.8.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70208968319640
|
47
47
|
description:
|
48
48
|
email:
|
49
49
|
- jordan@jordanh.net
|
@@ -80,7 +80,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
80
80
|
version: '0'
|
81
81
|
segments:
|
82
82
|
- 0
|
83
|
-
hash: -
|
83
|
+
hash: -4084858017591319005
|
84
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
85
|
none: false
|
86
86
|
requirements:
|
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
89
|
version: '0'
|
90
90
|
segments:
|
91
91
|
- 0
|
92
|
-
hash: -
|
92
|
+
hash: -4084858017591319005
|
93
93
|
requirements: []
|
94
94
|
rubyforge_project:
|
95
95
|
rubygems_version: 1.8.12
|