orca 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,61 @@
1
+ require_relative 'test_helper'
2
+
3
+ describe Orca::Resolver do
4
+ before :each do
5
+ @pkg_a = Orca::DSL.package('a') {}
6
+ @pkg_b = Orca::DSL.package('b') {}
7
+ @pkg_c = Orca::DSL.package('c') {}
8
+ @pkg_d = Orca::DSL.package('d') {}
9
+ end
10
+
11
+ after :each do
12
+ reset_package_index!
13
+ end
14
+
15
+ describe "resolving a tree of package dependancies" do
16
+ it "resolves single packages to a single package" do
17
+ resolver = Orca::Resolver.new(@pkg_a)
18
+ resolver.resolve
19
+ resolver.packages.must_equal [@pkg_a]
20
+ end
21
+
22
+ it "resolves a chain of 2 packages to a list of 2 packages" do
23
+ @pkg_a.depends_on(@pkg_b.name)
24
+ resolver = Orca::Resolver.new(@pkg_a)
25
+ resolver.resolve
26
+ resolver.packages.must_equal [@pkg_b, @pkg_a]
27
+ end
28
+
29
+ it "resolves a chain of 3 packages to a list of 3 packages" do
30
+ @pkg_a.depends_on(@pkg_b.name)
31
+ @pkg_b.depends_on(@pkg_c.name)
32
+ resolver = Orca::Resolver.new(@pkg_a)
33
+ resolver.resolve
34
+ resolver.packages.must_equal [@pkg_c, @pkg_b, @pkg_a]
35
+ end
36
+
37
+ it "resolves a tree of 3 packages to a list of 3 packages" do
38
+ @pkg_a.depends_on(@pkg_b.name)
39
+ @pkg_a.depends_on(@pkg_c.name)
40
+ resolver = Orca::Resolver.new(@pkg_a)
41
+ resolver.resolve
42
+ resolver.packages.must_equal [@pkg_b, @pkg_c, @pkg_a]
43
+ end
44
+
45
+ it "resolves a tree of 4 packages to a list of 4 packages" do
46
+ @pkg_a.depends_on(@pkg_b.name)
47
+ @pkg_a.depends_on(@pkg_c.name)
48
+ @pkg_c.depends_on(@pkg_d.name)
49
+ resolver = Orca::Resolver.new(@pkg_a)
50
+ resolver.resolve
51
+ resolver.packages.must_equal [@pkg_b, @pkg_d, @pkg_c, @pkg_a]
52
+ end
53
+
54
+ it "errors out on circular dependancies" do
55
+ @pkg_a.depends_on(@pkg_b.name)
56
+ @pkg_b.depends_on(@pkg_a.name)
57
+ resolver = Orca::Resolver.new(@pkg_a)
58
+ assert_raises(Orca::Resolver::CircularDependancyError) { resolver.resolve }
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,8 @@
1
+ gem 'minitest'
2
+ require 'minitest/autorun'
3
+ require 'mocha/setup'
4
+ require_relative '../lib/orca'
5
+
6
+ def reset_package_index!
7
+ Orca::PackageIndex.default.clear!
8
+ end
metadata ADDED
@@ -0,0 +1,150 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: orca
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Andy Kent
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-06-18 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: colored
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: net-ssh
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: net-sftp
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: thor
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ description: Orca is a super simple way to build and configure servers
79
+ email:
80
+ - andy.kent@me.com
81
+ executables:
82
+ - orca
83
+ extensions: []
84
+ extra_rdoc_files: []
85
+ files:
86
+ - .gitignore
87
+ - Gemfile
88
+ - Gemfile.lock
89
+ - LICENSE
90
+ - README.md
91
+ - Rakefile
92
+ - bin/orca
93
+ - config/template/files/.empty_directory
94
+ - config/template/orca.rb
95
+ - lib/orca.rb
96
+ - lib/orca/cli.rb
97
+ - lib/orca/dsl.rb
98
+ - lib/orca/execution_context.rb
99
+ - lib/orca/extensions/apt.rb
100
+ - lib/orca/extensions/file_sync.rb
101
+ - lib/orca/local_file.rb
102
+ - lib/orca/node.rb
103
+ - lib/orca/package.rb
104
+ - lib/orca/package_index.rb
105
+ - lib/orca/remote_file.rb
106
+ - lib/orca/resolver.rb
107
+ - lib/orca/runner.rb
108
+ - lib/orca/suite.rb
109
+ - orca.gemspec
110
+ - test/dsl_test.rb
111
+ - test/fixtures/example.txt
112
+ - test/local_file_test.rb
113
+ - test/package_index_test.rb
114
+ - test/package_test.rb
115
+ - test/remote_file_test.rb
116
+ - test/resolver_test.rb
117
+ - test/test_helper.rb
118
+ homepage: ''
119
+ licenses: []
120
+ post_install_message:
121
+ rdoc_options: []
122
+ require_paths:
123
+ - lib
124
+ required_ruby_version: !ruby/object:Gem::Requirement
125
+ none: false
126
+ requirements:
127
+ - - ! '>='
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ required_rubygems_version: !ruby/object:Gem::Requirement
131
+ none: false
132
+ requirements:
133
+ - - ! '>='
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ requirements: []
137
+ rubyforge_project:
138
+ rubygems_version: 1.8.23
139
+ signing_key:
140
+ specification_version: 3
141
+ summary: Simplified Machine Building
142
+ test_files:
143
+ - test/dsl_test.rb
144
+ - test/fixtures/example.txt
145
+ - test/local_file_test.rb
146
+ - test/package_index_test.rb
147
+ - test/package_test.rb
148
+ - test/remote_file_test.rb
149
+ - test/resolver_test.rb
150
+ - test/test_helper.rb