chef-skel 0.1.0 → 0.1.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.
- data/CHANGELOG.md +12 -0
- data/LICENSE +202 -0
- data/README.md +61 -0
- data/TESTING.md +150 -0
- data/chef-skel.gemspec +3 -3
- data/lib/chef_skel/rake_tasks.rb +15 -3
- data/lib/chef_skel/version.rb +1 -1
- metadata +12 -9
- data/Gemfile.lock +0 -215
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
v0.1.1 (Jun 26 2013)
|
|
2
|
+
--------------------
|
|
3
|
+
|
|
4
|
+
* Generate knife.rb as part of `rake test:prepare` so it doesn't have to be part
|
|
5
|
+
of the cookbook.
|
|
6
|
+
* Add files README.md, TESTING.md, CHANGELOG.md, and LICENSE.
|
|
7
|
+
* Remove Gemfile.lock.
|
|
8
|
+
|
|
9
|
+
v0.1.0 (Jun 24 2013)
|
|
10
|
+
--------------------
|
|
11
|
+
|
|
12
|
+
* First tagged version.
|
data/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
data/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
chef-skel
|
|
2
|
+
=========
|
|
3
|
+
|
|
4
|
+
chef-skel provides a skeleton for a testable Chef cookbook.
|
|
5
|
+
|
|
6
|
+
The goal of chef-skel is to extract all testing facilities of the [skeleton
|
|
7
|
+
cookbook] into a gem. See file `TESTING.md` to learn more.
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
Installation
|
|
11
|
+
------------
|
|
12
|
+
|
|
13
|
+
You can install chef-skel via RubyGems:
|
|
14
|
+
|
|
15
|
+
$ gem install chef-skel
|
|
16
|
+
|
|
17
|
+
Alternatively, you can install the gem from source:
|
|
18
|
+
|
|
19
|
+
$ git clone git://github.com/mlafeldt/chef-skel.git
|
|
20
|
+
$ cd chef-skel/
|
|
21
|
+
$ bundle install
|
|
22
|
+
$ bundle exec rake install
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
Usage
|
|
26
|
+
-----
|
|
27
|
+
|
|
28
|
+
For now, take a look at the [skeleton cookbook] to learn how chef-skel is used.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
License and Author
|
|
32
|
+
------------------
|
|
33
|
+
|
|
34
|
+
Author:: Mathias Lafeldt (<mathias.lafeldt@gmail.com>)
|
|
35
|
+
|
|
36
|
+
Copyright:: 2012-2013, Mathias Lafeldt
|
|
37
|
+
|
|
38
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
39
|
+
you may not use this file except in compliance with the License.
|
|
40
|
+
You may obtain a copy of the License at
|
|
41
|
+
|
|
42
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
43
|
+
|
|
44
|
+
Unless required by applicable law or agreed to in writing, software
|
|
45
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
46
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
47
|
+
See the License for the specific language governing permissions and
|
|
48
|
+
limitations under the License.
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
Contributing
|
|
52
|
+
------------
|
|
53
|
+
|
|
54
|
+
1. Fork it
|
|
55
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
56
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
57
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
58
|
+
5. Create new Pull Request
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
[skeleton cookbook]: https://github.com/mlafeldt/skeleton-cookbook
|
data/TESTING.md
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
Testing
|
|
2
|
+
-------
|
|
3
|
+
|
|
4
|
+
This cookbook comes with everything you need to develop infrastructure code with
|
|
5
|
+
Chef and feel confident about it. The provided testing facilities allow you to
|
|
6
|
+
iterate quickly on cookbook changes.
|
|
7
|
+
|
|
8
|
+
After installing Vagrant and the required Ruby gems, most of the testing can be
|
|
9
|
+
done through convenient Rake tasks.
|
|
10
|
+
|
|
11
|
+
### Bundler
|
|
12
|
+
|
|
13
|
+
Apart from Vagrant, which is described later on, all tools you need for cookbook
|
|
14
|
+
development and testing are installed as Ruby gems using [Bundler]. This gives
|
|
15
|
+
you a lot of control over the software stack ensuring that the testing
|
|
16
|
+
environment matches your production environment.
|
|
17
|
+
|
|
18
|
+
First, make sure you have Bundler (which is itself a gem):
|
|
19
|
+
|
|
20
|
+
$ gem install bundler
|
|
21
|
+
|
|
22
|
+
Then let Bundler install the required gems (as defined in `Gemfile`):
|
|
23
|
+
|
|
24
|
+
$ bundle install
|
|
25
|
+
|
|
26
|
+
Now you can use `bundle exec` to execute a command from the gemset, for example:
|
|
27
|
+
|
|
28
|
+
$ bundle exec rake
|
|
29
|
+
|
|
30
|
+
(You should keep `Gemfile.lock` checked in.)
|
|
31
|
+
|
|
32
|
+
### Rake
|
|
33
|
+
|
|
34
|
+
The cookbook provides a couple of helpful [Rake] tasks (specified in
|
|
35
|
+
`Rakefile`):
|
|
36
|
+
|
|
37
|
+
$ rake -T
|
|
38
|
+
rake clean # Remove any temporary products.
|
|
39
|
+
rake clobber # Remove any generated file.
|
|
40
|
+
rake env # Display information about the environment
|
|
41
|
+
rake test:all # Run test:syntax, test:lint, test:unit, and test:integration
|
|
42
|
+
rake test:integration # Run serverspec integration tests with Vagrant
|
|
43
|
+
rake test:integration_teardown # Tear down VM used for integration tests
|
|
44
|
+
rake test:lint # Run Foodcritic lint checks
|
|
45
|
+
rake test:syntax # Run Knife syntax checks
|
|
46
|
+
rake test:travis # Run test:syntax, test:lint, and test:unit
|
|
47
|
+
rake test:unit # Run ChefSpec examples
|
|
48
|
+
rake vagrant:destroy # Destroy the VM
|
|
49
|
+
rake vagrant:halt # Shutdown the VM
|
|
50
|
+
rake vagrant:provision # Provision the VM using Chef
|
|
51
|
+
rake vagrant:ssh # SSH into the VM
|
|
52
|
+
|
|
53
|
+
As mentioned above, use `bundle exec` to start a Rake task:
|
|
54
|
+
|
|
55
|
+
$ bundle exec rake test
|
|
56
|
+
|
|
57
|
+
The `test` task is an alias for `test:all` and also happens to be the default
|
|
58
|
+
when no task is given. All test-related tasks are described in more detail
|
|
59
|
+
below.
|
|
60
|
+
|
|
61
|
+
### Knife
|
|
62
|
+
|
|
63
|
+
The Rake task `test:syntax` will use `knife cookbook test` to run syntax checks
|
|
64
|
+
on the cookbook, validating both Ruby files and templates.
|
|
65
|
+
|
|
66
|
+
### Foodcritic
|
|
67
|
+
|
|
68
|
+
The Rake task `test:lint` will use [Foodcritic] to run lint checks on the
|
|
69
|
+
cookbook. Foodcritic is configured to fail if there are _any_ warnings that
|
|
70
|
+
might stop the cookbook from working.
|
|
71
|
+
|
|
72
|
+
### ChefSpec
|
|
73
|
+
|
|
74
|
+
The Rake task `test:spec` will run all [ChefSpec] examples in the `spec`
|
|
75
|
+
directory. Built on top of RSpec, ChefSpec allows you to write unit tests for
|
|
76
|
+
Chef cookbooks. It runs your cookbook - without actually converging a node - and
|
|
77
|
+
lets you make assertions about the resources that were created. This makes it
|
|
78
|
+
the ideal tool to get fast feedback on cookbook changes.
|
|
79
|
+
|
|
80
|
+
### serverspec
|
|
81
|
+
|
|
82
|
+
The Rake task `test:integration` will run [serverspec] integration tests
|
|
83
|
+
against a VM managed by Vagrant. The files `spec/integration/**/*_spec.rb` are
|
|
84
|
+
the test files that are run at the end of the provisioning process by ssh'ing
|
|
85
|
+
into the VM. For each VM you want to test, there must be a folder with specs in
|
|
86
|
+
`spec/integration/` (the default node specs are in `spec/integration/default`).
|
|
87
|
+
|
|
88
|
+
In case the VM is powered off, `rake test:integration` will boot it up first.
|
|
89
|
+
When you no longer need the VM for integration testing, `rake
|
|
90
|
+
test:integration_teardown` will shut it down. If you rather want to provision
|
|
91
|
+
from scratch, set `INTEGRATION_TEARDOWN` accordingly. For example:
|
|
92
|
+
|
|
93
|
+
$ export INTEGRATION_TEARDOWN='vagrant:destroy'
|
|
94
|
+
$ rake test:integration_teardown
|
|
95
|
+
$ rake test:integration
|
|
96
|
+
|
|
97
|
+
### Berkshelf
|
|
98
|
+
|
|
99
|
+
[Berkshelf] is used to set up the cookbook and its dependencies prior to testing
|
|
100
|
+
with Rake and Vagrant.
|
|
101
|
+
|
|
102
|
+
The dependencies are defined in `Berksfile`, which in turn resolves the
|
|
103
|
+
dependencies in `metadata.rb`. It is good practice to specify the cookbook
|
|
104
|
+
sources in `Berksfile`, while keeping the cookbook versions in `metadata.rb`
|
|
105
|
+
(the authoritative source of information for Chef).
|
|
106
|
+
|
|
107
|
+
During testing, dependencies are installed to the `vendor/cookbooks` directory
|
|
108
|
+
inside this cookbook.
|
|
109
|
+
|
|
110
|
+
### Vagrant
|
|
111
|
+
|
|
112
|
+
With [Vagrant], you can spin up a virtual machine and run your cookbook inside
|
|
113
|
+
it via Chef Solo or Chef Client. The test setup requires to install **Vagrant
|
|
114
|
+
1.2.x** from the [Vagrant downloads page].
|
|
115
|
+
|
|
116
|
+
You will also need the [vagrant-berkshelf] plugin, which will make your cookbook
|
|
117
|
+
and its dependencies automatically available to Vagrant when creating or
|
|
118
|
+
provisioning a VM:
|
|
119
|
+
|
|
120
|
+
$ vagrant plugin install vagrant-berkshelf
|
|
121
|
+
|
|
122
|
+
When everything is in place, this command will boot and provision the VM as
|
|
123
|
+
specified in the `Vagrantfile`:
|
|
124
|
+
|
|
125
|
+
$ vagrant up
|
|
126
|
+
|
|
127
|
+
In case the VM is already up, you can run the provisioners again with:
|
|
128
|
+
|
|
129
|
+
$ vagrant provision
|
|
130
|
+
|
|
131
|
+
### Travis CI
|
|
132
|
+
|
|
133
|
+
The cookbook includes a configuration for [Travis CI] that will run `rake
|
|
134
|
+
test:travis` each time changes are pushed to GitHub. Simply enable Travis for
|
|
135
|
+
your GitHub repository to get free continuous integration.
|
|
136
|
+
|
|
137
|
+
Implementing CI with other systems should be as simple as running the commands
|
|
138
|
+
in `.travis.yml`.
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
[Berkshelf]: http://berkshelf.com
|
|
142
|
+
[Bundler]: http://gembundler.com
|
|
143
|
+
[ChefSpec]: https://github.com/acrmp/chefspec
|
|
144
|
+
[Foodcritic]: http://acrmp.github.com/foodcritic/
|
|
145
|
+
[Rake]: http://rake.rubyforge.org
|
|
146
|
+
[Travis CI]: https://travis-ci.org
|
|
147
|
+
[Vagrant downloads page]: http://downloads.vagrantup.com/
|
|
148
|
+
[Vagrant]: http://vagrantup.com
|
|
149
|
+
[serverspec]: http://serverspec.org/
|
|
150
|
+
[vagrant-berkshelf]: https://github.com/RiotGames/vagrant-berkshelf
|
data/chef-skel.gemspec
CHANGED
|
@@ -4,10 +4,10 @@ require File.expand_path('../lib/chef_skel/version', __FILE__)
|
|
|
4
4
|
Gem::Specification.new do |s|
|
|
5
5
|
s.authors = ['Mathias Lafeldt']
|
|
6
6
|
s.email = ['mathias.lafeldt@gmail.com']
|
|
7
|
-
s.description = %q{Chef
|
|
7
|
+
s.description = %q{Skeleton for a testable Chef cookbook}
|
|
8
8
|
s.summary = s.description
|
|
9
|
-
s.homepage = '
|
|
10
|
-
s.license = '
|
|
9
|
+
s.homepage = 'https://github.com/mlafeldt/chef-skel'
|
|
10
|
+
s.license = 'Apache 2.0'
|
|
11
11
|
|
|
12
12
|
s.files = `git ls-files`.split($\)
|
|
13
13
|
s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
data/lib/chef_skel/rake_tasks.rb
CHANGED
|
@@ -38,6 +38,7 @@ end
|
|
|
38
38
|
|
|
39
39
|
COOKBOOK_NAME = ENV.fetch('COOKBOOK_NAME', cookbook_name)
|
|
40
40
|
COOKBOOK_PATH = ENV.fetch('COOKBOOK_PATH', 'vendor/cookbooks')
|
|
41
|
+
KNIFE_CONFIG = File.join(COOKBOOK_PATH, '.knife.rb')
|
|
41
42
|
|
|
42
43
|
CLOBBER.include COOKBOOK_PATH, 'Berksfile.lock', '.kitchen', '.vagrant'
|
|
43
44
|
|
|
@@ -61,9 +62,20 @@ task :env do
|
|
|
61
62
|
end
|
|
62
63
|
|
|
63
64
|
namespace :test do
|
|
64
|
-
task :
|
|
65
|
-
ENV['COOKBOOK_PATH'] = COOKBOOK_PATH
|
|
65
|
+
task :prepare_cookbooks do
|
|
66
66
|
sh 'berks', 'install', '--path', COOKBOOK_PATH
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
task :prepare_knife_config do
|
|
70
|
+
File.open(KNIFE_CONFIG, 'w') do |f|
|
|
71
|
+
f.puts "cache_type 'BasicFile'"
|
|
72
|
+
f.puts "cache_options :path => '#{File.join(ENV['HOME'], '.chef', 'checksums')}'"
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
task :prepare => [:prepare_cookbooks, :prepare_knife_config] do
|
|
77
|
+
# Export path to cookbooks
|
|
78
|
+
ENV['COOKBOOK_PATH'] = COOKBOOK_PATH
|
|
67
79
|
# Run cleanup at exit unless an exception was raised.
|
|
68
80
|
at_exit { Rake::Task['test:cleanup'].invoke if $!.nil? }
|
|
69
81
|
end
|
|
@@ -74,7 +86,7 @@ namespace :test do
|
|
|
74
86
|
|
|
75
87
|
desc 'Run Knife syntax checks'
|
|
76
88
|
task :syntax => :prepare do
|
|
77
|
-
sh 'knife', 'cookbook', 'test', COOKBOOK_NAME, '--config',
|
|
89
|
+
sh 'knife', 'cookbook', 'test', COOKBOOK_NAME, '--config', KNIFE_CONFIG,
|
|
78
90
|
'--cookbook-path', COOKBOOK_PATH
|
|
79
91
|
end
|
|
80
92
|
|
data/lib/chef_skel/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: chef-skel
|
|
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:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-06-
|
|
12
|
+
date: 2013-06-26 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: berkshelf
|
|
@@ -107,7 +107,7 @@ dependencies:
|
|
|
107
107
|
- - '>='
|
|
108
108
|
- !ruby/object:Gem::Version
|
|
109
109
|
version: '0'
|
|
110
|
-
description: Chef
|
|
110
|
+
description: Skeleton for a testable Chef cookbook
|
|
111
111
|
email:
|
|
112
112
|
- mathias.lafeldt@gmail.com
|
|
113
113
|
executables: []
|
|
@@ -115,17 +115,20 @@ extensions: []
|
|
|
115
115
|
extra_rdoc_files: []
|
|
116
116
|
files:
|
|
117
117
|
- .gitignore
|
|
118
|
+
- CHANGELOG.md
|
|
118
119
|
- Gemfile
|
|
119
|
-
-
|
|
120
|
+
- LICENSE
|
|
121
|
+
- README.md
|
|
120
122
|
- Rakefile
|
|
123
|
+
- TESTING.md
|
|
121
124
|
- chef-skel.gemspec
|
|
122
125
|
- lib/chef_skel/integration_spec_helper.rb
|
|
123
126
|
- lib/chef_skel/rake_tasks.rb
|
|
124
127
|
- lib/chef_skel/unit_spec_helper.rb
|
|
125
128
|
- lib/chef_skel/version.rb
|
|
126
|
-
homepage:
|
|
129
|
+
homepage: https://github.com/mlafeldt/chef-skel
|
|
127
130
|
licenses:
|
|
128
|
-
-
|
|
131
|
+
- Apache 2.0
|
|
129
132
|
post_install_message:
|
|
130
133
|
rdoc_options: []
|
|
131
134
|
require_paths:
|
|
@@ -138,7 +141,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
138
141
|
version: '0'
|
|
139
142
|
segments:
|
|
140
143
|
- 0
|
|
141
|
-
hash:
|
|
144
|
+
hash: 2202343543367566813
|
|
142
145
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
146
|
none: false
|
|
144
147
|
requirements:
|
|
@@ -147,11 +150,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
147
150
|
version: '0'
|
|
148
151
|
segments:
|
|
149
152
|
- 0
|
|
150
|
-
hash:
|
|
153
|
+
hash: 2202343543367566813
|
|
151
154
|
requirements: []
|
|
152
155
|
rubyforge_project:
|
|
153
156
|
rubygems_version: 1.8.25
|
|
154
157
|
signing_key:
|
|
155
158
|
specification_version: 3
|
|
156
|
-
summary: Chef
|
|
159
|
+
summary: Skeleton for a testable Chef cookbook
|
|
157
160
|
test_files: []
|
data/Gemfile.lock
DELETED
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: .
|
|
3
|
-
specs:
|
|
4
|
-
chef-skel (0.1.0)
|
|
5
|
-
berkshelf
|
|
6
|
-
chef
|
|
7
|
-
chefspec
|
|
8
|
-
foodcritic
|
|
9
|
-
rake
|
|
10
|
-
serverspec
|
|
11
|
-
|
|
12
|
-
GEM
|
|
13
|
-
remote: https://rubygems.org/
|
|
14
|
-
specs:
|
|
15
|
-
activesupport (3.2.13)
|
|
16
|
-
i18n (= 0.6.1)
|
|
17
|
-
multi_json (~> 1.0)
|
|
18
|
-
addressable (2.3.4)
|
|
19
|
-
akami (1.2.0)
|
|
20
|
-
gyoku (>= 0.4.0)
|
|
21
|
-
nokogiri (>= 1.4.0)
|
|
22
|
-
berkshelf (2.0.5)
|
|
23
|
-
activesupport (>= 3.2.0)
|
|
24
|
-
addressable (~> 2.3.4)
|
|
25
|
-
buff-shell_out (~> 0.1)
|
|
26
|
-
celluloid (>= 0.14.0)
|
|
27
|
-
chozo (>= 0.6.1)
|
|
28
|
-
faraday (>= 0.8.5)
|
|
29
|
-
hashie (>= 2.0.2)
|
|
30
|
-
minitar (~> 0.5.4)
|
|
31
|
-
rbzip2 (~> 0.2.0)
|
|
32
|
-
retryable (~> 1.3.3)
|
|
33
|
-
ridley (~> 1.2.1)
|
|
34
|
-
solve (>= 0.5.0)
|
|
35
|
-
thor (~> 0.18.0)
|
|
36
|
-
buff-extensions (0.5.0)
|
|
37
|
-
buff-ruby_engine (0.1.0)
|
|
38
|
-
buff-shell_out (0.1.0)
|
|
39
|
-
buff-ruby_engine (~> 0.1.0)
|
|
40
|
-
builder (3.2.2)
|
|
41
|
-
celluloid (0.14.1)
|
|
42
|
-
timers (>= 1.0.0)
|
|
43
|
-
celluloid-io (0.14.1)
|
|
44
|
-
celluloid (>= 0.14.1)
|
|
45
|
-
nio4r (>= 0.4.5)
|
|
46
|
-
chef (11.4.4)
|
|
47
|
-
erubis
|
|
48
|
-
highline (>= 1.6.9)
|
|
49
|
-
json (>= 1.4.4, <= 1.7.7)
|
|
50
|
-
mixlib-authentication (>= 1.3.0)
|
|
51
|
-
mixlib-cli (~> 1.3.0)
|
|
52
|
-
mixlib-config (>= 1.1.2)
|
|
53
|
-
mixlib-log (>= 1.3.0)
|
|
54
|
-
mixlib-shellout
|
|
55
|
-
net-ssh (~> 2.6)
|
|
56
|
-
net-ssh-multi (~> 1.1.0)
|
|
57
|
-
ohai (>= 0.6.0)
|
|
58
|
-
rest-client (>= 1.0.4, < 1.7.0)
|
|
59
|
-
yajl-ruby (~> 1.1)
|
|
60
|
-
chefspec (1.3.1)
|
|
61
|
-
chef (>= 10.0)
|
|
62
|
-
erubis
|
|
63
|
-
fauxhai (>= 0.1.1, < 2.0)
|
|
64
|
-
minitest-chef-handler (>= 0.6.0)
|
|
65
|
-
rspec (~> 2.0)
|
|
66
|
-
chozo (0.6.1)
|
|
67
|
-
activesupport (>= 3.2.0)
|
|
68
|
-
hashie (>= 2.0.2)
|
|
69
|
-
multi_json (>= 1.3.0)
|
|
70
|
-
ci_reporter (1.8.4)
|
|
71
|
-
builder (>= 2.1.2)
|
|
72
|
-
diff-lcs (1.2.4)
|
|
73
|
-
erubis (2.7.0)
|
|
74
|
-
faraday (0.8.7)
|
|
75
|
-
multipart-post (~> 1.1)
|
|
76
|
-
fauxhai (1.1.1)
|
|
77
|
-
httparty
|
|
78
|
-
net-ssh
|
|
79
|
-
ohai
|
|
80
|
-
ffi (1.9.0)
|
|
81
|
-
foodcritic (2.1.0)
|
|
82
|
-
erubis
|
|
83
|
-
gherkin (~> 2.11.7)
|
|
84
|
-
nokogiri (~> 1.5.4)
|
|
85
|
-
rak (~> 1.4)
|
|
86
|
-
treetop (~> 1.4.10)
|
|
87
|
-
yajl-ruby (~> 1.1.0)
|
|
88
|
-
gherkin (2.11.8)
|
|
89
|
-
multi_json (~> 1.3)
|
|
90
|
-
gssapi (1.0.3)
|
|
91
|
-
ffi (>= 1.0.1)
|
|
92
|
-
gyoku (1.0.0)
|
|
93
|
-
builder (>= 2.1.2)
|
|
94
|
-
hashie (2.0.5)
|
|
95
|
-
highline (1.6.19)
|
|
96
|
-
httparty (0.11.0)
|
|
97
|
-
multi_json (~> 1.0)
|
|
98
|
-
multi_xml (>= 0.5.2)
|
|
99
|
-
httpclient (2.2.0.2)
|
|
100
|
-
httpi (0.9.7)
|
|
101
|
-
rack
|
|
102
|
-
i18n (0.6.1)
|
|
103
|
-
ipaddress (0.8.0)
|
|
104
|
-
json (1.7.7)
|
|
105
|
-
little-plugger (1.1.3)
|
|
106
|
-
logging (1.6.2)
|
|
107
|
-
little-plugger (>= 1.1.3)
|
|
108
|
-
mime-types (1.23)
|
|
109
|
-
minitar (0.5.4)
|
|
110
|
-
minitest (4.7.5)
|
|
111
|
-
minitest-chef-handler (1.0.1)
|
|
112
|
-
chef
|
|
113
|
-
ci_reporter
|
|
114
|
-
minitest (~> 4.7.3)
|
|
115
|
-
mixlib-authentication (1.3.0)
|
|
116
|
-
mixlib-log
|
|
117
|
-
mixlib-cli (1.3.0)
|
|
118
|
-
mixlib-config (1.1.2)
|
|
119
|
-
mixlib-log (1.6.0)
|
|
120
|
-
mixlib-shellout (1.1.0)
|
|
121
|
-
multi_json (1.7.7)
|
|
122
|
-
multi_xml (0.5.4)
|
|
123
|
-
multipart-post (1.2.0)
|
|
124
|
-
net-http-persistent (2.8)
|
|
125
|
-
net-ssh (2.6.7)
|
|
126
|
-
net-ssh-gateway (1.2.0)
|
|
127
|
-
net-ssh (>= 2.6.5)
|
|
128
|
-
net-ssh-multi (1.1)
|
|
129
|
-
net-ssh (>= 2.1.4)
|
|
130
|
-
net-ssh-gateway (>= 0.99.0)
|
|
131
|
-
nio4r (0.4.6)
|
|
132
|
-
nokogiri (1.5.10)
|
|
133
|
-
nori (1.1.5)
|
|
134
|
-
ohai (6.16.0)
|
|
135
|
-
ipaddress
|
|
136
|
-
mixlib-cli
|
|
137
|
-
mixlib-config
|
|
138
|
-
mixlib-log
|
|
139
|
-
mixlib-shellout
|
|
140
|
-
systemu
|
|
141
|
-
yajl-ruby
|
|
142
|
-
polyglot (0.3.3)
|
|
143
|
-
rack (1.5.2)
|
|
144
|
-
rak (1.4)
|
|
145
|
-
rake (10.1.0)
|
|
146
|
-
rbzip2 (0.2.0)
|
|
147
|
-
rest-client (1.6.7)
|
|
148
|
-
mime-types (>= 1.16)
|
|
149
|
-
retryable (1.3.3)
|
|
150
|
-
ridley (1.2.3)
|
|
151
|
-
addressable
|
|
152
|
-
buff-extensions (~> 0.3)
|
|
153
|
-
buff-shell_out (~> 0.1)
|
|
154
|
-
celluloid (~> 0.14.0)
|
|
155
|
-
celluloid-io (~> 0.14.0)
|
|
156
|
-
erubis
|
|
157
|
-
faraday (>= 0.8.4)
|
|
158
|
-
hashie (>= 2.0.2)
|
|
159
|
-
json (>= 1.7.7)
|
|
160
|
-
mixlib-authentication (>= 1.3.0)
|
|
161
|
-
net-http-persistent (>= 2.8)
|
|
162
|
-
net-ssh
|
|
163
|
-
retryable
|
|
164
|
-
solve (>= 0.4.4)
|
|
165
|
-
varia_model (~> 0.1)
|
|
166
|
-
winrm (~> 1.1.0)
|
|
167
|
-
rspec (2.13.0)
|
|
168
|
-
rspec-core (~> 2.13.0)
|
|
169
|
-
rspec-expectations (~> 2.13.0)
|
|
170
|
-
rspec-mocks (~> 2.13.0)
|
|
171
|
-
rspec-core (2.13.1)
|
|
172
|
-
rspec-expectations (2.13.0)
|
|
173
|
-
diff-lcs (>= 1.1.3, < 2.0)
|
|
174
|
-
rspec-mocks (2.13.1)
|
|
175
|
-
rubyntlm (0.1.1)
|
|
176
|
-
savon (0.9.5)
|
|
177
|
-
akami (~> 1.0)
|
|
178
|
-
builder (>= 2.1.2)
|
|
179
|
-
gyoku (>= 0.4.0)
|
|
180
|
-
httpi (~> 0.9)
|
|
181
|
-
nokogiri (>= 1.4.0)
|
|
182
|
-
nori (~> 1.0)
|
|
183
|
-
wasabi (~> 1.0)
|
|
184
|
-
serverspec (0.6.7)
|
|
185
|
-
highline
|
|
186
|
-
net-ssh
|
|
187
|
-
rspec (~> 2.13.0)
|
|
188
|
-
solve (0.5.0)
|
|
189
|
-
systemu (2.5.2)
|
|
190
|
-
thor (0.18.1)
|
|
191
|
-
timers (1.1.0)
|
|
192
|
-
treetop (1.4.14)
|
|
193
|
-
polyglot
|
|
194
|
-
polyglot (>= 0.3.1)
|
|
195
|
-
uuidtools (2.1.4)
|
|
196
|
-
varia_model (0.1.0)
|
|
197
|
-
buff-extensions (~> 0.1)
|
|
198
|
-
hashie (>= 2.0.2)
|
|
199
|
-
wasabi (1.0.0)
|
|
200
|
-
nokogiri (>= 1.4.0)
|
|
201
|
-
winrm (1.1.2)
|
|
202
|
-
gssapi (~> 1.0.0)
|
|
203
|
-
httpclient (~> 2.2.0.2)
|
|
204
|
-
logging (~> 1.6.1)
|
|
205
|
-
nokogiri (~> 1.5.0)
|
|
206
|
-
rubyntlm (~> 0.1.1)
|
|
207
|
-
savon (= 0.9.5)
|
|
208
|
-
uuidtools (~> 2.1.2)
|
|
209
|
-
yajl-ruby (1.1.0)
|
|
210
|
-
|
|
211
|
-
PLATFORMS
|
|
212
|
-
ruby
|
|
213
|
-
|
|
214
|
-
DEPENDENCIES
|
|
215
|
-
chef-skel!
|