librarian-puppet 0.0.1.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. data/.gitignore +1 -0
  2. data/LICENSE +20 -0
  3. data/README.md +0 -0
  4. data/bin/librarian-puppet +9 -0
  5. data/lib/librarian/puppet.rb +7 -0
  6. data/lib/librarian/puppet/cli.rb +30 -0
  7. data/lib/librarian/puppet/dsl.rb +14 -0
  8. data/lib/librarian/puppet/environment.rb +18 -0
  9. data/lib/librarian/puppet/extension.rb +9 -0
  10. data/lib/librarian/puppet/source.rb +2 -0
  11. data/lib/librarian/puppet/source/git.rb +12 -0
  12. data/lib/librarian/puppet/source/local.rb +46 -0
  13. data/lib/librarian/puppet/source/path.rb +12 -0
  14. data/lib/librarian/puppet/templates/Puppetfile +6 -0
  15. data/librarian-puppet.gemspec +126 -0
  16. data/vendor/librarian/.rspec +1 -0
  17. data/vendor/librarian/.travis.yml +6 -0
  18. data/vendor/librarian/CHANGELOG.md +168 -0
  19. data/vendor/librarian/Gemfile +4 -0
  20. data/vendor/librarian/MIT-LICENSE +20 -0
  21. data/vendor/librarian/README.md +318 -0
  22. data/vendor/librarian/Rakefile +34 -0
  23. data/vendor/librarian/bin/librarian-chef +7 -0
  24. data/vendor/librarian/bin/librarian-mock +7 -0
  25. data/vendor/librarian/config/cucumber.yaml +1 -0
  26. data/vendor/librarian/features/chef/cli/init.feature +10 -0
  27. data/vendor/librarian/features/chef/cli/install.feature +64 -0
  28. data/vendor/librarian/features/chef/cli/show.feature +65 -0
  29. data/vendor/librarian/features/chef/cli/version.feature +11 -0
  30. data/vendor/librarian/features/support/env.rb +9 -0
  31. data/vendor/librarian/lib/librarian.rb +19 -0
  32. data/vendor/librarian/lib/librarian/action.rb +5 -0
  33. data/vendor/librarian/lib/librarian/action/base.rb +22 -0
  34. data/vendor/librarian/lib/librarian/action/clean.rb +44 -0
  35. data/vendor/librarian/lib/librarian/action/ensure.rb +24 -0
  36. data/vendor/librarian/lib/librarian/action/install.rb +95 -0
  37. data/vendor/librarian/lib/librarian/action/resolve.rb +81 -0
  38. data/vendor/librarian/lib/librarian/action/update.rb +78 -0
  39. data/vendor/librarian/lib/librarian/chef.rb +1 -0
  40. data/vendor/librarian/lib/librarian/chef/cli.rb +27 -0
  41. data/vendor/librarian/lib/librarian/chef/dsl.rb +15 -0
  42. data/vendor/librarian/lib/librarian/chef/environment.rb +19 -0
  43. data/vendor/librarian/lib/librarian/chef/extension.rb +9 -0
  44. data/vendor/librarian/lib/librarian/chef/integration/knife.rb +42 -0
  45. data/vendor/librarian/lib/librarian/chef/manifest_reader.rb +47 -0
  46. data/vendor/librarian/lib/librarian/chef/source.rb +3 -0
  47. data/vendor/librarian/lib/librarian/chef/source/git.rb +12 -0
  48. data/vendor/librarian/lib/librarian/chef/source/local.rb +63 -0
  49. data/vendor/librarian/lib/librarian/chef/source/path.rb +12 -0
  50. data/vendor/librarian/lib/librarian/chef/source/site.rb +434 -0
  51. data/vendor/librarian/lib/librarian/chef/templates/Cheffile +15 -0
  52. data/vendor/librarian/lib/librarian/cli.rb +175 -0
  53. data/vendor/librarian/lib/librarian/cli/manifest_presenter.rb +79 -0
  54. data/vendor/librarian/lib/librarian/dependency.rb +95 -0
  55. data/vendor/librarian/lib/librarian/dsl.rb +105 -0
  56. data/vendor/librarian/lib/librarian/dsl/receiver.rb +48 -0
  57. data/vendor/librarian/lib/librarian/dsl/target.rb +176 -0
  58. data/vendor/librarian/lib/librarian/environment.rb +129 -0
  59. data/vendor/librarian/lib/librarian/error.rb +4 -0
  60. data/vendor/librarian/lib/librarian/helpers.rb +13 -0
  61. data/vendor/librarian/lib/librarian/helpers/debug.rb +35 -0
  62. data/vendor/librarian/lib/librarian/lockfile.rb +33 -0
  63. data/vendor/librarian/lib/librarian/lockfile/compiler.rb +70 -0
  64. data/vendor/librarian/lib/librarian/lockfile/parser.rb +104 -0
  65. data/vendor/librarian/lib/librarian/manifest.rb +140 -0
  66. data/vendor/librarian/lib/librarian/manifest_set.rb +153 -0
  67. data/vendor/librarian/lib/librarian/mock.rb +1 -0
  68. data/vendor/librarian/lib/librarian/mock/cli.rb +19 -0
  69. data/vendor/librarian/lib/librarian/mock/dsl.rb +15 -0
  70. data/vendor/librarian/lib/librarian/mock/environment.rb +24 -0
  71. data/vendor/librarian/lib/librarian/mock/extension.rb +9 -0
  72. data/vendor/librarian/lib/librarian/mock/source.rb +1 -0
  73. data/vendor/librarian/lib/librarian/mock/source/mock.rb +97 -0
  74. data/vendor/librarian/lib/librarian/mock/source/mock/registry.rb +83 -0
  75. data/vendor/librarian/lib/librarian/resolution.rb +44 -0
  76. data/vendor/librarian/lib/librarian/resolver.rb +73 -0
  77. data/vendor/librarian/lib/librarian/resolver/implementation.rb +122 -0
  78. data/vendor/librarian/lib/librarian/source.rb +2 -0
  79. data/vendor/librarian/lib/librarian/source/git.rb +150 -0
  80. data/vendor/librarian/lib/librarian/source/git/repository.rb +213 -0
  81. data/vendor/librarian/lib/librarian/source/local.rb +51 -0
  82. data/vendor/librarian/lib/librarian/source/path.rb +74 -0
  83. data/vendor/librarian/lib/librarian/spec.rb +13 -0
  84. data/vendor/librarian/lib/librarian/spec_change_set.rb +170 -0
  85. data/vendor/librarian/lib/librarian/specfile.rb +22 -0
  86. data/vendor/librarian/lib/librarian/support/abstract_method.rb +21 -0
  87. data/vendor/librarian/lib/librarian/ui.rb +64 -0
  88. data/vendor/librarian/lib/librarian/version.rb +3 -0
  89. data/vendor/librarian/librarian.gemspec +33 -0
  90. data/vendor/librarian/spec/functional/chef/source/git_spec.rb +432 -0
  91. data/vendor/librarian/spec/functional/chef/source/site_spec.rb +215 -0
  92. data/vendor/librarian/spec/unit/action/base_spec.rb +18 -0
  93. data/vendor/librarian/spec/unit/action/clean_spec.rb +102 -0
  94. data/vendor/librarian/spec/unit/action/ensure_spec.rb +37 -0
  95. data/vendor/librarian/spec/unit/action/install_spec.rb +111 -0
  96. data/vendor/librarian/spec/unit/dependency_spec.rb +30 -0
  97. data/vendor/librarian/spec/unit/dsl_spec.rb +194 -0
  98. data/vendor/librarian/spec/unit/environment_spec.rb +9 -0
  99. data/vendor/librarian/spec/unit/lockfile/parser_spec.rb +162 -0
  100. data/vendor/librarian/spec/unit/lockfile_spec.rb +65 -0
  101. data/vendor/librarian/spec/unit/manifest_set_spec.rb +202 -0
  102. data/vendor/librarian/spec/unit/manifest_spec.rb +30 -0
  103. data/vendor/librarian/spec/unit/mock/source/mock_spec.rb +22 -0
  104. data/vendor/librarian/spec/unit/resolver_spec.rb +192 -0
  105. data/vendor/librarian/spec/unit/source/git_spec.rb +29 -0
  106. data/vendor/librarian/spec/unit/spec_change_set_spec.rb +169 -0
  107. metadata +163 -0
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in librarian.gemspec
4
+ gemspec
@@ -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,318 @@
1
+ Librarian [![Build Status](https://secure.travis-ci.org/applicationsonline/librarian.png)](http://travis-ci.org/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. This is what Bundler does for
16
+ projects that depend on Ruby gems.
17
+
18
+ Librarian-Chef
19
+ ---------------
20
+
21
+ Librarian-Chef is a bundler for infrastructure repositories using Chef. You can
22
+ use Librarian-Chef to resolve your infrastructure's cookbook dependencies,
23
+ fetch them and install them into your infrastructure.
24
+
25
+ Librarian-Chef is for resolving and fetching third-party, publicly-released
26
+ cookbooks, and installing them into your infrastructure repository. It is not
27
+ for dealing with the cookbooks you're actively working on within your
28
+ infrastructure repository.
29
+
30
+ Librarian-Chef *takes over* your `cookbooks/` directory and manages it for you
31
+ based on your `Cheffile`. Your `Cheffile` becomes the authoritative source for
32
+ the cookbooks your infrastructure repository depends on. You should not modify
33
+ the contents of your `cookbooks/` directory when using Librarian-Chef. If you
34
+ have custom cookbooks which are specific to your infrastructure repository,
35
+ they should go in your `site-cookbooks/` directory.
36
+
37
+ ### The Cheffile
38
+
39
+ Every infrastruture repository that uses Librarian-Chef will have a file named
40
+ `Cheffile` in the root directory of that repository. The full specification for
41
+ which third-party, publicly-rleased cookbooks your infrastructure repository
42
+ depends will go here.
43
+
44
+ Here's an example `Cheffile`:
45
+
46
+ site "http://community.opscode.com/api/v1"
47
+
48
+ cookbook "ntp"
49
+ cookbook "timezone", "0.0.1"
50
+
51
+ cookbook "rvm",
52
+ :git => "https://github.com/fnichol/chef-rvm",
53
+ :ref => "v0.7.1"
54
+
55
+ cookbook "cloudera",
56
+ :path => "vendor/cookbooks/cloudera-cookbook"
57
+
58
+ Here's how it works:
59
+
60
+ We start off by declaring the *default source* for this `Cheffile`.
61
+
62
+ site "http://community.opscode.com/api/v1"
63
+
64
+ This default source in this example is the Opscode Community Site API. This is
65
+ most likely what you will want for your default source. However, you can
66
+ certainly set up your own API-compatible HTTP endpoint if you want more control.
67
+
68
+ Any time we declare a cookbook dependency without also declaring a source for
69
+ that cookbook dependency, Librarian-Chef assumes we want it to look for that
70
+ cookbook in the default source.
71
+
72
+ Any time we declare a cookbook dependency that has subsidiary cookbook
73
+ dependencies of its own, Librarian-Chef assumes we want it to look for the
74
+ subsidiary cookbook dependencies in the default source.
75
+
76
+ cookbook "ntp"
77
+
78
+ Our infrastructure repository depends on the `ntp` cookbook from the default
79
+ source. Any version of the `ntp` cookbook will fulfill our requirements.
80
+
81
+ cookbook "timezone", "0.0.1"
82
+
83
+ Our infrastructure repository depends on the `timezone` cookbook from the
84
+ default source. But only version `0.0.1` of that cookbook will do.
85
+
86
+ cookbook "rvm",
87
+ :git => "https://github.com/fnichol/chef-rvm",
88
+ :ref => "v0.7.1"
89
+
90
+ Our infrastructure repository depends on the `rvm` cookbook, but not the one
91
+ from the default source. Instead, the cookbook is to be fetched from the
92
+ specified Git repository and from the specified Git tag only.
93
+
94
+ When using a Git source, we do not have to use a `:ref =>`. If we do not,
95
+ then Librarian-Chef will assume we meant the `master` branch. (In the future,
96
+ this will be changed to whatever branch is the default branch according to
97
+ the Git remote, which may not be `master`.)
98
+
99
+ If we use a `:ref =>`, we can use anything that Git will recognize as a ref.
100
+ This includes any branch name, tag name, SHA, or SHA unique prefix. If we use a
101
+ branch, we can later ask Librarian-Chef to update the cookbook by fetching the
102
+ most recent version of the cookbook from that same branch.
103
+
104
+ The Git source also supports a `:path =>` option. If we use the path option,
105
+ Librarian-Chef will navigate down into the Git repository and only use the
106
+ specified subdirectory. Many people have the havit of having a single repository
107
+ with many cookbooks in it. If we need a cookbook from such a repository, we can
108
+ use the `:path =>` option here to help Librarian-Chef drill down and find the
109
+ cookbook subdirectory.
110
+
111
+ cookbook "cloudera",
112
+ :path => "vendor/cookbooks/cloudera-cookbook"
113
+
114
+ Our infrastructure repository depends on the `cloudera` cookbook, which we have
115
+ downloaded and copied into our repository. In this example, `vendor/cookbooks/`
116
+ is only for use with Librarian-Chef. This directory should not appear in the
117
+ `.chef/knife.rb`. Librarian-Chef will, instead, copy this cookbook from where
118
+ we vendored it in our repository into the `cookbooks/` directory for us.
119
+
120
+ The `:path =>` source won't be confused with the `:git =>` source's `:path =>`
121
+ option.
122
+
123
+ ### How to Use
124
+
125
+ Install Librarian-Chef:
126
+
127
+ $ gem install librarian
128
+
129
+ Prepare your infrastructure repository:
130
+
131
+ $ cd ~/path/to/chef-repo
132
+ $ git rm -r cookbooks
133
+ $ echo cookbooks >> .gitignore
134
+ $ echo tmp >> .gitignore
135
+
136
+ Librarian-Chef takes over your `cookbooks/` directory, and will always reinstall
137
+ the cookbooks listed the `Cheffile.lock` into your `cookbooks/` directory. Hence
138
+ you do not need your `cookbooks/` directory to be tracked in Git. If you
139
+ nevertheless want your `cookbooks/` directory to be tracked in Git, simple don't
140
+ `.gitignore` the directory.
141
+
142
+ If you are manually tracking/vendoring outside cookbooks within the repository,
143
+ put them in another directory such as `vendor/cookbooks/` and use the `:path =>`
144
+ source when declaring these cookbooks in your `Cheffile`. Most people will
145
+ typically not be manually tracking/vendoring outside cookbooks.
146
+
147
+ Librarian-Chef uses your `tmp/` directory for tempfiles and caches. You do not
148
+ need to track this directory in Git.
149
+
150
+ Make a Cheffile:
151
+
152
+ $ librarian-chef init
153
+
154
+ This creates an empty `Cheffile` with the Opscode Community Site API as the
155
+ default source.
156
+
157
+ Add dependencies and their sources to the `Cheffile`:
158
+
159
+ $ cat Cheffile
160
+ site 'http://community.opscode.com/api/v1'
161
+ cookbook 'ntp'
162
+ cookbook 'timezone', '0.0.1'
163
+ cookbook 'rvm',
164
+ :git => 'https://github.com/fnichol/chef-rvm',
165
+ :ref => 'v0.7.1'
166
+ cookbook 'cloudera',
167
+ :path => 'vendor/cookbooks/cloudera-cookbook'
168
+
169
+ This is the same `Cheffile` we saw above.
170
+
171
+ $ librarian-chef install [--clean] [--verbose]
172
+
173
+ This command looks at each `cookbook` declaration and fetches the cookbook from
174
+ the source specified, or from the default source if none is provided.
175
+
176
+ Each cookbook is inspected, its dependencies are determined, and each dependency
177
+ is also fetched. For example, if you declare `cookbook 'nagios'`, which
178
+ depends on other cookbooks such as `'php'`, then those other cookbooks
179
+ including `'php'` will be fetched. This goes all the way down the chain of
180
+ dependencies.
181
+
182
+ This command writes the complete resolution into `Cheffile.lock`.
183
+
184
+ This command then copies all of the fetched cookbooks into your `cookbooks/`
185
+ directory, overwriting whatever was there before. You can then use `knife
186
+ cookbook upload -all` to upload the cookbooks to your chef-server, if you are
187
+ using the client-server model.
188
+
189
+ Check your `Cheffile` and `Cheffile.lock` into version control:
190
+
191
+ $ git add Cheffile
192
+ $ git add Cheffile.lock
193
+ $ git commit -m "I want these particular versions of these particular cookbooks from these particular."
194
+
195
+ Make sure you check your `Cheffile.lock` into version control. This will ensure
196
+ dependencies do not need to be resolved every run, greatly reducing dependency
197
+ resolution time.
198
+
199
+ Get an overview of your `Cheffile.lock` with:
200
+
201
+ $ librarian-chef show
202
+
203
+ Inspect the details of specific resolved dependencies with:
204
+
205
+ $ librarian-chef show NAME1 [NAME2, ...]
206
+
207
+ Update your `Cheffile` with new/changed/removed constraints/sources/dependencies:
208
+
209
+ $ cat Cheffile
210
+ site 'http://community.opscode.com/api/v1'
211
+ cookbook 'ntp'
212
+ cookbook 'timezone', '0.0.1'
213
+ cookbook 'rvm',
214
+ :git => 'https://github.com/fnichol/chef-rvm',
215
+ :ref => 'v0.7.1'
216
+ cookbook 'monit' # new!
217
+ $ git diff Cheffile
218
+ $ librarian-chef install [--verbose]
219
+ $ git diff Cheffile.lock
220
+ $ git add Cheffile
221
+ $ git add Cheffile.lock
222
+ $ git commit -m "I also want these additional cookbooks."
223
+
224
+ Find out which dependencies are outdated and may be updated:
225
+
226
+ $ librarian-chef outdated [--verbose]
227
+
228
+ Update the version of a dependency:
229
+
230
+ $ librarian-chef update ntp timezone monit [--verbose]
231
+ $ git diff Cheffile.lock
232
+ $ git add Cheffile.lock
233
+ $ git commit -m "I want updated versions of these cookbooks."
234
+
235
+ Push your changes to the git repository:
236
+
237
+ $ git push origin master
238
+
239
+ Upload the cookbooks to your chef-server:
240
+
241
+ $ knife cookbook upload --all
242
+
243
+ ### Knife Integration
244
+
245
+ You can integrate your `knife.rb` with Librarian-Chef.
246
+
247
+ Stick the following in your `knife.rb`:
248
+
249
+ require 'librarian/chef/integration/knife'
250
+ cookbook_path Librarian::Chef.install_path,
251
+ "/path/to/chef-repo/site-cookbooks"
252
+
253
+ In the above, do *not* to include the path to your `cookbooks/` directory. If
254
+ you have additional cookbooks directories in your chef-repo that you use for
255
+ vendored cookbooks (where you use the `:path =>` source in your `Cheffile`),
256
+ make sure *not* to include the paths to those additional cookbooks directories
257
+ either.
258
+
259
+ You still need to include your `site-cookbooks/` directory in the above list.
260
+
261
+ What this integration does is whenever you use any `knife` command, it will:
262
+
263
+ * Enforce that your `Cheffile` and `Cheffile.lock` are in sync
264
+ * Install the resolved cookbooks to a temporary directory
265
+ * Configure Knife to look in the temporary directory for the installed cookbooks
266
+ and not in the normal `cookbooks/` directory.
267
+
268
+ When you use this integration, any changes you make to anything in the
269
+ `cookbooks/` directory will be ignored by Knife, because Knife won't look in
270
+ that directory for your cookbooks.
271
+
272
+ How to Contribute
273
+ -----------------
274
+
275
+ ### Running the tests
276
+
277
+ # Either
278
+ $ rspec spec
279
+ $ cucumber
280
+
281
+ # Or
282
+ $ rake
283
+
284
+ You will probably need some way to isolate gems. Librarian provides a `Gemfile`,
285
+ so if you want to use bundler, you can prepare the directory with the usual
286
+ `bundle install` and run each command prefixed with the usual `bundle exec`, as:
287
+
288
+ $ bundle install
289
+ $ bundle exec rspec spec
290
+ $ bundle exec cucumber
291
+ $ bundle exec rake
292
+
293
+ ### Installing locally
294
+
295
+ $ rake install
296
+
297
+ You should typically not need to install locally, if you are simply trying to
298
+ patch a bug and test the result on a test case. Instead of installing locally,
299
+ you are probably better served by:
300
+
301
+ $ cd $PATH_TO_INFRASTRUCTURE_REPO
302
+ $ $PATH_TO_LIBRARIAN_CHECKOUT/bin/librarian-chef install [--verbose]
303
+
304
+ ### Reporting Issues
305
+
306
+ Please include relevant `Cheffile` and `Cheffile.lock` files. Please run the
307
+ `librarian-chef` commands in verbose mode by using the `--verbose` flag, and
308
+ include the verbose output in the bug report as well.
309
+
310
+ License
311
+ -------
312
+
313
+ Written by Jay Feldblum.
314
+
315
+ Copyright (c) 2011-2012 ApplicationsOnline, LLC.
316
+
317
+ Released under the terms of the MIT License. For further information, please see
318
+ 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
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ lib = File.expand_path('../../lib', __FILE__)
4
+ $:.unshift(lib) unless $:.include?(lib)
5
+
6
+ require 'librarian/chef/cli'
7
+ Librarian::Chef::Cli.bin!
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ lib = File.expand_path('../../lib', __FILE__)
4
+ $:.unshift(lib) unless $:.include?(lib)
5
+
6
+ require 'librarian/mock/cli'
7
+ Librarian::Mock::Cli.bin!
@@ -0,0 +1 @@
1
+ default: --tags ~@wip --format progress
@@ -0,0 +1,10 @@
1
+ Feature: cli/init
2
+
3
+
4
+
5
+ Scenario: Initing a directory
6
+ When I run `librarian-chef init`
7
+ Then a file named "Cheffile" should exist
8
+
9
+
10
+
@@ -0,0 +1,64 @@
1
+ Feature: cli/install
2
+
3
+
4
+
5
+ Scenario: A simple Cheffile with one cookbook
6
+ Given a file named "cookbook-sources/apt/metadata.yaml" with:
7
+ """
8
+ name: apt
9
+ version: 1.0.0
10
+ dependencies: { }
11
+ """
12
+ Given a file named "Cheffile" with:
13
+ """
14
+ cookbook 'apt',
15
+ :path => 'cookbook-sources'
16
+ """
17
+ When I run `librarian-chef install --verbose`
18
+ Then the exit status should be 0
19
+ And the file "cookbooks/apt/metadata.yaml" should contain exactly:
20
+ """
21
+ name: apt
22
+ version: 1.0.0
23
+ dependencies: { }
24
+ """
25
+
26
+
27
+
28
+ Scenario: A simple Cheffile with one cookbook with one dependency
29
+ Given a file named "cookbook-sources/main/metadata.yaml" with:
30
+ """
31
+ name: main
32
+ version: 1.0.0
33
+ dependencies:
34
+ sub: 1.0.0
35
+ """
36
+ Given a file named "cookbook-sources/sub/metadata.yaml" with:
37
+ """
38
+ name: sub
39
+ version: 1.0.0
40
+ dependencies: {}
41
+ """
42
+ Given a file named "Cheffile" with:
43
+ """
44
+ path 'cookbook-sources'
45
+ cookbook 'main'
46
+ """
47
+ When I run `librarian-chef install --verbose`
48
+ Then the exit status should be 0
49
+ And the file "cookbooks/main/metadata.yaml" should contain exactly:
50
+ """
51
+ name: main
52
+ version: 1.0.0
53
+ dependencies:
54
+ sub: 1.0.0
55
+ """
56
+ And the file "cookbooks/sub/metadata.yaml" should contain exactly:
57
+ """
58
+ name: sub
59
+ version: 1.0.0
60
+ dependencies: {}
61
+ """
62
+
63
+
64
+