librarian-chef-nochef 0.1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ea91ccc5f7006b77445fedb1a2ab9d9aa6065ca5
4
+ data.tar.gz: 71d7308d5e6bdc20b5e282443ad3853be43ba4c4
5
+ SHA512:
6
+ metadata.gz: 3fe405bcc7a9b730cc037afbcff568425874fa6d5e726e88209a6a9dc2b5a4625aaf6cb4fbd292920025f9beddc9abeab3427ad0ee01b95df119b9e55bc5e11a
7
+ data.tar.gz: 25c3866794c15f8b068b52d316478c173a277a47f1a0e5f2858678ef6d7321a6a5d2d0d5e685bd8825d8cda802cfa16ae737476e21e4a267bc9d8907cbb4e56a
@@ -0,0 +1,9 @@
1
+ /*.gem
2
+ /.bundle
3
+ /Gemfile.lock
4
+ /pkg/*
5
+ /tmp
6
+ /vendor
7
+
8
+ /bin/*
9
+ !/bin/librarian-chef
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,16 @@
1
+ language: ruby
2
+ script: rspec spec
3
+ rvm:
4
+ - 1.8.7
5
+ - 1.9.2
6
+ - 1.9.3
7
+ - 2.0.0
8
+ - rbx
9
+ - jruby-18mode
10
+ - jruby-19mode
11
+ - ruby-head
12
+ matrix:
13
+ allow_failures:
14
+ - rvm: jruby-18mode
15
+ - rvm: jruby-19mode
16
+ - rvm: ruby-head
@@ -0,0 +1,9 @@
1
+ # Change Log
2
+
3
+ ## 0.0.2
4
+
5
+ * Support tar cookbook archives in addition to targz cookbook archives.
6
+
7
+ ## 0.0.1
8
+
9
+ * Extract the chef adapter to its own gem.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in librarian-chef.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2011 ApplicationsOnline, LLC.
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.
@@ -0,0 +1,396 @@
1
+ # Librarian-Chef-Nochef
2
+
3
+ A fork of the [librarian-chef](https://github.com/applicationsonline/librarian-chef)
4
+ gem that doesn't depend on chef.
5
+
6
+ Install running:
7
+
8
+ $ gem install librarian-chef-nochef
9
+
10
+ Below the original librarian-chef README:
11
+
12
+ =========
13
+
14
+ Librarian-Chef is a bundler for your Chef-based infrastructure repositories.
15
+
16
+ It is a tool that helps you manage the cookbooks that your chef-repo depends on.
17
+ Here are some more details.
18
+
19
+ Librarian-Chef is a bundler for infrastructure repositories using Chef. You can
20
+ use Librarian-Chef to resolve your infrastructure's cookbook dependencies, fetch
21
+ them, and install them into your infrastructure repository.
22
+
23
+ Librarian-Chef can resolve and fetch third-party, publicly-released cookbooks,
24
+ and install them into your infrastructure repository. It can also source
25
+ cookbooks directly from their own source control repositories.
26
+
27
+ Librarian-Chef can also deal with cookbooks you may actively be working on
28
+ outside your infrastructure repository. For example, it can deal with cookbooks
29
+ directly from their own private source control repositories, whether they are
30
+ remote or local to your machine, and it can deal with cookbooks released to and
31
+ hosted on a private cookbooks server.
32
+
33
+ Librarian-Chef is not primarily intended for dealing with the cookbooks you are
34
+ actively working on *within* your infrastructure repository. In such a case, you
35
+ can still use Librarian-Chef, but it is likely unnecessary.
36
+
37
+ Librarian-Chef *takes over* your `cookbooks/` directory and manages it for you
38
+ based on your `Cheffile`. Your `Cheffile` becomes the authoritative source for
39
+ the cookbooks your infrastructure repository depends on. You should not modify
40
+ the contents of your `cookbooks/` directory when using Librarian-Chef. If you
41
+ have cookbooks which are, rather than being separate projects, inherently part
42
+ of your infrastructure repository, then they should go in a separate directory,
43
+ like your `site-cookbooks/` directory, and you do not need to use Librarian-Chef
44
+ to manage them.
45
+
46
+ ### The Cheffile
47
+
48
+ Every infrastructure repository that uses Librarian-Chef will have a file named
49
+ `Cheffile` in the root directory of that repository. The full specification for
50
+ which third-party, publicly-released cookbooks your infrastructure repository
51
+ depends will go here.
52
+
53
+ Here's an example `Cheffile`:
54
+
55
+ site "http://community.opscode.com/api/v1"
56
+
57
+ cookbook "ntp"
58
+ cookbook "timezone", "0.0.1"
59
+
60
+ cookbook "rvm",
61
+ :git => "https://github.com/fnichol/chef-rvm",
62
+ :ref => "v0.7.1"
63
+
64
+ cookbook "cloudera",
65
+ :path => "vendor/cookbooks/cloudera-cookbook"
66
+
67
+ Here's how it works:
68
+
69
+ We start off by declaring the *default source* for this `Cheffile`.
70
+
71
+ site "http://community.opscode.com/api/v1"
72
+
73
+ This default source in this example is the Opscode Community Site API. This is
74
+ most likely what you will want for your default source. However, you can
75
+ certainly set up your own API-compatible HTTP endpoint if you want more control.
76
+
77
+ Any time we declare a cookbook dependency without also declaring a source for
78
+ that cookbook dependency, Librarian-Chef assumes we want it to look for that
79
+ cookbook in the default source.
80
+
81
+ Any time we declare a cookbook dependency that has subsidiary cookbook
82
+ dependencies of its own, Librarian-Chef assumes we want it to look for the
83
+ subsidiary cookbook dependencies in the default source.
84
+
85
+ cookbook "ntp"
86
+
87
+ Our infrastructure repository depends on the `ntp` cookbook from the default
88
+ source. Any version of the `ntp` cookbook will fulfill our requirements.
89
+
90
+ cookbook "timezone", "0.0.1"
91
+
92
+ Our infrastructure repository depends on the `timezone` cookbook from the
93
+ default source. But only version `0.0.1` of that cookbook will do.
94
+
95
+ cookbook "rvm",
96
+ :git => "https://github.com/fnichol/chef-rvm",
97
+ :ref => "v0.7.1"
98
+
99
+ Our infrastructure repository depends on the `rvm` cookbook, but not the one
100
+ from the default source. Instead, the cookbook is to be fetched from the
101
+ specified Git repository and from the specified Git tag only.
102
+
103
+ When using a Git source, we do not have to use a `:ref =>`. If we do not,
104
+ then Librarian-Chef will assume we meant the `master` branch. (In the future,
105
+ this will be changed to whatever branch is the default branch according to
106
+ the Git remote, which may not be `master`.)
107
+
108
+ If we use a `:ref =>`, we can use anything that Git will recognize as a ref.
109
+ This includes any branch name, tag name, SHA, or SHA unique prefix. If we use a
110
+ branch, we can later ask Librarian-Chef to update the cookbook by fetching the
111
+ most recent version of the cookbook from that same branch.
112
+
113
+ The Git source also supports a `:path =>` option. If we use the path option,
114
+ Librarian-Chef will navigate down into the Git repository and only use the
115
+ specified subdirectory. Many people have the habit of having a single repository
116
+ with many cookbooks in it. If we need a cookbook from such a repository, we can
117
+ use the `:path =>` option here to help Librarian-Chef drill down and find the
118
+ cookbook subdirectory.
119
+
120
+ cookbook "cloudera",
121
+ :path => "vendor/cookbooks/cloudera-cookbook"
122
+
123
+ Our infrastructure repository depends on the `cloudera` cookbook, which we have
124
+ downloaded and copied into our repository. In this example, `vendor/cookbooks/`
125
+ is only for use with Librarian-Chef. This directory should not appear in the
126
+ `.chef/knife.rb`. Librarian-Chef will, instead, copy this cookbook from where
127
+ we vendored it in our repository into the `cookbooks/` directory for us.
128
+
129
+ The `:path =>` source won't be confused with the `:git =>` source's `:path =>`
130
+ option.
131
+
132
+ Also, there is shortcut for cookbooks hosted on GitHub, so we may write:
133
+
134
+ cookbook "rvm",
135
+ :github => "fnichol/chef-rvm"
136
+
137
+ ### How to Use
138
+
139
+ Install Librarian-Chef:
140
+
141
+ $ gem install librarian-chef
142
+
143
+ Prepare your infrastructure repository:
144
+
145
+ $ cd ~/path/to/chef-repo
146
+ $ git rm -r cookbooks
147
+ $ echo /cookbooks >> .gitignore
148
+ $ echo /tmp >> .gitignore
149
+
150
+ Librarian-Chef takes over your `cookbooks/` directory, and will always reinstall
151
+ the cookbooks listed the `Cheffile.lock` into your `cookbooks/` directory. Hence
152
+ you do not need your `cookbooks/` directory to be tracked in Git. If you
153
+ nevertheless want your `cookbooks/` directory to be tracked in Git, simply don't
154
+ `.gitignore` the directory.
155
+
156
+ If you are manually tracking/vendoring outside cookbooks within the repository,
157
+ put them in another directory such as `vendor/cookbooks/` and use the `:path =>`
158
+ source when declaring these cookbooks in your `Cheffile`. Most people will
159
+ typically not be manually tracking/vendoring outside cookbooks.
160
+
161
+ Librarian-Chef uses your `tmp/` directory for tempfiles and caches. You do not
162
+ need to track this directory in Git.
163
+
164
+ Make a Cheffile:
165
+
166
+ $ librarian-chef init
167
+
168
+ This creates an empty `Cheffile` with the Opscode Community Site API as the
169
+ default source.
170
+
171
+ Add dependencies and their sources to the `Cheffile`:
172
+
173
+ $ cat Cheffile
174
+ site 'http://community.opscode.com/api/v1'
175
+ cookbook 'ntp'
176
+ cookbook 'timezone', '0.0.1'
177
+ cookbook 'rvm',
178
+ :git => 'https://github.com/fnichol/chef-rvm',
179
+ :ref => 'v0.7.1'
180
+ cookbook 'cloudera',
181
+ :path => 'vendor/cookbooks/cloudera-cookbook'
182
+
183
+ This is the same `Cheffile` we saw above.
184
+
185
+ $ librarian-chef install [--clean] [--verbose]
186
+
187
+ This command looks at each `cookbook` declaration and fetches the cookbook from
188
+ the source specified, or from the default source if none is provided.
189
+
190
+ Each cookbook is inspected, its dependencies are determined, and each dependency
191
+ is also fetched. For example, if you declare `cookbook 'nagios'`, which
192
+ depends on other cookbooks such as `'php'`, then those other cookbooks
193
+ including `'php'` will be fetched. This goes all the way down the chain of
194
+ dependencies.
195
+
196
+ This command writes the complete resolution into `Cheffile.lock`.
197
+
198
+ This command then copies all of the fetched cookbooks into your `cookbooks/`
199
+ directory, overwriting whatever was there before. You can then use `knife
200
+ cookbook upload -all` to upload the cookbooks to your chef-server, if you are
201
+ using the client-server model.
202
+
203
+ Check your `Cheffile` and `Cheffile.lock` into version control:
204
+
205
+ $ git add Cheffile
206
+ $ git add Cheffile.lock
207
+ $ git commit -m "I want these particular versions of these particular cookbooks from these particular."
208
+
209
+ Make sure you check your `Cheffile.lock` into version control. This will ensure
210
+ dependencies do not need to be resolved every run, greatly reducing dependency
211
+ resolution time.
212
+
213
+ Get an overview of your `Cheffile.lock` with:
214
+
215
+ $ librarian-chef show
216
+
217
+ Inspect the details of specific resolved dependencies with:
218
+
219
+ $ librarian-chef show NAME1 [NAME2, ...]
220
+
221
+ Update your `Cheffile` with new/changed/removed constraints/sources/dependencies:
222
+
223
+ $ cat Cheffile
224
+ site 'http://community.opscode.com/api/v1'
225
+ cookbook 'ntp'
226
+ cookbook 'timezone', '0.0.1'
227
+ cookbook 'rvm',
228
+ :git => 'https://github.com/fnichol/chef-rvm',
229
+ :ref => 'v0.7.1'
230
+ cookbook 'monit' # new!
231
+ $ git diff Cheffile
232
+ $ librarian-chef install [--verbose]
233
+ $ git diff Cheffile.lock
234
+ $ git add Cheffile
235
+ $ git add Cheffile.lock
236
+ $ git commit -m "I also want these additional cookbooks."
237
+
238
+ Find out which dependencies are outdated and may be updated:
239
+
240
+ $ librarian-chef outdated [--verbose]
241
+
242
+ Update the version of a dependency:
243
+
244
+ $ librarian-chef update ntp timezone monit [--verbose]
245
+ $ git diff Cheffile.lock
246
+ $ git add Cheffile.lock
247
+ $ git commit -m "I want updated versions of these cookbooks."
248
+
249
+ Push your changes to the git repository:
250
+
251
+ $ git push origin master
252
+
253
+ Upload the cookbooks to your chef-server:
254
+
255
+ $ knife cookbook upload --all
256
+
257
+ ### Configuration
258
+
259
+ Configuration comes from three sources with the following highest-to-lowest
260
+ precedence:
261
+
262
+ * The local config (`./.librarian/chef/config`)
263
+ * The environment
264
+ * The global config (`~/.librarian/chef/config`)
265
+
266
+ You can inspect the final configuration with:
267
+
268
+ $ librarian-chef config
269
+
270
+ You can find out where a particular key is set with:
271
+
272
+ $ librarian-chef config KEY
273
+
274
+ You can set a key at the global level with:
275
+
276
+ $ librarian-chef config KEY VALUE --global
277
+
278
+ And remove it with:
279
+
280
+ $ librarian-chef config KEY --global --delete
281
+
282
+ You can set a key at the local level with:
283
+
284
+ $ librarian-chef config KEY VALUE --local
285
+
286
+ And remove it with:
287
+
288
+ $ librarian-chef config KEY --local --delete
289
+
290
+ You cannot set or delete environment-level config keys with the CLI.
291
+
292
+ Configuration set at either the global or local level will affect subsequent
293
+ invocations of `librarian-chef`. Configurations set at the environment level are
294
+ not saved and will not affect subsequent invocations of `librarian-chef`.
295
+
296
+ You can pass a config at the environment level by taking the original config key
297
+ and transforming it: replace hyphens (`-`) with underscores (`_`) and periods
298
+ (`.`) with doubled underscores (`__`), uppercase, and finally prefix with
299
+ `LIBRARIAN_CHEF_`. For example, to pass a config in the environment for the key
300
+ `part-one.part-two`, set the environment variable
301
+ `LIBRARIAN_CHEF_PART_ONE__PART_TWO`.
302
+
303
+ Configuration affects how various commands operate.
304
+
305
+ * The `path` config sets the cookbooks directory to install to. If a relative
306
+ path, it is relative to the directory containing the `Cheffile`. The
307
+ equivalent environment variable is `LIBRARIAN_CHEF_PATH`.
308
+
309
+ * The `tmp` config sets the cache directory for librarian. If a relative
310
+ path, it is relative to the directory containing the `Cheffile`. The
311
+ equivalent environment variable is `LIBRARIAN_CHEF_TMP`.
312
+
313
+ * The `install.strip-dot-git` config causes the `.git/` directory to be stripped
314
+ out when installing cookbooks from a git source. This must be set to exactly
315
+ "1" to cause this behavior. The equivalent environment variable is
316
+ `LIBRARIAN_CHEF_INSTALL__STRIP_DOT_GIT`.
317
+
318
+ Configuration can be set by passing specific options to other commands.
319
+
320
+ * The `path` config can be set at the local level by passing the `--path` option
321
+ to the `install` command. It can be unset at the local level by passing the
322
+ `--no-path` option to the `install` command. Note that if this is set at the
323
+ environment or global level then, even if `--no-path` is given as an option,
324
+ the environment or global config will be used.
325
+
326
+ * The `install.strip-dot-git` config can be set at the local level by passing
327
+ the `--strip-dot-git` option to the `install` command. It can be unset at the
328
+ local level by passing the `--no-strip-dot-git` option.
329
+
330
+ ### Knife Integration
331
+
332
+ You can integrate your `knife.rb` with Librarian-Chef.
333
+
334
+ Stick the following in your `knife.rb`:
335
+
336
+ require 'librarian/chef/integration/knife'
337
+ cookbook_path Librarian::Chef.install_path,
338
+ "/path/to/chef-repo/site-cookbooks"
339
+
340
+ In the above, do *not* to include the path to your `cookbooks/` directory. If
341
+ you have additional cookbooks directories in your chef-repo that you use for
342
+ vendored cookbooks (where you use the `:path =>` source in your `Cheffile`),
343
+ make sure *not* to include the paths to those additional cookbooks directories
344
+ either.
345
+
346
+ You still need to include your `site-cookbooks/` directory in the above list.
347
+
348
+ What this integration does is whenever you use any `knife` command, it will:
349
+
350
+ * Enforce that your `Cheffile` and `Cheffile.lock` are in sync
351
+ * Install the resolved cookbooks to a temporary directory
352
+ * Configure Knife to look in the temporary directory for the installed cookbooks
353
+ and not in the normal `cookbooks/` directory.
354
+
355
+ When you use this integration, any changes you make to anything in the
356
+ `cookbooks/` directory will be ignored by Knife, because Knife won't look in
357
+ that directory for your cookbooks.
358
+
359
+ How to Contribute
360
+ -----------------
361
+
362
+ ### Running the tests
363
+
364
+ Ensure the gem dependencies are installed:
365
+
366
+ $ bundle
367
+
368
+ Run the tests
369
+
370
+ $ [bundle exec] rspec spec
371
+
372
+ ### Installing locally
373
+
374
+ Ensure the gem dependencies are installed:
375
+
376
+ $ bundle
377
+
378
+ Install from the repository:
379
+
380
+ $ [bundle exec] rake install
381
+
382
+ ### Reporting Issues
383
+
384
+ Please include relevant `Cheffile` and `Cheffile.lock` files. Please run the
385
+ `librarian-chef` commands in verbose mode by using the `--verbose` flag, and
386
+ include the verbose output in the bug report as well.
387
+
388
+ License
389
+ -------
390
+
391
+ Written by Jay Feldblum.
392
+
393
+ Copyright (c) 2013 ApplicationsOnline, LLC.
394
+
395
+ Released under the terms of the MIT License. For further information, please see
396
+ the file `LICENSE.txt`.