chef_cap 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,29 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
2
+
3
+ describe ChefDnaParser do
4
+ describe ".load_dna" do
5
+
6
+ it "parses test dna with ERB" do
7
+ ChefDnaParser.test_dna = <<-JS
8
+ {
9
+ "some_key": "some_value <%= ENV['HOME'] %>"
10
+ }
11
+ JS
12
+
13
+ ChefDnaParser.load_dna
14
+ ChefDnaParser.parsed.should_not be_nil
15
+ ChefDnaParser.parsed["some_key"].should_not be_nil
16
+ ChefDnaParser.parsed["some_key"].should == "some_value #{ENV['HOME']}"
17
+ end
18
+
19
+ it "parses dna from file using environment variable" do
20
+ ENV["DNA"] = File.expand_path(File.join(File.dirname(__FILE__), "..", "fixtures", "parser.json"))
21
+ ChefDnaParser.load_dna
22
+ ChefDnaParser.parsed.should_not be_nil
23
+ ChefDnaParser.parsed["from_file_key"].should_not be_nil
24
+ ChefDnaParser.parsed["from_file_key"].should == "from_file_value"
25
+ end
26
+
27
+ end
28
+
29
+ end
@@ -0,0 +1,45 @@
1
+ require "rubygems"
2
+ require "rspec"
3
+ require "json"
4
+
5
+ require File.expand_path(File.join(File.dirname(__FILE__), "..", "recipes", "lib", "chef_dna_parser"))
6
+ require File.expand_path(File.join(File.dirname(__FILE__), "..", "recipes", "lib", "chef_cap_helper"))
7
+ require File.expand_path(File.join(File.dirname(__FILE__), "..", "recipes", "lib", "chef_cap_configuration"))
8
+
9
+ class TestCapConfiguration < Object; attr_accessor :test_dna, :tasks; end
10
+ class TestCapSession < Object; end
11
+ class TestCapRole < Object; end
12
+ class TestCapServer < Struct.new(:host); end
13
+ class TestCapMockNamespace < Object; attr_accessor :configuration; end
14
+
15
+ class FakeChefCapConfiguration
16
+
17
+ def self.create(dna)
18
+ chef_cap_file = File.join(File.dirname(__FILE__), "..", "recipes", "chef_cap.rb")
19
+ chef_cap_mock_file = File.join(File.dirname(__FILE__), "chef_cap_mock_cap.rb")
20
+
21
+ fake_configuration = TestCapConfiguration.new
22
+ ChefDnaParser.test_dna = dna
23
+ fake_configuration.instance_eval(File.read(chef_cap_mock_file), chef_cap_mock_file)
24
+
25
+ Dir[File.join(File.dirname(__FILE__), "..", "recipes", "*.rb")].each do |file|
26
+ fake_configuration.instance_eval(File.read(file), file)
27
+ end
28
+ fake_configuration.tasks.each do |task_name, the_proc|
29
+ fake_configuration.class.class_eval do
30
+ define_method task_name.to_sym do
31
+ the_proc.call
32
+ end
33
+ end
34
+ end
35
+ fake_configuration
36
+ end
37
+
38
+ end
39
+
40
+ RSpec.configure do |config|
41
+ config.mock_with :rspec
42
+ config.after :each do
43
+ ChefDnaParser.test_dna = nil
44
+ end
45
+ end
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: chef_cap
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 5
9
+ version: 0.0.5
10
+ platform: ruby
11
+ authors:
12
+ - Case Commons, LLC
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-01-19 00:00:00 -05:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: capistrano
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 2
30
+ - 5
31
+ - 5
32
+ version: 2.5.5
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ description: chef_cap uses chef"s JSON config format to drive both capistrano and chef-solo"
36
+ email:
37
+ - casecommons-dev@googlegroups.com
38
+ executables: []
39
+
40
+ extensions: []
41
+
42
+ extra_rdoc_files: []
43
+
44
+ files:
45
+ - .gitignore
46
+ - .rspec
47
+ - .rvmrc
48
+ - Gemfile
49
+ - Gemfile.lock
50
+ - LICENSE
51
+ - README.rdoc
52
+ - Rakefile
53
+ - chef_cap.gemspec
54
+ - fixtures/parser.json
55
+ - fixtures/ssh_deploy_key
56
+ - fixtures/ssh_public_key
57
+ - init.rb
58
+ - lib/chef_cap.rb
59
+ - lib/chef_cap/tasks.rb
60
+ - lib/chef_cap/version.rb
61
+ - lib/generators/chef_cap/install_generator.rb
62
+ - lib/generators/chef_cap/templates/Capfile
63
+ - lib/generators/chef_cap/templates/chef/cookbooks/gems/recipes/default.rb
64
+ - lib/generators/chef_cap/templates/chef/node.json
65
+ - recipes/chef_cap.rb
66
+ - recipes/cook.rb
67
+ - recipes/lib/chef_cap_configuration.rb
68
+ - recipes/lib/chef_cap_helper.rb
69
+ - recipes/lib/chef_cap_initializer.rb
70
+ - recipes/lib/chef_dna_parser.rb
71
+ - recipes/rvm_bootstrap.rb
72
+ - recipes/unset_default_deploy.rb
73
+ - spec/chef_cap_configuration_spec.rb
74
+ - spec/chef_cap_helper_spec.rb
75
+ - spec/chef_cap_mock_cap.rb
76
+ - spec/chef_cap_spec.rb
77
+ - spec/chef_dna_parser_spec.rb
78
+ - spec/spec_helper.rb
79
+ has_rdoc: true
80
+ homepage: https://github.com/Casecommons/chef_cap
81
+ licenses:
82
+ - MIT
83
+ post_install_message:
84
+ rdoc_options: []
85
+
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ segments:
94
+ - 0
95
+ version: "0"
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ segments:
102
+ - 0
103
+ version: "0"
104
+ requirements: []
105
+
106
+ rubyforge_project:
107
+ rubygems_version: 1.3.7
108
+ signing_key:
109
+ specification_version: 3
110
+ summary: capistrano + chef-solo == chef_cap"
111
+ test_files:
112
+ - spec/chef_cap_configuration_spec.rb
113
+ - spec/chef_cap_helper_spec.rb
114
+ - spec/chef_cap_mock_cap.rb
115
+ - spec/chef_cap_spec.rb
116
+ - spec/chef_dna_parser_spec.rb
117
+ - spec/spec_helper.rb