chef-sugar 1.1.0 → 1.2.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/LICENSE +1 -1
  4. data/README.md +91 -1
  5. data/Rakefile +6 -0
  6. data/chef-extensions.gemspec +3 -6
  7. data/lib/chef/sugar.rb +5 -1
  8. data/lib/chef/sugar/architecture.rb +1 -1
  9. data/lib/chef/sugar/cloud.rb +1 -1
  10. data/lib/chef/sugar/constraints.rb +161 -0
  11. data/lib/chef/sugar/core_extensions.rb +18 -0
  12. data/lib/chef/sugar/core_extensions/array.rb +34 -0
  13. data/lib/chef/sugar/core_extensions/string.rb +49 -0
  14. data/lib/chef/sugar/data_bag.rb +34 -9
  15. data/lib/chef/sugar/ip.rb +1 -1
  16. data/lib/chef/sugar/kernel.rb +49 -0
  17. data/lib/chef/sugar/node.rb +157 -1
  18. data/lib/chef/sugar/platform.rb +1 -1
  19. data/lib/chef/sugar/platform_family.rb +1 -1
  20. data/lib/chef/sugar/ruby.rb +1 -1
  21. data/lib/chef/sugar/shell.rb +1 -1
  22. data/lib/chef/sugar/vagrant.rb +1 -1
  23. data/lib/chef/sugar/version.rb +2 -2
  24. data/metadata.rb +1 -1
  25. data/recipes/default.rb +2 -2
  26. data/spec/spec_helper.rb +3 -0
  27. data/spec/support/shared_examples.rb +1 -1
  28. data/spec/unit/chef/{extensions → sugar}/architecture_spec.rb +0 -0
  29. data/spec/unit/chef/{extensions → sugar}/cloud_spec.rb +0 -0
  30. data/spec/unit/chef/sugar/constraints_spec.rb +43 -0
  31. data/spec/unit/chef/sugar/core_extensions/array_spec.rb +10 -0
  32. data/spec/unit/chef/sugar/core_extensions/string_spec.rb +16 -0
  33. data/spec/unit/chef/{extensions → sugar}/data_bag_spec.rb +23 -4
  34. data/spec/unit/chef/{extensions → sugar}/ip_spec.rb +0 -0
  35. data/spec/unit/chef/sugar/kernel_spec.rb +16 -0
  36. data/spec/unit/chef/sugar/node_spec.rb +117 -0
  37. data/spec/unit/chef/{extensions → sugar}/platform_family_spec.rb +0 -0
  38. data/spec/unit/chef/{extensions → sugar}/platform_spec.rb +0 -0
  39. data/spec/unit/chef/{extensions → sugar}/ruby_spec.rb +0 -0
  40. data/spec/unit/chef/{extensions → sugar}/shell_spec.rb +0 -0
  41. data/spec/unit/chef/{extensions → sugar}/vagrant_spec.rb +0 -0
  42. metadata +45 -61
  43. data/.kitchen.yml +0 -16
  44. data/recipes/development.rb +0 -65
  45. data/spec/unit/chef/extensions/node_spec.rb +0 -30
data/.kitchen.yml DELETED
@@ -1,16 +0,0 @@
1
- driver_plugin: vagrant
2
- driver_config:
3
- require_chef_omnibus: true
4
- synced_folders:
5
- - ['<%= File.expand_path('..', __FILE__) %>', '/gem']
6
-
7
- platforms:
8
- # - name: ubuntu-10.04
9
- # - name: ubuntu-10.10
10
- - name: ubuntu-12.04
11
- # - name: ubuntu-12.10
12
-
13
- suites:
14
- - name: install
15
- run_list:
16
- - recipe[chef-sugar::development]
@@ -1,65 +0,0 @@
1
- #
2
- # Cookbook Name:: chef-sugar
3
- # Recipe:: development
4
- #
5
- # Copyright 2013, Seth Vargo <sethvargo@gmail.com>
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
- #
19
-
20
- #
21
- # This recipe is only meant for use when developing Chef Sugar.
22
- #
23
-
24
- execute('apt-get update') do
25
- only_if { Time.now.to_i - 86400 > `stat -c %Y /var/cache/apt/`.to_i }
26
- end.run_action(:run)
27
-
28
- [
29
- 'build-essential',
30
- 'libxslt-dev',
31
- 'libxml2-dev',
32
- 'git'
33
- ].each do |name|
34
- package(name) do
35
- action :nothing
36
- end.run_action(:install)
37
- end
38
-
39
- execute('gem update bundler') do
40
- action :nothing
41
- not_if { `bundle -v`.strip.gsub(/[^0-9\.]/, '').to_f >= 1.3 }
42
- end.run_action(:run)
43
-
44
- execute 'bundle[chef-sugar]' do
45
- cwd '/gem'
46
- command 'bundle install --path vendor'
47
- not_if 'bundle check --gemfile /gem/Gemfile'
48
- action :nothing
49
- end.run_action(:run)
50
-
51
- execute 'build[chef-sugar]' do
52
- cwd '/gem'
53
- command 'bundle exec rake build'
54
- action :nothing
55
- end.run_action(:run)
56
-
57
- sugar = chef_gem('chef-sugar') do
58
- source '/gem/pkg/chef-sugar-1.0.0.gem'
59
- action :nothing
60
- end
61
-
62
- sugar.run_action(:remove)
63
- sugar.run_action(:install)
64
-
65
- require 'chef/sugar'
@@ -1,30 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Chef::Node do
4
- describe '#in?' do
5
- it 'returns true when the node is in the environment' do
6
- subject.stub(:chef_environment).and_return('production')
7
- expect(subject.in?('production')).to be_true
8
- expect(subject.in?(/production$/)).to be_true
9
- end
10
-
11
- it 'returns false when the node is not in the environment' do
12
- subject.stub(:chef_environment).and_return('staging')
13
- expect(subject.in?('production')).to be_false
14
- expect(subject.in?(/production$/)).to be_false
15
- end
16
- end
17
-
18
- describe '#includes_recipe?' do
19
- it 'returns true when the recipe exists' do
20
- subject.stub(:run_list).and_return(['recipe[magic::recipe]'])
21
- expect(subject.includes_recipe?('recipe[magic::recipe]')).to be_true
22
- end
23
-
24
- it 'returns false when the recipe does
25
- not exist' do
26
- subject.stub(:run_list).and_return([])
27
- expect(subject.includes_recipe?('recipe[magic::recipe]')).to be_false
28
- end
29
- end
30
- end