chef-sugar 1.1.0 → 1.2.0.beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/LICENSE +1 -1
- data/README.md +91 -1
- data/Rakefile +6 -0
- data/chef-extensions.gemspec +3 -6
- data/lib/chef/sugar.rb +5 -1
- data/lib/chef/sugar/architecture.rb +1 -1
- data/lib/chef/sugar/cloud.rb +1 -1
- data/lib/chef/sugar/constraints.rb +161 -0
- data/lib/chef/sugar/core_extensions.rb +18 -0
- data/lib/chef/sugar/core_extensions/array.rb +34 -0
- data/lib/chef/sugar/core_extensions/string.rb +49 -0
- data/lib/chef/sugar/data_bag.rb +34 -9
- data/lib/chef/sugar/ip.rb +1 -1
- data/lib/chef/sugar/kernel.rb +49 -0
- data/lib/chef/sugar/node.rb +157 -1
- data/lib/chef/sugar/platform.rb +1 -1
- data/lib/chef/sugar/platform_family.rb +1 -1
- data/lib/chef/sugar/ruby.rb +1 -1
- data/lib/chef/sugar/shell.rb +1 -1
- data/lib/chef/sugar/vagrant.rb +1 -1
- data/lib/chef/sugar/version.rb +2 -2
- data/metadata.rb +1 -1
- data/recipes/default.rb +2 -2
- data/spec/spec_helper.rb +3 -0
- data/spec/support/shared_examples.rb +1 -1
- data/spec/unit/chef/{extensions → sugar}/architecture_spec.rb +0 -0
- data/spec/unit/chef/{extensions → sugar}/cloud_spec.rb +0 -0
- data/spec/unit/chef/sugar/constraints_spec.rb +43 -0
- data/spec/unit/chef/sugar/core_extensions/array_spec.rb +10 -0
- data/spec/unit/chef/sugar/core_extensions/string_spec.rb +16 -0
- data/spec/unit/chef/{extensions → sugar}/data_bag_spec.rb +23 -4
- data/spec/unit/chef/{extensions → sugar}/ip_spec.rb +0 -0
- data/spec/unit/chef/sugar/kernel_spec.rb +16 -0
- data/spec/unit/chef/sugar/node_spec.rb +117 -0
- data/spec/unit/chef/{extensions → sugar}/platform_family_spec.rb +0 -0
- data/spec/unit/chef/{extensions → sugar}/platform_spec.rb +0 -0
- data/spec/unit/chef/{extensions → sugar}/ruby_spec.rb +0 -0
- data/spec/unit/chef/{extensions → sugar}/shell_spec.rb +0 -0
- data/spec/unit/chef/{extensions → sugar}/vagrant_spec.rb +0 -0
- metadata +45 -61
- data/.kitchen.yml +0 -16
- data/recipes/development.rb +0 -65
- 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]
|
data/recipes/development.rb
DELETED
@@ -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
|