librarian-puppet-maestrodev 0.9.7.5 → 0.9.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. data/README.md +3 -3
  2. data/bin/librarian-puppet +0 -2
  3. data/lib/librarian/puppet.rb +10 -1
  4. data/lib/librarian/puppet/extension.rb +68 -11
  5. data/lib/librarian/puppet/requirement.rb +39 -0
  6. data/lib/librarian/puppet/source.rb +1 -0
  7. data/lib/librarian/puppet/source/forge.rb +8 -1
  8. data/lib/librarian/puppet/source/git.rb +2 -0
  9. data/lib/librarian/puppet/source/githubtarball.rb +16 -1
  10. data/lib/librarian/puppet/version.rb +1 -1
  11. metadata +33 -112
  12. data/vendor/librarian/CHANGELOG.md +0 -185
  13. data/vendor/librarian/Gemfile +0 -6
  14. data/vendor/librarian/MIT-LICENSE +0 -20
  15. data/vendor/librarian/README.md +0 -403
  16. data/vendor/librarian/Rakefile +0 -34
  17. data/vendor/librarian/bin/librarian-chef +0 -7
  18. data/vendor/librarian/bin/librarian-mock +0 -7
  19. data/vendor/librarian/config/cucumber.yaml +0 -1
  20. data/vendor/librarian/features/chef/cli/init.feature +0 -11
  21. data/vendor/librarian/features/chef/cli/install.feature +0 -64
  22. data/vendor/librarian/features/chef/cli/show.feature +0 -77
  23. data/vendor/librarian/features/chef/cli/version.feature +0 -11
  24. data/vendor/librarian/features/support/env.rb +0 -9
  25. data/vendor/librarian/lib/librarian.rb +0 -19
  26. data/vendor/librarian/lib/librarian/action.rb +0 -5
  27. data/vendor/librarian/lib/librarian/action/base.rb +0 -24
  28. data/vendor/librarian/lib/librarian/action/clean.rb +0 -44
  29. data/vendor/librarian/lib/librarian/action/ensure.rb +0 -24
  30. data/vendor/librarian/lib/librarian/action/install.rb +0 -99
  31. data/vendor/librarian/lib/librarian/action/resolve.rb +0 -81
  32. data/vendor/librarian/lib/librarian/action/update.rb +0 -78
  33. data/vendor/librarian/lib/librarian/chef.rb +0 -1
  34. data/vendor/librarian/lib/librarian/chef/cli.rb +0 -48
  35. data/vendor/librarian/lib/librarian/chef/dsl.rb +0 -15
  36. data/vendor/librarian/lib/librarian/chef/environment.rb +0 -27
  37. data/vendor/librarian/lib/librarian/chef/extension.rb +0 -9
  38. data/vendor/librarian/lib/librarian/chef/integration/knife.rb +0 -42
  39. data/vendor/librarian/lib/librarian/chef/manifest_reader.rb +0 -59
  40. data/vendor/librarian/lib/librarian/chef/source.rb +0 -3
  41. data/vendor/librarian/lib/librarian/chef/source/git.rb +0 -25
  42. data/vendor/librarian/lib/librarian/chef/source/local.rb +0 -69
  43. data/vendor/librarian/lib/librarian/chef/source/path.rb +0 -12
  44. data/vendor/librarian/lib/librarian/chef/source/site.rb +0 -446
  45. data/vendor/librarian/lib/librarian/chef/templates/Cheffile +0 -15
  46. data/vendor/librarian/lib/librarian/cli.rb +0 -205
  47. data/vendor/librarian/lib/librarian/cli/manifest_presenter.rb +0 -79
  48. data/vendor/librarian/lib/librarian/config.rb +0 -7
  49. data/vendor/librarian/lib/librarian/config/database.rb +0 -205
  50. data/vendor/librarian/lib/librarian/config/file_source.rb +0 -47
  51. data/vendor/librarian/lib/librarian/config/hash_source.rb +0 -33
  52. data/vendor/librarian/lib/librarian/config/source.rb +0 -149
  53. data/vendor/librarian/lib/librarian/dependency.rb +0 -91
  54. data/vendor/librarian/lib/librarian/dsl.rb +0 -108
  55. data/vendor/librarian/lib/librarian/dsl/receiver.rb +0 -48
  56. data/vendor/librarian/lib/librarian/dsl/target.rb +0 -172
  57. data/vendor/librarian/lib/librarian/environment.rb +0 -134
  58. data/vendor/librarian/lib/librarian/error.rb +0 -4
  59. data/vendor/librarian/lib/librarian/helpers.rb +0 -13
  60. data/vendor/librarian/lib/librarian/lockfile.rb +0 -29
  61. data/vendor/librarian/lib/librarian/lockfile/compiler.rb +0 -66
  62. data/vendor/librarian/lib/librarian/lockfile/parser.rb +0 -100
  63. data/vendor/librarian/lib/librarian/logger.rb +0 -46
  64. data/vendor/librarian/lib/librarian/manifest.rb +0 -132
  65. data/vendor/librarian/lib/librarian/manifest_set.rb +0 -154
  66. data/vendor/librarian/lib/librarian/mock.rb +0 -1
  67. data/vendor/librarian/lib/librarian/mock/cli.rb +0 -19
  68. data/vendor/librarian/lib/librarian/mock/dsl.rb +0 -15
  69. data/vendor/librarian/lib/librarian/mock/environment.rb +0 -24
  70. data/vendor/librarian/lib/librarian/mock/extension.rb +0 -9
  71. data/vendor/librarian/lib/librarian/mock/source.rb +0 -1
  72. data/vendor/librarian/lib/librarian/mock/source/mock.rb +0 -97
  73. data/vendor/librarian/lib/librarian/mock/source/mock/registry.rb +0 -83
  74. data/vendor/librarian/lib/librarian/resolution.rb +0 -44
  75. data/vendor/librarian/lib/librarian/resolver.rb +0 -78
  76. data/vendor/librarian/lib/librarian/resolver/implementation.rb +0 -118
  77. data/vendor/librarian/lib/librarian/source.rb +0 -2
  78. data/vendor/librarian/lib/librarian/source/git.rb +0 -150
  79. data/vendor/librarian/lib/librarian/source/git/repository.rb +0 -217
  80. data/vendor/librarian/lib/librarian/source/local.rb +0 -61
  81. data/vendor/librarian/lib/librarian/source/path.rb +0 -74
  82. data/vendor/librarian/lib/librarian/spec.rb +0 -13
  83. data/vendor/librarian/lib/librarian/spec_change_set.rb +0 -173
  84. data/vendor/librarian/lib/librarian/specfile.rb +0 -18
  85. data/vendor/librarian/lib/librarian/support/abstract_method.rb +0 -21
  86. data/vendor/librarian/lib/librarian/ui.rb +0 -64
  87. data/vendor/librarian/lib/librarian/version.rb +0 -3
  88. data/vendor/librarian/librarian.gemspec +0 -34
  89. data/vendor/librarian/spec/functional/chef/source/git_spec.rb +0 -432
  90. data/vendor/librarian/spec/functional/chef/source/site_spec.rb +0 -215
  91. data/vendor/librarian/spec/functional/source/git/repository_spec.rb +0 -149
  92. data/vendor/librarian/spec/unit/action/base_spec.rb +0 -18
  93. data/vendor/librarian/spec/unit/action/clean_spec.rb +0 -102
  94. data/vendor/librarian/spec/unit/action/ensure_spec.rb +0 -37
  95. data/vendor/librarian/spec/unit/action/install_spec.rb +0 -111
  96. data/vendor/librarian/spec/unit/config/database_spec.rb +0 -319
  97. data/vendor/librarian/spec/unit/dependency_spec.rb +0 -36
  98. data/vendor/librarian/spec/unit/dsl_spec.rb +0 -194
  99. data/vendor/librarian/spec/unit/environment_spec.rb +0 -9
  100. data/vendor/librarian/spec/unit/lockfile/parser_spec.rb +0 -162
  101. data/vendor/librarian/spec/unit/lockfile_spec.rb +0 -65
  102. data/vendor/librarian/spec/unit/manifest_set_spec.rb +0 -202
  103. data/vendor/librarian/spec/unit/manifest_spec.rb +0 -36
  104. data/vendor/librarian/spec/unit/mock/source/mock_spec.rb +0 -22
  105. data/vendor/librarian/spec/unit/resolver_spec.rb +0 -192
  106. data/vendor/librarian/spec/unit/source/git_spec.rb +0 -29
  107. data/vendor/librarian/spec/unit/spec_change_set_spec.rb +0 -169
