librarian-puppet-lmco 0.9.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +5 -0
  3. data/LICENSE +20 -0
  4. data/README.md +187 -0
  5. data/bin/librarian-puppet +9 -0
  6. data/lib/librarian/puppet.rb +22 -0
  7. data/lib/librarian/puppet/cli.rb +85 -0
  8. data/lib/librarian/puppet/dsl.rb +16 -0
  9. data/lib/librarian/puppet/environment.rb +54 -0
  10. data/lib/librarian/puppet/extension.rb +47 -0
  11. data/lib/librarian/puppet/lockfile/parser.rb +53 -0
  12. data/lib/librarian/puppet/source.rb +4 -0
  13. data/lib/librarian/puppet/source/forge.rb +348 -0
  14. data/lib/librarian/puppet/source/git.rb +121 -0
  15. data/lib/librarian/puppet/source/githubtarball.rb +249 -0
  16. data/lib/librarian/puppet/source/local.rb +57 -0
  17. data/lib/librarian/puppet/source/path.rb +12 -0
  18. data/lib/librarian/puppet/templates/Puppetfile +10 -0
  19. data/lib/librarian/puppet/version.rb +5 -0
  20. data/vendor/librarian/CHANGELOG.md +224 -0
  21. data/vendor/librarian/Gemfile +6 -0
  22. data/vendor/librarian/MIT-LICENSE +20 -0
  23. data/vendor/librarian/README.md +401 -0
  24. data/vendor/librarian/Rakefile +34 -0
  25. data/vendor/librarian/bin/librarian-chef +7 -0
  26. data/vendor/librarian/bin/librarian-mock +7 -0
  27. data/vendor/librarian/config/cucumber.yaml +1 -0
  28. data/vendor/librarian/features/chef/cli/init.feature +11 -0
  29. data/vendor/librarian/features/chef/cli/install.feature +64 -0
  30. data/vendor/librarian/features/chef/cli/show.feature +77 -0
  31. data/vendor/librarian/features/chef/cli/version.feature +11 -0
  32. data/vendor/librarian/features/support/env.rb +9 -0
  33. data/vendor/librarian/lib/librarian.rb +11 -0
  34. data/vendor/librarian/lib/librarian/action.rb +5 -0
  35. data/vendor/librarian/lib/librarian/action/base.rb +24 -0
  36. data/vendor/librarian/lib/librarian/action/clean.rb +44 -0
  37. data/vendor/librarian/lib/librarian/action/ensure.rb +24 -0
  38. data/vendor/librarian/lib/librarian/action/install.rb +95 -0
  39. data/vendor/librarian/lib/librarian/action/persist_resolution_mixin.rb +51 -0
  40. data/vendor/librarian/lib/librarian/action/resolve.rb +46 -0
  41. data/vendor/librarian/lib/librarian/action/update.rb +44 -0
  42. data/vendor/librarian/lib/librarian/chef.rb +1 -0
  43. data/vendor/librarian/lib/librarian/chef/cli.rb +47 -0
  44. data/vendor/librarian/lib/librarian/chef/dsl.rb +16 -0
  45. data/vendor/librarian/lib/librarian/chef/environment.rb +27 -0
  46. data/vendor/librarian/lib/librarian/chef/extension.rb +9 -0
  47. data/vendor/librarian/lib/librarian/chef/integration/knife.rb +46 -0
  48. data/vendor/librarian/lib/librarian/chef/manifest_reader.rb +59 -0
  49. data/vendor/librarian/lib/librarian/chef/source.rb +4 -0
  50. data/vendor/librarian/lib/librarian/chef/source/git.rb +25 -0
  51. data/vendor/librarian/lib/librarian/chef/source/github.rb +27 -0
  52. data/vendor/librarian/lib/librarian/chef/source/local.rb +69 -0
  53. data/vendor/librarian/lib/librarian/chef/source/path.rb +12 -0
  54. data/vendor/librarian/lib/librarian/chef/source/site.rb +442 -0
  55. data/vendor/librarian/lib/librarian/chef/templates/Cheffile +15 -0
  56. data/vendor/librarian/lib/librarian/cli.rb +223 -0
  57. data/vendor/librarian/lib/librarian/cli/manifest_presenter.rb +93 -0
  58. data/vendor/librarian/lib/librarian/config.rb +7 -0
  59. data/vendor/librarian/lib/librarian/config/database.rb +205 -0
  60. data/vendor/librarian/lib/librarian/config/file_source.rb +47 -0
  61. data/vendor/librarian/lib/librarian/config/hash_source.rb +33 -0
  62. data/vendor/librarian/lib/librarian/config/source.rb +149 -0
  63. data/vendor/librarian/lib/librarian/dependency.rb +147 -0
  64. data/vendor/librarian/lib/librarian/dsl.rb +108 -0
  65. data/vendor/librarian/lib/librarian/dsl/receiver.rb +46 -0
  66. data/vendor/librarian/lib/librarian/dsl/target.rb +171 -0
  67. data/vendor/librarian/lib/librarian/environment.rb +182 -0
  68. data/vendor/librarian/lib/librarian/error.rb +4 -0
  69. data/vendor/librarian/lib/librarian/helpers.rb +13 -0
  70. data/vendor/librarian/lib/librarian/linter/source_linter.rb +55 -0
  71. data/vendor/librarian/lib/librarian/lockfile.rb +29 -0
  72. data/vendor/librarian/lib/librarian/lockfile/compiler.rb +66 -0
  73. data/vendor/librarian/lib/librarian/lockfile/parser.rb +123 -0
  74. data/vendor/librarian/lib/librarian/logger.rb +46 -0
  75. data/vendor/librarian/lib/librarian/manifest.rb +140 -0
  76. data/vendor/librarian/lib/librarian/manifest_set.rb +151 -0
  77. data/vendor/librarian/lib/librarian/mock.rb +1 -0
  78. data/vendor/librarian/lib/librarian/mock/cli.rb +19 -0
  79. data/vendor/librarian/lib/librarian/mock/dsl.rb +15 -0
  80. data/vendor/librarian/lib/librarian/mock/environment.rb +24 -0
  81. data/vendor/librarian/lib/librarian/mock/extension.rb +9 -0
  82. data/vendor/librarian/lib/librarian/mock/source.rb +1 -0
  83. data/vendor/librarian/lib/librarian/mock/source/mock.rb +80 -0
  84. data/vendor/librarian/lib/librarian/mock/source/mock/registry.rb +83 -0
  85. data/vendor/librarian/lib/librarian/resolution.rb +46 -0
  86. data/vendor/librarian/lib/librarian/resolver.rb +81 -0
  87. data/vendor/librarian/lib/librarian/resolver/implementation.rb +223 -0
  88. data/vendor/librarian/lib/librarian/source.rb +2 -0
  89. data/vendor/librarian/lib/librarian/source/basic_api.rb +45 -0
  90. data/vendor/librarian/lib/librarian/source/git.rb +134 -0
  91. data/vendor/librarian/lib/librarian/source/git/repository.rb +217 -0
  92. data/vendor/librarian/lib/librarian/source/local.rb +54 -0
  93. data/vendor/librarian/lib/librarian/source/path.rb +56 -0
  94. data/vendor/librarian/lib/librarian/spec.rb +13 -0
  95. data/vendor/librarian/lib/librarian/spec_change_set.rb +173 -0
  96. data/vendor/librarian/lib/librarian/specfile.rb +17 -0
  97. data/vendor/librarian/lib/librarian/support/abstract_method.rb +21 -0
  98. data/vendor/librarian/lib/librarian/ui.rb +64 -0
  99. data/vendor/librarian/lib/librarian/version.rb +3 -0
  100. data/vendor/librarian/librarian.gemspec +35 -0
  101. data/vendor/librarian/spec/functional/chef/cli_spec.rb +194 -0
  102. data/vendor/librarian/spec/functional/chef/source/git_spec.rb +432 -0
  103. data/vendor/librarian/spec/functional/chef/source/site_spec.rb +266 -0
  104. data/vendor/librarian/spec/functional/source/git/repository_spec.rb +150 -0
  105. data/vendor/librarian/spec/integration/chef/source/git_spec.rb +441 -0
  106. data/vendor/librarian/spec/integration/chef/source/site_spec.rb +217 -0
  107. data/vendor/librarian/spec/support/cli_macro.rb +114 -0
  108. data/vendor/librarian/spec/support/method_patch_macro.rb +30 -0
  109. data/vendor/librarian/spec/support/with_env_macro.rb +20 -0
  110. data/vendor/librarian/spec/unit/action/base_spec.rb +18 -0
  111. data/vendor/librarian/spec/unit/action/clean_spec.rb +102 -0
  112. data/vendor/librarian/spec/unit/action/ensure_spec.rb +37 -0
  113. data/vendor/librarian/spec/unit/action/install_spec.rb +111 -0
  114. data/vendor/librarian/spec/unit/config/database_spec.rb +327 -0
  115. data/vendor/librarian/spec/unit/dependency_spec.rb +212 -0
  116. data/vendor/librarian/spec/unit/dsl_spec.rb +173 -0
  117. data/vendor/librarian/spec/unit/environment_spec.rb +173 -0
  118. data/vendor/librarian/spec/unit/lockfile/parser_spec.rb +162 -0
  119. data/vendor/librarian/spec/unit/lockfile_spec.rb +65 -0
  120. data/vendor/librarian/spec/unit/manifest_set_spec.rb +202 -0
  121. data/vendor/librarian/spec/unit/manifest_spec.rb +36 -0
  122. data/vendor/librarian/spec/unit/mock/source/mock_spec.rb +22 -0
  123. data/vendor/librarian/spec/unit/resolver_spec.rb +233 -0
  124. data/vendor/librarian/spec/unit/source/git_spec.rb +29 -0
  125. data/vendor/librarian/spec/unit/spec_change_set_spec.rb +169 -0
  126. metadata +220 -0
