emeril 0.5.0

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/.cane ADDED
File without changes
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.tailor ADDED
@@ -0,0 +1,106 @@
1
+ #------------------------------------------------------------------------------
2
+ # Horizontal Whitespace
3
+ #------------------------------------------------------------------------------
4
+ # allow_hard_tabs True to let hard tabs be considered a single space.
5
+ # Default: false
6
+ #
7
+ # allow_trailing_line_spaces
8
+ # True to skip detecting extra spaces at the ends of
9
+ # lines.
10
+ # Default: false
11
+ #
12
+ # indentation_spaces The number of spaces to consider a proper indent.
13
+ # Default: 2
14
+ #
15
+ # max_line_length The maximum number of characters in a line before
16
+ # tailor complains.
17
+ # Default: 80
18
+ # spaces_after_comma Number of spaces to expect after a comma.
19
+ # Default: 1
20
+ #
21
+ # spaces_before_comma Number of spaces to expect before a comma.
22
+ # Default: 0
23
+ #
24
+ # spaces_after_lbrace The number of spaces to expect after an lbrace ('{').
25
+ # Default: 1
26
+ #
27
+ # spaces_before_lbrace The number of spaces to expect before an lbrace ('{').
28
+ # Default: 1
29
+ #
30
+ # spaces_before_rbrace The number of spaces to expect before an rbrace ('}').
31
+ # Default: 1
32
+ #
33
+ # spaces_in_empty_braces The number of spaces to expect between braces when
34
+ # there's nothing in the braces (i.e. {}).
35
+ # Default: 0
36
+ #
37
+ # spaces_after_lbracket The number of spaces to expect after an
38
+ # lbracket ('[').
39
+ # Default: 0
40
+ #
41
+ # spaces_before_rbracket The number of spaces to expect before an
42
+ # rbracket (']').
43
+ # Default: 0
44
+ #
45
+ # spaces_after_lparen The number of spaces to expect after an
46
+ # lparen ('(').
47
+ # Default: 0
48
+ #
49
+ # spaces_before_rparen The number of spaces to expect before an
50
+ # rbracket (')').
51
+ # Default: 0
52
+ #
53
+ #------------------------------------------------------------------------------
54
+ # Naming
55
+ #------------------------------------------------------------------------------
56
+ # allow_camel_case_methods
57
+ # Setting to true skips detection of camel-case method
58
+ # names (i.e. def myMethod).
59
+ # Default: false
60
+ #
61
+ # allow_screaming_snake_case_classes
62
+ # Setting to true skips detection of screaming
63
+ # snake-case class names (i.e. My_Class).
64
+ # Default: false
65
+ #
66
+ #------------------------------------------------------------------------------
67
+ # Vertical Whitespace
68
+ #------------------------------------------------------------------------------
69
+ # max_code_lines_in_class The number of lines of code in a class to allow before
70
+ # tailor will warn you.
71
+ # Default: 300
72
+ #
73
+ # max_code_lines_in_method
74
+ # The number of lines of code in a method to allow
75
+ # before tailor will warn you.
76
+ # Default: 30
77
+ #
78
+ # trailing_newlines The number of newlines that should be at the end of
79
+ # the file.
80
+ # Default: 1
81
+ #
82
+ Tailor.config do |config|
83
+ config.formatters "text"
84
+ config.file_set 'lib/**/*.rb' do |style|
85
+ style.allow_camel_case_methods false, level: :error
86
+ style.allow_hard_tabs false, level: :error
87
+ style.allow_screaming_snake_case_classes false, level: :error
88
+ style.allow_trailing_line_spaces false, level: :error
89
+ style.allow_invalid_ruby false, level: :warn
90
+ style.indentation_spaces 2, level: :error
91
+ style.max_code_lines_in_class 300, level: :error
92
+ style.max_code_lines_in_method 30, level: :error
93
+ style.max_line_length 80, level: :error
94
+ style.spaces_after_comma 1, level: :error
95
+ style.spaces_after_lbrace 1, level: :error
96
+ style.spaces_after_lbracket 0, level: :error
97
+ style.spaces_after_lparen 0, level: :error
98
+ style.spaces_before_comma 0, level: :error
99
+ style.spaces_before_lbrace 1, level: :error
100
+ style.spaces_before_rbrace 1, level: :error
101
+ style.spaces_before_rbracket 0, level: :error
102
+ style.spaces_before_rparen 0, level: :error
103
+ style.spaces_in_empty_braces 0, level: :error
104
+ style.trailing_newlines 1, level: :error
105
+ end
106
+ end
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 2.0.0
5
+ - 1.9.3
6
+ - 1.9.2
7
+ - ruby-head
8
+
9
+ matrix:
10
+ allow_failures:
11
+ - rvm: ruby-head
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ## 0.5.0 / 2013-05-20
2
+
3
+ The initial release, **BAM**!
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,10 @@
1
+ guard 'minitest' do
2
+ watch(%r|^spec/(.*)_spec\.rb|)
3
+ watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
4
+ watch(%r|^spec/spec_helper\.rb|) { "spec" }
5
+ end
6
+
7
+ guard 'cane' do
8
+ watch(%r|.*\.rb|)
9
+ watch('.cane')
10
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Fletcher Nichol
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,261 @@
1
+ # <a name="title"></a> Emeril: Tag And Release Chef Cookbooks As A Library
2
+
3
+ [![Build Status](https://travis-ci.org/fnichol/emeril.png?branch=master)](https://travis-ci.org/fnichol/emeril)
4
+ [![Dependency Status](https://gemnasium.com/fnichol/emeril.png)](https://gemnasium.com/fnichol/emeril)
5
+ [![Code Climate](https://codeclimate.com/github/fnichol/emeril.png)](https://codeclimate.com/github/fnichol/emeril)
6
+
7
+ Kick it up a notch! Emeril is a library that helps you release your Chef
8
+ cookbooks from Rake, Thor, or a Ruby library. If `rake release` is all you
9
+ are after, this should fit the bill.
10
+
11
+ ## <a name="tl-dr"></a> tl;dr
12
+
13
+ How do you get started? Without much fanfare&hellip;
14
+
15
+ ```sh
16
+ echo "gem 'emeril'" > Gemfile
17
+ bundle install
18
+ echo "require 'emeril/rake'" > Rakefile
19
+ bundle exec rake release
20
+ ```
21
+
22
+ **Bam!**
23
+
24
+ Need more details? Read on&hellip;
25
+
26
+ ## <a name="how-it-works"></a> How It Works
27
+
28
+ Emeril has 2 primary tasks and goals:
29
+
30
+ 1. Tag a Git commit with a semantic version tag with the form `"v1.2.5"` (by
31
+ default)
32
+ 2. Publish a versioned release of the cookbook to the
33
+ [Community Site][community_site]
34
+
35
+ The Git tagging is currently accomplished via shell out, so Git must be
36
+ installed on your system.
37
+
38
+ In order to bypass the deeply coupled `cookbook_path` assumptions that exist
39
+ in the Knife plugins, the publishing task (implemented by the
40
+ [Publisher class][publisher_class]) will create a temporary sandboxed copy
41
+ of the primary cookbook files for use by the
42
+ [CookbookSiteShare][knife_plugin] Knife plugin. The following files are
43
+ considered production cookbook files:
44
+
45
+ * `README.*`
46
+ * `CHANGELOG.*`
47
+ * `metadata.{json,rb}`
48
+ * `attributes/**/*`
49
+ * `files/**/*`
50
+ * `libraries/**/*`
51
+ * `providers/**/*`
52
+ * `recipes/**/*`
53
+ * `resources/**/*`
54
+ * `templates/**/*`
55
+
56
+ If the above list seems incomplete or incorrect, please submit an
57
+ [issue][issues].
58
+
59
+ ## <a name="installation"></a> Installation
60
+
61
+ Add this line to your application's Gemfile:
62
+
63
+ ```ruby
64
+ gem 'emeril'
65
+ ```
66
+
67
+ And then execute:
68
+
69
+ ```sh
70
+ bundle
71
+ ```
72
+
73
+ Or install it yourself as:
74
+
75
+ ```sh
76
+ gem install emeril
77
+ ```
78
+
79
+ ## <a name="usage"></a> Usage
80
+
81
+ ### <a name="usage-setup"></a> Credentials Setup
82
+
83
+ Emeril currently uses the [CookbookSiteShare][knife_plugin] to do most of the
84
+ heavy lifting, so you will need a minimally configured [knife.rb][knife_rb]
85
+ file with some required attributes set.
86
+
87
+ There are 2 configuration items you need:
88
+
89
+ 1. Your [Community Site][community_site] username, chosen at signup time.
90
+ 2. The file path to your [Community Site][community_site] user certificate.
91
+ When you sign up to the Community Site, the site will provide this key to
92
+ you as a `*.pem` file.
93
+
94
+ The easiest way to get setup is to add both of these items to your default
95
+ `knife.rb` file located at `$HOME/.chef/knife.rb`. If you are setting this
96
+ file up for the first time, give this a go (substituting your username, and
97
+ key location):
98
+
99
+ ```sh
100
+ mkdir -p $HOME/.chef
101
+ cat <<KNIFE_RB > $HOME/.chef/knife.rb
102
+ node_name "fnichol"
103
+ client_key File.expand_path('~/.chef/fnichol.pem')
104
+ KNIFE_RB
105
+ ```
106
+
107
+ ### <a name="usage-rake"></a> Rake Tasks
108
+
109
+ To add the default Rake task (`rake release`), add the following to your
110
+ `Rakefile`:
111
+
112
+ ```ruby
113
+ require 'emeril/rake'
114
+ ```
115
+
116
+ If you need to further customize the `Emeril::Releaser` object you can use
117
+ the more explicit format with a block:
118
+
119
+ ```ruby
120
+ require 'emeril/rake_tasks'
121
+
122
+ Emeril::RakeTasks.new do |t|
123
+ # turn on debug logging
124
+ t.config[:logger].level = :debug
125
+
126
+ # disable git tag prefix string
127
+ t.config[:tag_prefix] = false
128
+
129
+ # set a category for this cookbook
130
+ t.config[:category] = "Applications"
131
+ end
132
+ ```
133
+
134
+ ### <a name="usage-rake"></a> Thor Tasks
135
+
136
+ To add the default Thor task (`thor emeril:release`), add the following to your
137
+ `Thorfile`:
138
+
139
+ ```ruby
140
+ require 'emeril/thor'
141
+ ```
142
+
143
+ If you need to further customize the `Emeril::Releaser` object you can use
144
+ the more explicit format with a block:
145
+
146
+ ```ruby
147
+ require 'emeril/thor_tasks'
148
+
149
+ Emeril::ThorTasks.new do |t|
150
+ # turn on debug logging
151
+ t.config[:logger].level = :debug
152
+
153
+ # disable git tag prefix string
154
+ t.config[:tag_prefix] = false
155
+
156
+ # set a category for this cookbook
157
+ t.config[:category] = "Applications"
158
+ end
159
+ ```
160
+
161
+ ### <a name="usage-ruby"></a> Ruby Library
162
+
163
+ The Ruby API is fairly straight forward, but keep in mind that loading or
164
+ populating `Chef::Config[:node_name]` and `Chef::Config[:client_key]` is
165
+ the responsibility of the caller, not Emeril.
166
+
167
+ For example, to load configuration from [knife.rb][knife_rb] and invoke the
168
+ same code as the default Rake and Thor tasks, use the following:
169
+
170
+ ```ruby
171
+ # Populate Chef::Config from knife.rb
172
+ require 'chef/knife'
173
+ Chef::Knife.new.configure_chef
174
+
175
+ # Perform the git tagging and share to the Community Site
176
+ require 'emeril'
177
+ Emeril::Releaser.new(logger: Chef::Log).run
178
+ ```
179
+
180
+ ## <a name="faq"></a> Frequently Asked Questions
181
+
182
+ * **"Why doesn't Emeril automatically bump version numbers?"**
183
+ Emeril assumes that you are using a [Semantic Versioning][semver_site] scheme
184
+ for your cookbooks. Consequently it is very hard to determine what the
185
+ next version number should be when this number is coupled to the changes
186
+ accompanying the release. The next release could contain a bug fix, a new
187
+ feature, or contain a backwards incompatible change--all of which have a
188
+ bearing on the version number.
189
+ * **"Okay, what if I supplied the version number, couldn't Emeril help me
190
+ then?"** Perhaps, but don't forget the other essential release artifact:
191
+ a project [changelog][changelog_wikipedia]. While the maintenance schedule
192
+ of the changelog is up to each author, it is sometimes desirable to
193
+ combine the version bump and changelog items in [one][ex1] [git][ex2]
194
+ [commit][ex3]. Emeril will tag and release your cookbook based on the
195
+ last Git commit which is presumably your *version-bump-and-changelog*
196
+ commit.
197
+ * **"How do I change the category for my cookbook?"** Emeril will maintain
198
+ the category used on the Community Site across releases. By default, new
199
+ cookbooks will be put in the `"Other"` category. For now you can change
200
+ the category directly on the Community Site, done! Otherwise, check out
201
+ the [Rake](#usage-rake) and [Thor](#usage-thor) sections for further
202
+ configuration help.
203
+ * **"Why is Emeril complaining that I'm missing the name attribute in my
204
+ metadata.rb?"** You want to set this name attribute. It unambiguously sets
205
+ the name of the cookbook and not the directory name that happens to contain
206
+ the cookbook code. Modern tools such as [Berkshelf][berkshelf_site] require
207
+ this for dependency resolution and the [Foodcritic][foodcritic_site]
208
+ cookbook linting tool has rule [FC045][fc045] to help catch this omission.
209
+
210
+ ## <a name="alternatives"></a> Alternatives
211
+
212
+ * [knife-community][knife_community] - a more complete, workflow-enabled tool
213
+ by [Mike Fiedler](https://github.com/miketheman).
214
+ * [knife community site share][knife_share] - with some extra/manual git
215
+ tagging, correct directory structure, and workflow. Ships with the
216
+ [Chef gem][chef_gem].
217
+
218
+ ## <a name="development"></a> Development
219
+
220
+ * Source hosted at [GitHub][repo]
221
+ * Report issues/questions/feature requests on [GitHub Issues][issues]
222
+
223
+ Pull requests are very welcome! Make sure your patches are well tested.
224
+ Ideally create a topic branch for every separate change you make. For
225
+ example:
226
+
227
+ 1. Fork the repo
228
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
229
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
230
+ 4. Push to the branch (`git push origin my-new-feature`)
231
+ 5. Create new Pull Request
232
+
233
+ ## <a name="authors"></a> Authors
234
+
235
+ Created and maintained by [Fletcher Nichol][fnichol] (<fnichol@nichol.ca>)
236
+
237
+ ## <a name="license"></a> License
238
+
239
+ MIT (see [LICENSE.txt][license])
240
+
241
+ [license]: https://github.com/fnichol/emeril/blob/master/LICENSE.txt
242
+ [fnichol]: https://github.com/fnichol
243
+ [repo]: https://github.com/fnichol/emeril
244
+ [issues]: https://github.com/fnichol/emeril/issues
245
+ [contributors]: https://github.com/fnichol/emeril/contributors
246
+
247
+ [berkshelf_site]: http://berkshelf.com/
248
+ [changelog_wikipedia]: http://en.wikipedia.org/wiki/Changelog
249
+ [chef_gem]: https://github.com/opscode/chef
250
+ [community_site]: http://community.opscode.com/
251
+ [ex1]: https://github.com/fnichol/chef-ruby_build/commit/c940b5e9cd40eaba10d6285de6648f4d25fe959d
252
+ [ex2]: https://github.com/fnichol/chef-homesick/commit/80e558ff921f1c59698f6942214c0224a24392d7
253
+ [ex3]: https://github.com/fnichol/chef-openoffice/commit/bf84aba0690a6b155b499b06df953be19a3aead1
254
+ [fc045]: http://acrmp.github.io/foodcritic/#FC045
255
+ [foodcritic_site]: http://acrmp.github.io/foodcritic/
256
+ [knife_plugin]: https://github.com/opscode/chef/blob/master/lib/chef/knife/cookbook_site_share.rb
257
+ [knife_rb]: http://docs.opscode.com/config_rb_knife.html
258
+ [knife_community]: http://miketheman.github.io/knife-community/
259
+ [knife_share]: http://docs.opscode.com/knife_cookbook_site.html#share
260
+ [publisher_class]: https://github.com/fnichol/emeril/blob/master/lib/emeril/publisher.rb
261
+ [semver_site]: http://semver.org/