@@ -1,12 +0,0 @@
1
- require 'librarian/source/path'
2
- require 'librarian/chef/source/local'
3
-
4
- module Librarian
5
- module Chef
6
- module Source
7
- class Path < Librarian::Source::Path
8
- include Local
9
- end
10
- end
11
- end
12
- end
@@ -1,446 +0,0 @@
1
- require 'fileutils'
2
- require 'pathname'
3
- require 'uri'
4
- require 'net/http'
5
- require 'json'
6
- require 'digest'
7
- require 'zlib'
8
- require 'securerandom'
9
- require 'archive/tar/minitar'
10
-
11
- require 'librarian/chef/manifest_reader'
12
-
13
- module Librarian
14
- module Chef
15
- module Source
16
- class Site
17
-
18
- class Line
19
-
20
- attr_accessor :source, :name
21
- private :source=, :name=
22
-
23
- def initialize(source, name)
24
- self.source = source
25
- self.name = name
26
- end
27
-
28
- def install_version!(version, install_path)
29
- cache_version_unpacked! version
30
-
31
- if install_path.exist?
32
- debug { "Deleting #{relative_path_to(install_path)}" }
33
- install_path.rmtree
34
- end
35
-
36
- unpacked_path = version_unpacked_cache_path(version)
37
-
38
- debug { "Copying #{relative_path_to(unpacked_path)} to #{relative_path_to(install_path)}" }
39
- FileUtils.cp_r(unpacked_path, install_path)
40
- end
41
-
42
- def manifests
43
- version_uris.map do |version_uri|
44
- Manifest.new(source, name, version_uri)
45
- end
46
- end
47
-
48
- def to_version(version_uri)
49
- version_uri_metadata(version_uri)["version"]
50
- end
51
-
52
- def version_dependencies(version)
53
- version_manifest(version)["dependencies"]
54
- end
55
-
56
- private
57
-
58
- attr_accessor :metadata_cached
59
- alias metadata_cached? metadata_cached
60
-
61
- def environment
62
- source.environment
63
- end
64
-
65
- def uri
66
- @uri ||= URI.parse("#{source.uri}/cookbooks/#{name}")
67
- end
68
-
69
- def version_uris
70
- metadata["versions"]
71
- end
72
-
73
- def version_metadata(version)
74
- version_uri = to_version_uri(version)
75
- version_uri_metadata(version_uri)
76
- end
77
-
78
- def version_uri_metadata(version_uri)
79
- @version_uri_metadata ||= { }
80
- @version_uri_metadata[version_uri.to_s] ||= begin
81
- cache_version_uri_metadata! version_uri
82
- parse_local_json(version_uri_metadata_cache_path(version_uri))
83
- end
84
- end
85
-
86
- def version_manifest(version)
87
- version_uri = to_version_uri(version)
88
- version_uri_manifest(version_uri)
89
- end
90
-
91
- def version_uri_manifest(version_uri)
92
- @version_uri_manifest ||= { }
93
- @version_uri_manifest[version_uri.to_s] ||= begin
94
- cache_version_uri_unpacked! version_uri
95
- unpacked_path = version_uri_unpacked_cache_path(version_uri)
96
- manifest_path = ManifestReader.manifest_path(unpacked_path)
97
- ManifestReader.read_manifest(name, manifest_path)
98
- end
99
- end
100
-
101
- def metadata
102
- @metadata ||= begin
103
- cache_metadata!
104
- parse_local_json(metadata_cache_path)
105
- end
106
- end
107
-
108
- def to_version_uri(version)
109
- @to_version_uri ||= { }
110
- @to_version_uri[version.to_s] ||= begin
111
- cache_version! version
112
- version_cache_path(version).read
113
- end
114
- end
115
-
116
- def metadata_cached!
117
- self.metadata_cached = true
118
- end
119
-
120
- def cache_path
121
- @cache_path ||= source.cache_path.join(name)
122
- end
123
-
124
- def metadata_cache_path
125
- @metadata_cache_path ||= cache_path.join("metadata.json")
126
- end
127
-
128
- def version_cache_path(version)
129
- @version_cache_path ||= { }
130
- @version_cache_path[version.to_s] ||= begin
131
- cache_path.join("version").join(version.to_s)
132
- end
133
- end
134
-
135
- def version_uri_cache_path(version_uri)
136
- @version_uri_cache_path ||= { }
137
- @version_uri_cache_path[version_uri.to_s] ||= begin
138
- cache_path.join("version-uri").join(hexdigest(version_uri))
139
- end
140
- end
141
-
142
- def version_metadata_cache_path(version)
143
- version_uri = to_version_uri(version)
144
- version_uri_metadata_cache_path(version_uri)
145
- end
146
-
147
- def version_uri_metadata_cache_path(version_uri)
148
- @version_uri_metadata_cache_path ||= { }
149
- @version_uri_metadata_cache_path[version_uri.to_s] ||= begin
150
- version_uri_cache_path(version_uri).join("metadata.json")
151
- end
152
- end
153
-
154
- def version_package_cache_path(version)
155
- version_uri = to_version_uri(version)
156
- version_uri_package_cache_path(version_uri)
157
- end
158
-
159
- def version_uri_package_cache_path(version_uri)
160
- @version_uri_package_cache_path ||= { }
161
- @version_uri_package_cache_path[version_uri.to_s] ||= begin
162
- version_uri_cache_path(version_uri).join("package.tar.gz")
163
- end
164
- end
165
-
166
- def version_unpacked_cache_path(version)
167
- version_uri = to_version_uri(version)
168
- version_uri_unpacked_cache_path(version_uri)
169
- end
170
-
171
- def version_uri_unpacked_cache_path(version_uri)
172
- @version_uri_unpacked_cache_path ||= { }
173
- @version_uri_unpacked_cache_path[version_uri.to_s] ||= begin
174
- version_uri_cache_path(version_uri).join("package")
175
- end
176
- end
177
-
178
- def cache_metadata!
179
- metadata_cached? and return or metadata_cached!
180
- cache_remote_json! metadata_cache_path, uri
181
- end
182
-
183
- def cache_version_uri_metadata!(version_uri)
184
- path = version_uri_metadata_cache_path(version_uri)
185
- path.file? and return
186
-
187
- cache_remote_json! path, version_uri
188
- end
189
-
190
- def cache_version!(version)
191
- path = version_cache_path(version)
192
- path.file? and return
193
-
194
- version_uris.each do |version_uri|
195
- m = version_uri_metadata(version_uri)
196
- v = m["version"]
197
- if version.to_s == v
198
- write! path, version_uri.to_s
199
- break
200
- end
201
- end
202
- end
203
-
204
- def cache_version_package!(version)
205
- version_uri = to_version_uri(version)
206
- cache_version_uri_package! version_uri
207
- end
208
-
209
- def cache_version_uri_package!(version_uri)
210
- path = version_uri_package_cache_path(version_uri)
211
- path.file? and return
212
-
213
- file_uri = version_uri_metadata(version_uri)["file"]
214
- cache_remote_object! path, file_uri
215
- end
216
-
217
- def cache_version_unpacked!(version)
218
- version_uri = to_version_uri(version)
219
- cache_version_uri_unpacked! version_uri
220
- end
221
-
222
- def cache_version_uri_unpacked!(version_uri)
223
- cache_version_uri_package!(version_uri)
224
-
225
- path = version_uri_unpacked_cache_path(version_uri)
226
- path.directory? and return
227
-
228
- package_path = version_uri_package_cache_path(version_uri)
229
- unpacked_path = version_uri_unpacked_cache_path(version_uri)
230
-
231
- unpack_package! unpacked_path, package_path
232
- end
233
-
234
- def cache_remote_json!(path, uri)
235
- path = Pathname(path)
236
- uri = to_uri(uri)
237
-
238
- path.dirname.mkpath unless path.dirname.directory?
239
-
240
- debug { "Caching #{uri} to #{path}" }
241
-
242
- http = Net::HTTP.new(uri.host, uri.port)
243
- request = Net::HTTP::Get.new(uri.path)
244
- response = http.start{|http| http.request(request)}
245
- unless Net::HTTPSuccess === response
246
- raise Error, "Could not get #{uri} because #{response.code} #{response.message}!"
247
- end
248
- json = response.body
249
- JSON.parse(json) # verify that it's really JSON.
250
- write! path, json
251
- end
252
-
253
- def cache_remote_object!(path, uri)
254
- path = Pathname(path)
255
- uri = to_uri(uri)
256
-
257
- path.dirname.mkpath unless path.dirname.directory?
258
-
259
- debug { "Caching #{uri} to #{path}" }
260
-
261
- http = Net::HTTP.new(uri.host, uri.port)
262
- request = Net::HTTP::Get.new(uri.path)
263
- response = http.start{|http| http.request(request)}
264
- unless Net::HTTPSuccess === response
265
- raise Error, "Could not get #{uri} because #{response.code} #{response.message}!"
266
- end
267
- write! path, response.body
268
- end
269
-
270
- def write!(path, bytes)
271
- path.dirname.mkpath
272
- path.open("wb"){|f| f.write(bytes)}
273
- end
274
-
275
- def unpack_package!(path, source)
276
- path = Pathname(path)
277
- source = Pathname(source)
278
-
279
- temp = environment.scratch_path.join(SecureRandom.hex(16))
280
- temp.mkpath
281
-
282
- debug { "Unpacking #{relative_path_to(source)} to #{relative_path_to(temp)}" }
283
- Zlib::GzipReader.open(source) do |input|
284
- Archive::Tar::Minitar.unpack(input, temp.to_s)
285
- end
286
-
287
- # Cookbook files, as pulled from Opscode Community Site API, are
288
- # embedded in a subdirectory of the tarball, and the subdirectory's
289
- # name is equal to the name of the cookbook.
290
- subtemp = temp.join(name)
291
- debug { "Moving #{relative_path_to(subtemp)} to #{relative_path_to(path)}" }
292
- FileUtils.mv(subtemp, path)
293
- ensure
294
- temp.rmtree if temp && temp.exist?
295
- end
296
-
297
- def parse_local_json(path)
298
- JSON.parse(path.read)
299
- end
300
-
301
- def hexdigest(bytes)
302
- Digest::MD5.hexdigest(bytes)
303
- end
304
-
305
- def to_uri(uri)
306
- uri = URI(uri) unless URI === uri
307
- uri
308
- end
309
-
310
- def debug(*args, &block)
311
- environment.logger.debug(*args, &block)
312
- end
313
-
314
- def relative_path_to(path)
315
- environment.logger.relative_path_to(path)
316
- end
317
-
318
- end
319
-
320
- class << self
321
-
322
- LOCK_NAME = 'SITE'
323
-
324
- def lock_name
325
- LOCK_NAME
326
- end
327
-
328
- def from_lock_options(environment, options)
329
- new(environment, options[:remote], options.reject{|k, v| k == :remote})
330
- end
331
-
332
- def from_spec_args(environment, uri, options)
333
- recognized_options = []
334
- unrecognized_options = options.keys - recognized_options
335
- unrecognized_options.empty? or raise Error, "unrecognized options: #{unrecognized_options.join(", ")}"
336
-
337
- new(environment, uri, options)
338
- end
339
-
340
- end
341
-
342
- attr_accessor :environment
343
- private :environment=
344
- attr_reader :uri
345
-
346
- attr_accessor :_metadata_cache
347
- private :_metadata_cache, :_metadata_cache=
348
-
349
- def initialize(environment, uri, options = {})
350
- self.environment = environment
351
- @uri = uri
352
- @cache_path = nil
353
- self._metadata_cache = { }
354
- end
355
-
356
- def to_s
357
- uri
358
- end
359
-
360
- def ==(other)
361
- other &&
362
- self.class == other.class &&
363
- self.uri == other.uri
364
- end
365
-
366
- def to_spec_args
367
- [uri, {}]
368
- end
369
-
370
- def to_lock_options
371
- {:remote => uri}
372
- end
373
-
374
- def pinned?
375
- false
376
- end
377
-
378
- def unpin!
379
- end
380
-
381
- def install!(manifest)
382
- manifest.source == self or raise ArgumentError
383
-
384
- name = manifest.name
385
- version = manifest.version
386
- install_path = install_path(name)
387
- line = line(name)
388
-
389
- info { "Installing #{manifest.name} (#{manifest.version})" }
390
-
391
- debug { "Installing #{manifest}" }
392
-
393
- line.install_version! version, install_path
394
- end
395
-
396
- # NOTE:
397
- # Assumes the Opscode Site API responds with versions in reverse sorted order
398
- def manifests(name)
399
- line(name).manifests
400
- end
401
-
402
- def manifest(name, version, dependencies)
403
- manifest = Manifest.new(self, name)
404
- manifest.version = version
405
- manifest.dependencies = dependencies
406
- manifest
407
- end
408
-
409
- def cache_path
410
- @cache_path ||= begin
411
- dir = Digest::MD5.hexdigest(uri)
412
- environment.cache_path.join("source/chef/site/#{dir}")
413
- end
414
- end
415
-
416
- def install_path(name)
417
- environment.install_path.join(name)
418
- end
419
-
420
- def fetch_version(name, version_uri)
421
- line(name).to_version(version_uri)
422
- end
423
-
424
- def fetch_dependencies(name, version, version_uri)
425
- line(name).version_dependencies(version).map{|k, v| Dependency.new(k, v, nil)}
426
- end
427
-
428
- private
429
-
430
- def line(name)
431
- @line ||= { }
432
- @line[name] ||= Line.new(self, name)
433
- end
434
-
435
- def info(*args, &block)
436
- environment.logger.info(*args, &block)
437
- end
438
-
439
- def debug(*args, &block)
440
- environment.logger.debug(*args, &block)
441
- end
442
-
443
- end
444
- end
445
- end
446
- end