bocuse 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/bocuse +3 -1
- data/lib/bocuse/unit.rb +2 -1
- data/spec/integration/cli_spec.rb +5 -9
- data/spec/integration/complex_spec.rb +8 -1
- metadata +2 -2
data/bin/bocuse
CHANGED
@@ -11,7 +11,9 @@ class BocuseCLI < Thor
|
|
11
11
|
def compile(node_fqdn)
|
12
12
|
project = Bocuse::Project.new(Dir.pwd)
|
13
13
|
node_config = project.nodes[node_fqdn]
|
14
|
-
|
14
|
+
|
15
|
+
warn "Cannot find node description for node '#{node_fqdn}' in any file in config/nodes." or exit(1) unless node_config
|
16
|
+
|
15
17
|
puts MultiJson.encode node_config.to_h
|
16
18
|
end
|
17
19
|
end
|
data/lib/bocuse/unit.rb
CHANGED
@@ -21,8 +21,9 @@ module Bocuse
|
|
21
21
|
|
22
22
|
# Cook adds to the toplevel recipes of this file's configuration.
|
23
23
|
#
|
24
|
-
def cook recipe
|
24
|
+
def cook recipe, &block
|
25
25
|
current_configuration.recipes << recipe
|
26
|
+
current_configuration.send(recipe, &block)
|
26
27
|
end
|
27
28
|
|
28
29
|
# Make the given module a helper module for this node.
|
@@ -7,15 +7,11 @@ describe "CLI:" do
|
|
7
7
|
it "parses nodes and outputs a single nodes JSON" do
|
8
8
|
Dir.chdir File.expand_path('../../files/complex', __FILE__)
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
{
|
16
|
-
"recipes"=>["nginx", "git", "app::install", "app::deploy"],
|
17
|
-
"key_location" =>
|
18
|
-
"/Users/kschiess/git/own/bocuse/spec/files/complex/config/nodes/production/key.txt"}
|
10
|
+
compiled = MultiJson.load(`#{project_path('bin/bocuse')} \
|
11
|
+
compile complex.production.example.com`)
|
12
|
+
compiled.size.should == 3
|
13
|
+
compiled['recipes'].should == ['nginx', 'git', 'app::install', 'app::deploy'];
|
14
|
+
compiled['key_location'].should match(%r{spec/files/complex/config/nodes/production/key.txt$})
|
19
15
|
end
|
20
16
|
end
|
21
17
|
end
|
@@ -51,7 +51,14 @@ describe 'complex example with templates' do
|
|
51
51
|
find { |name, _| name == 'complex.production.example.com' }.
|
52
52
|
last
|
53
53
|
|
54
|
-
config.to_h[:recipes].should =~ %w(nginx git app::install app::deploy)
|
54
|
+
config.to_h[:recipes].should =~ %w(nginx git app::install app::deploy my_service)
|
55
55
|
end
|
56
|
+
it "configures my_service at the same time" do
|
57
|
+
config = project.nodes.
|
58
|
+
find { |name, _| name == 'complex.production.example.com' }.
|
59
|
+
last
|
60
|
+
|
61
|
+
config.to_h[:my_service].should == { :foo => 'bar' }
|
62
|
+
end
|
56
63
|
end
|
57
64
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bocuse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-
|
14
|
+
date: 2012-09-06 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rspec
|