@@ -0,0 +1,6 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in librarian.gemspec
4
+ gemspec
5
+
6
+ gem "fakefs", :require => "fakefs/safe"
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 ApplicationsOnline, LLC.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,401 @@
1
+ Librarian [![Build Status](https://secure.travis-ci.org/applicationsonline/librarian.png)](http://travis-ci.org/applicationsonline/librarian) [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/applicationsonline/librarian)
2
+ =========
3
+
4
+ Librarian is a framework for writing bundlers, which are tools that resolve,
5
+ fetch, install, and isolate a project's dependencies, in Ruby.
6
+
7
+ Librarian ships with Librarian-Chef, which is a bundler for your Chef-based
8
+ infrastructure repositories. In the future, Librarian-Chef will be a separate
9
+ project.
10
+
11
+ A bundler written with Librarian will expect you to provide a specfile listing
12
+ your project's declared dependencies, including any version constraints and
13
+ including the upstream sources for finding them. Librarian can resolve the spec,
14
+ write a lockfile listing the full resolution, fetch the resolved dependencies,
15
+ install them, and isolate them in your project.
16
+
17
+ A bundler written with Librarian will be similar in kind to [Bundler](http://gembundler.com),
18
+ the bundler for Ruby gems that many modern Rails applications use.
19
+
20
+ Librarian-Chef
21
+ ---------------
22
+
23
+ Librarian-Chef is a tool that helps you manage the cookbooks that your chef-repo
24
+ depends on. Here are some more details.
25
+
26
+ Librarian-Chef is a bundler for infrastructure repositories using Chef. You can
27
+ use Librarian-Chef to resolve your infrastructure's cookbook dependencies, fetch
28
+ them, and install them into your infrastructure repository.
29
+
30
+ Librarian-Chef can resolve and fetch third-party, publicly-released cookbooks,
31
+ and install them into your infrastructure repository. It can also source
32
+ cookbooks directly from their own source control repositories.
33
+
34
+ Librarian-Chef can also deal with cookbooks you may actively be working on
35
+ outside your infrastructure repository. For example, it can deal with cookbooks
36
+ directly from their own private source control repositories, whether they are
37
+ remote or local to your machine, and it can deal with cookbooks released to and
38
+ hosted on a private cookbooks server.
39
+
40
+ Librarian-Chef is not primarily intended for dealing with the cookbooks you are
41
+ actively working on *within* your infrastructure repository. In such a case, you
42
+ can still use Librarian-Chef, but it is likely unnecessary.
43
+
44
+ Librarian-Chef *takes over* your `cookbooks/` directory and manages it for you
45
+ based on your `Cheffile`. Your `Cheffile` becomes the authoritative source for
46
+ the cookbooks your infrastructure repository depends on. You should not modify
47
+ the contents of your `cookbooks/` directory when using Librarian-Chef. If you
48
+ have cookbooks which are, rather than being separate projects, inherently part
49
+ of your infrastructure repository, then they should go in a separate directory,
50
+ like your `site-cookbooks/` directory, and you do not need to use Librarian-Chef
51
+ to manage them.
52
+
53
+ ### The Cheffile
54
+
55
+ Every infrastruture repository that uses Librarian-Chef will have a file named
56
+ `Cheffile` in the root directory of that repository. The full specification for
57
+ which third-party, publicly-released cookbooks your infrastructure repository
58
+ depends will go here.
59
+
60
+ Here's an example `Cheffile`:
61
+
62
+ site "http://community.opscode.com/api/v1"
63
+
64
+ cookbook "ntp"
65
+ cookbook "timezone", "0.0.1"
66
+
67
+ cookbook "rvm",
68
+ :git => "https://github.com/fnichol/chef-rvm",
69
+ :ref => "v0.7.1"
70
+
71
+ cookbook "cloudera",
72
+ :path => "vendor/cookbooks/cloudera-cookbook"
73
+
74
+ Here's how it works:
75
+
76
+ We start off by declaring the *default source* for this `Cheffile`.
77
+
78
+ site "http://community.opscode.com/api/v1"
79
+
80
+ This default source in this example is the Opscode Community Site API. This is
81
+ most likely what you will want for your default source. However, you can
82
+ certainly set up your own API-compatible HTTP endpoint if you want more control.
83
+
84
+ Any time we declare a cookbook dependency without also declaring a source for
85
+ that cookbook dependency, Librarian-Chef assumes we want it to look for that
86
+ cookbook in the default source.
87
+
88
+ Any time we declare a cookbook dependency that has subsidiary cookbook
89
+ dependencies of its own, Librarian-Chef assumes we want it to look for the
90
+ subsidiary cookbook dependencies in the default source.
91
+
92
+ cookbook "ntp"
93
+
94
+ Our infrastructure repository depends on the `ntp` cookbook from the default
95
+ source. Any version of the `ntp` cookbook will fulfill our requirements.
96
+
97
+ cookbook "timezone", "0.0.1"
98
+
99
+ Our infrastructure repository depends on the `timezone` cookbook from the
100
+ default source. But only version `0.0.1` of that cookbook will do.
101
+
102
+ cookbook "rvm",
103
+ :git => "https://github.com/fnichol/chef-rvm",
104
+ :ref => "v0.7.1"
105
+
106
+ Our infrastructure repository depends on the `rvm` cookbook, but not the one
107
+ from the default source. Instead, the cookbook is to be fetched from the
108
+ specified Git repository and from the specified Git tag only.
109
+
110
+ When using a Git source, we do not have to use a `:ref =>`. If we do not,
111
+ then Librarian-Chef will assume we meant the `master` branch. (In the future,
112
+ this will be changed to whatever branch is the default branch according to
113
+ the Git remote, which may not be `master`.)
114
+
115
+ If we use a `:ref =>`, we can use anything that Git will recognize as a ref.
116
+ This includes any branch name, tag name, SHA, or SHA unique prefix. If we use a
117
+ branch, we can later ask Librarian-Chef to update the cookbook by fetching the
118
+ most recent version of the cookbook from that same branch.
119
+
120
+ The Git source also supports a `:path =>` option. If we use the path option,
121
+ Librarian-Chef will navigate down into the Git repository and only use the
122
+ specified subdirectory. Many people have the habit of having a single repository
123
+ with many cookbooks in it. If we need a cookbook from such a repository, we can
124
+ use the `:path =>` option here to help Librarian-Chef drill down and find the
125
+ cookbook subdirectory.
126
+
127
+ cookbook "cloudera",
128
+ :path => "vendor/cookbooks/cloudera-cookbook"
129
+
130
+ Our infrastructure repository depends on the `cloudera` cookbook, which we have
131
+ downloaded and copied into our repository. In this example, `vendor/cookbooks/`
132
+ is only for use with Librarian-Chef. This directory should not appear in the
133
+ `.chef/knife.rb`. Librarian-Chef will, instead, copy this cookbook from where
134
+ we vendored it in our repository into the `cookbooks/` directory for us.
135
+
136
+ The `:path =>` source won't be confused with the `:git =>` source's `:path =>`
137
+ option.
138
+
139
+ Also, there is shortcut for cookbooks hosted on GitHub, so we may write:
140
+
141
+ cookbook "rvm",
142
+ :github => "fnichol/chef-rvm"
143
+
144
+ ### How to Use
145
+
146
+ Install Librarian-Chef:
147
+
148
+ $ gem install librarian
149
+
150
+ Prepare your infrastructure repository:
151
+
152
+ $ cd ~/path/to/chef-repo
153
+ $ git rm -r cookbooks
154
+ $ echo /cookbooks >> .gitignore
155
+ $ echo /tmp >> .gitignore
156
+
157
+ Librarian-Chef takes over your `cookbooks/` directory, and will always reinstall
158
+ the cookbooks listed the `Cheffile.lock` into your `cookbooks/` directory. Hence
159
+ you do not need your `cookbooks/` directory to be tracked in Git. If you
160
+ nevertheless want your `cookbooks/` directory to be tracked in Git, simple don't
161
+ `.gitignore` the directory.
162
+
163
+ If you are manually tracking/vendoring outside cookbooks within the repository,
164
+ put them in another directory such as `vendor/cookbooks/` and use the `:path =>`
165
+ source when declaring these cookbooks in your `Cheffile`. Most people will
166
+ typically not be manually tracking/vendoring outside cookbooks.
167
+
168
+ Librarian-Chef uses your `tmp/` directory for tempfiles and caches. You do not
169
+ need to track this directory in Git.
170
+
171
+ Make a Cheffile:
172
+
173
+ $ librarian-chef init
174
+
175
+ This creates an empty `Cheffile` with the Opscode Community Site API as the
176
+ default source.
177
+
178
+ Add dependencies and their sources to the `Cheffile`:
179
+
180
+ $ cat Cheffile
181
+ site 'http://community.opscode.com/api/v1'
182
+ cookbook 'ntp'
183
+ cookbook 'timezone', '0.0.1'
184
+ cookbook 'rvm',
185
+ :git => 'https://github.com/fnichol/chef-rvm',
186
+ :ref => 'v0.7.1'
187
+ cookbook 'cloudera',
188
+ :path => 'vendor/cookbooks/cloudera-cookbook'
189
+
190
+ This is the same `Cheffile` we saw above.
191
+
192
+ $ librarian-chef install [--clean] [--verbose]
193
+
194
+ This command looks at each `cookbook` declaration and fetches the cookbook from
195
+ the source specified, or from the default source if none is provided.
196
+
197
+ Each cookbook is inspected, its dependencies are determined, and each dependency
198
+ is also fetched. For example, if you declare `cookbook 'nagios'`, which
199
+ depends on other cookbooks such as `'php'`, then those other cookbooks
200
+ including `'php'` will be fetched. This goes all the way down the chain of
201
+ dependencies.
202
+
203
+ This command writes the complete resolution into `Cheffile.lock`.
204
+
205
+ This command then copies all of the fetched cookbooks into your `cookbooks/`
206
+ directory, overwriting whatever was there before. You can then use `knife
207
+ cookbook upload -all` to upload the cookbooks to your chef-server, if you are
208
+ using the client-server model.
209
+
210
+ Check your `Cheffile` and `Cheffile.lock` into version control:
211
+
212
+ $ git add Cheffile
213
+ $ git add Cheffile.lock
214
+ $ git commit -m "I want these particular versions of these particular cookbooks from these particular."
215
+
216
+ Make sure you check your `Cheffile.lock` into version control. This will ensure
217
+ dependencies do not need to be resolved every run, greatly reducing dependency
218
+ resolution time.
219
+
220
+ Get an overview of your `Cheffile.lock` with:
221
+
222
+ $ librarian-chef show
223
+
224
+ Inspect the details of specific resolved dependencies with:
225
+
226
+ $ librarian-chef show NAME1 [NAME2, ...]
227
+
228
+ Update your `Cheffile` with new/changed/removed constraints/sources/dependencies:
229
+
230
+ $ cat Cheffile
231
+ site 'http://community.opscode.com/api/v1'
232
+ cookbook 'ntp'
233
+ cookbook 'timezone', '0.0.1'
234
+ cookbook 'rvm',
235
+ :git => 'https://github.com/fnichol/chef-rvm',
236
+ :ref => 'v0.7.1'
237
+ cookbook 'monit' # new!
238
+ $ git diff Cheffile
239
+ $ librarian-chef install [--verbose]
240
+ $ git diff Cheffile.lock
241
+ $ git add Cheffile
242
+ $ git add Cheffile.lock
243
+ $ git commit -m "I also want these additional cookbooks."
244
+
245
+ Find out which dependencies are outdated and may be updated:
246
+
247
+ $ librarian-chef outdated [--verbose]
248
+
249
+ Update the version of a dependency:
250
+
251
+ $ librarian-chef update ntp timezone monit [--verbose]
252
+ $ git diff Cheffile.lock
253
+ $ git add Cheffile.lock
254
+ $ git commit -m "I want updated versions of these cookbooks."
255
+
256
+ Push your changes to the git repository:
257
+
258
+ $ git push origin master
259
+
260
+ Upload the cookbooks to your chef-server:
261
+
262
+ $ knife cookbook upload --all
263
+
264
+ ### Configuration
265
+
266
+ Configuration comes from three sources with the following highest-to-lowest
267
+ precedence:
268
+
269
+ * The local config (`./.librarian/chef/config`)
270
+ * The environment
271
+ * The global config (`~/.librarian/chef/config`)
272
+
273
+ You can inspect the final configuration with:
274
+
275
+ $ librarian-chef config
276
+
277
+ You can find out where a particular key is set with:
278
+
279
+ $ librarian-chef config KEY
280
+
281
+ You can set a key at the global level with:
282
+
283
+ $ librarian-chef config KEY VALUE --global
284
+
285
+ And remove it with:
286
+
287
+ $ librarian-chef config KEY --global --delete
288
+
289
+ You can set a key at the local level with:
290
+
291
+ $ librarian-chef config KEY VALUE --local
292
+
293
+ And remove it with:
294
+
295
+ $ librarian-chef config KEY --local --delete
296
+
297
+ You cannot set or delete environment-level config keys with the CLI.
298
+
299
+ Configuration set at either the global or local level will affect subsequent
300
+ invocations of `librarian-chef`. Configurations set at the environment level are
301
+ not saved and will not affect subsequent invocations of `librarian-chef`.
302
+
303
+ You can pass a config at the environment level by taking the original config key
304
+ and transforming it: replace hyphens (`-`) with underscores (`_`) and periods
305
+ (`.`) with doubled underscores (`__`), uppercase, and finally prefix with
306
+ `LIBRARIAN_CHEF_`. For example, to pass a config in the environment for the key
307
+ `part-one.part-two`, set the environment variable
308
+ `LIBRARIAN_CHEF_PART_ONE__PART_TWO`.
309
+
310
+ Configuration affects how various commands operate.
311
+
312
+ * The `path` config sets the cookbooks directory to install to. If a relative
313
+ path, it is relative to the directory containing the `Cheffile`. The
314
+ equivalent environment variable is `LIBRARIAN_CHEF_PATH`.
315
+
316
+ * The `install.strip-dot-git` config causes the `.git/` directory to be stripped
317
+ out when installing cookbooks from a git source. This must be set to exactly
318
+ "1" to cause this behavior. The equivalent environment variable is
319
+ `LIBRARIAN_CHEF_INSTALL__STRIP_DOT_GIT`.
320
+
321
+ Configuration can be set by passing specific options to other commands.
322
+
323
+ * The `path` config can be set at the local level by passing the `--path` option
324
+ to the `install` command. It can be unset at the local level by passing the
325
+ `--no-path` option to the `install` command. Note that if this is set at the
326
+ environment or global level then, even if `--no-path` is given as an option,
327
+ the environment or global config will be used.
328
+
329
+ * The `install.strip-dot-git` config can be set at the local level by passing
330
+ the `--strip-dot-git` option to the `install` command. It can be unset at the
331
+ local level by passing the `--no-strip-dot-git` option.
332
+
333
+ ### Knife Integration
334
+
335
+ You can integrate your `knife.rb` with Librarian-Chef.
336
+
337
+ Stick the following in your `knife.rb`:
338
+
339
+ require 'librarian/chef/integration/knife'
340
+ cookbook_path Librarian::Chef.install_path,
341
+ "/path/to/chef-repo/site-cookbooks"
342
+
343
+ In the above, do *not* to include the path to your `cookbooks/` directory. If
344
+ you have additional cookbooks directories in your chef-repo that you use for
345
+ vendored cookbooks (where you use the `:path =>` source in your `Cheffile`),
346
+ make sure *not* to include the paths to those additional cookbooks directories
347
+ either.
348
+
349
+ You still need to include your `site-cookbooks/` directory in the above list.
350
+
351
+ What this integration does is whenever you use any `knife` command, it will:
352
+
353
+ * Enforce that your `Cheffile` and `Cheffile.lock` are in sync
354
+ * Install the resolved cookbooks to a temporary directory
355
+ * Configure Knife to look in the temporary directory for the installed cookbooks
356
+ and not in the normal `cookbooks/` directory.
357
+
358
+ When you use this integration, any changes you make to anything in the
359
+ `cookbooks/` directory will be ignored by Knife, because Knife won't look in
360
+ that directory for your cookbooks.
361
+
362
+ How to Contribute
363
+ -----------------
364
+
365
+ ### Running the tests
366
+
367
+ $ rspec spec
368
+
369
+ You will probably need some way to isolate gems. Librarian provides a `Gemfile`,
370
+ so if you want to use bundler, you can prepare the directory with the usual
371
+ `bundle install` and run each command prefixed with the usual `bundle exec`, as:
372
+
373
+ $ bundle install
374
+ $ bundle exec rspec spec
375
+
376
+ ### Installing locally
377
+
378
+ $ rake install
379
+
380
+ You should typically not need to install locally, if you are simply trying to
381
+ patch a bug and test the result on a test case. Instead of installing locally,
382
+ you are probably better served by:
383
+
384
+ $ cd $PATH_TO_INFRASTRUCTURE_REPO
385
+ $ $PATH_TO_LIBRARIAN_CHECKOUT/bin/librarian-chef install [--verbose]
386
+
387
+ ### Reporting Issues
388
+
389
+ Please include relevant `Cheffile` and `Cheffile.lock` files. Please run the
390
+ `librarian-chef` commands in verbose mode by using the `--verbose` flag, and
391
+ include the verbose output in the bug report as well.
392
+
393
+ License
394
+ -------
395
+
396
+ Written by Jay Feldblum.
397
+
398
+ Copyright (c) 2011-2012 ApplicationsOnline, LLC.
399
+
400
+ Released under the terms of the MIT License. For further information, please see
401
+ the file `MIT-LICENSE`.
@@ -0,0 +1,34 @@
1
+ require 'bundler'
2
+
3
+ module Bundler
4
+ class GemHelper
5
+
6
+ def build_gem_with_built_spec
7
+ spec = Gem::Specification.load(spec_path)
8
+ spec_ruby = spec.to_ruby
9
+ original_spec_path = spec_path + ".original"
10
+ FileUtils.mv(spec_path, original_spec_path)
11
+ File.open(spec_path, "wb"){|f| f.write(spec_ruby)}
12
+ build_gem_without_built_spec
13
+ ensure
14
+ FileUtils.mv(original_spec_path, spec_path)
15
+ end
16
+
17
+ alias build_gem_without_built_spec build_gem
18
+ alias build_gem build_gem_with_built_spec
19
+
20
+ end
21
+ end
22
+
23
+ Bundler::GemHelper.install_tasks
24
+
25
+ begin
26
+ require 'rspec/core/rake_task'
27
+ RSpec::Core::RakeTask.new(:spec)
28
+
29
+ require 'cucumber/rake/task'
30
+ Cucumber::Rake::Task.new(:features)
31
+
32
+ task :default => [:spec, :features]
33
+ rescue LoadError
34
+ end