librarian-chef 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 950187ce3da19669233c3f801545c4ed7f090bd7
4
- data.tar.gz: d342abdad8f21e4deaec5c85207bb4462de51366
3
+ metadata.gz: b59a3da03ffcb2136feeecb521cc12df1421f171
4
+ data.tar.gz: d8eb2efdb1bc0883f25724056d6842a3374bd22a
5
5
  SHA512:
6
- metadata.gz: 82af4d4079d644156065ed2747fb23686fda4678f15711e355abd3558389737d5a56618fee67018c16de67762cfe0191336f2a13ddb68f1585d95b0544bd4344
7
- data.tar.gz: 990d08487fcd2a6d1afa919f951917041022acd284feaf17ddee534520304acdb717d97c85250a48a790c58df0378a76dcd7b57dc0f80dc7ee1d3fda3c6e019c
6
+ metadata.gz: 43754256753f5c95abdcd22e452d90fcc5c0125f7006f7a897721f52c9e04d0b02658172e4984730f400e0ae6410469a9c525eb59eb9a818c26041f4a9478e35
7
+ data.tar.gz: 10b75a52059ff714d2cc6e5100c4fceeb69baedbb298576027679e6736a5408369d081527638aae12e5e184f34aeca5dcd9149548d030aa8253a260a43e10e27
@@ -5,8 +5,7 @@ rvm:
5
5
  - 1.9.2
6
6
  - 1.9.3
7
7
  - 2.0.0
8
- - rbx-18mode
9
- - rbx-19mode
8
+ - rbx
10
9
  - jruby-18mode
11
10
  - jruby-19mode
12
11
  - ruby-head
@@ -1,5 +1,10 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.0.3
4
+
5
+ * Support HTTPS endpoints. Thanks @sl4m.
6
+ * Support cookbooks with long paths.
7
+
3
8
  ## 0.0.2
4
9
 
5
10
  * Support tar cookbook archives in addition to targz cookbook archives.
@@ -336,7 +336,9 @@ module Librarian
336
336
  end
337
337
 
338
338
  def http(uri)
339
- environment.net_http_class(uri.host).new(uri.host, uri.port)
339
+ net_http = environment.net_http_class(uri.host).new(uri.host, uri.port)
340
+ net_http.use_ssl = true if uri.scheme == 'https'
341
+ net_http
340
342
  end
341
343
 
342
344
  def http_get(uri)
@@ -1,5 +1,5 @@
1
1
  module Librarian
2
2
  module Chef
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -20,7 +20,7 @@ Gem::Specification.new do |gem|
20
20
 
21
21
  gem.add_dependency "librarian", "~> 0.1.0"
22
22
  gem.add_dependency "chef", ">= 0.10"
23
- gem.add_dependency "archive-tar-minitar", ">= 0.5.2"
23
+ gem.add_dependency "minitar", ">= 0.5.2"
24
24
 
25
25
  gem.add_development_dependency "rake"
26
26
  gem.add_development_dependency "rspec"
@@ -291,6 +291,61 @@ module Librarian
291
291
  end
292
292
  end
293
293
 
294
+ describe "https api endpoint" do
295
+ let(:https_api_url) { "https://site.cookbooks.com" }
296
+ let(:source) { described_class.new(env, https_api_url) }
297
+
298
+ let(:sample_metadata) do
299
+ Helpers.strip_heredoc(<<-METADATA)
300
+ version "0.6.5"
301
+ METADATA
302
+ end
303
+
304
+ let(:sample_index_data) do
305
+ {
306
+ "name" => "sample",
307
+ "versions" => [
308
+ "#{https_api_url}/cookbooks/sample/versions/0_6_5"
309
+ ]
310
+ }
311
+ end
312
+
313
+ let(:sample_0_6_5_data) do
314
+ {
315
+ "version" => "0.6.5",
316
+ "file" => "#{https_api_url}/cookbooks/sample/versions/0_6_5/file.tar.gz"
317
+ }
318
+ end
319
+
320
+ let(:sample_0_6_5_package) do
321
+ s = StringIO.new
322
+ z = Zlib::GzipWriter.new(s, Zlib::NO_COMPRESSION)
323
+ t = Archive::Tar::Minitar::Output.new(z)
324
+ t.tar.add_file_simple("sample/metadata.rb", :mode => 0700,
325
+ :size => sample_metadata.bytesize){|io| io.write(sample_metadata)}
326
+ t.close
327
+ z.close unless z.closed?
328
+ s.string
329
+ end
330
+
331
+ def stub_sample_cookbook_requests
332
+ stub_request(:get, "#{https_api_url}/cookbooks/sample").
333
+ to_return(:body => JSON.dump(sample_index_data))
334
+
335
+ stub_request(:get, "#{https_api_url}/cookbooks/sample/versions/0_6_5").
336
+ to_return(:body => JSON.dump(sample_0_6_5_data))
337
+
338
+ stub_request(:get, "#{https_api_url}/cookbooks/sample/versions/0_6_5/file.tar.gz").
339
+ to_return(:body => sample_0_6_5_package)
340
+ end
341
+
342
+ it 'handles https api endpoints' do
343
+ stub_sample_cookbook_requests
344
+ manifest = source.manifests("sample").first
345
+ manifest.version.to_s.should == "0.6.5"
346
+ end
347
+ end
348
+
294
349
  describe "extracting .tar packages" do
295
350
  let(:source) { described_class.new(env, api_url) }
296
351
 
@@ -344,6 +399,65 @@ module Librarian
344
399
 
345
400
  end
346
401
 
402
+ describe "extracting .tar packages with long filenames" do
403
+ let(:source) { described_class.new(env, api_url) }
404
+
405
+ before { tmp_path.mkpath unless tmp_path.exist? }
406
+ let(:bad_name_size) { Librarian::Posix.run!(%W[getconf NAME_MAX #{tmp_path}]).to_i }
407
+ let(:bad_name_path) { SecureRandom.hex((bad_name_size.to_f/2).ceil)[0...bad_name_size] }
408
+
409
+ before { expect(bad_name_path.size).to eq bad_name_size }
410
+
411
+ let(:sample_metadata) do
412
+ Helpers.strip_heredoc(<<-METADATA)
413
+ version "0.6.5"
414
+ METADATA
415
+ end
416
+
417
+ let(:sample_index_data) do
418
+ {
419
+ "name" => "sample",
420
+ "versions" => [
421
+ "#{api_url}/cookbooks/sample/versions/0_6_5"
422
+ ]
423
+ }
424
+ end
425
+ let(:sample_0_6_5_data) do
426
+ {
427
+ "version" => "0.6.5",
428
+ "file" => "#{api_url}/cookbooks/sample/versions/0_6_5/file.tar"
429
+ }
430
+ end
431
+ let(:sample_0_6_5_package) do
432
+ tar_path = tmp_path + "tar-source"
433
+ tar_path.mkpath
434
+ tar_path.join("sample").mkpath
435
+ tar_path.join("sample/metadata.rb").open("w"){|io| io.write(sample_metadata)}
436
+ tar_path.join("sample/#{bad_name_path}").open("w"){|io| io.write("?")}
437
+ Librarian::Posix.run!(%W[tar cz -C #{tar_path} . ])
438
+ end
439
+
440
+ before do
441
+ stub_request(:get, "#{api_url}/cookbooks/sample").
442
+ to_return(:body => JSON.dump(sample_index_data))
443
+
444
+ stub_request(:get, "#{api_url}/cookbooks/sample/versions/0_6_5").
445
+ to_return(:body => JSON.dump(sample_0_6_5_data))
446
+
447
+ stub_request(:get, "#{api_url}/cookbooks/sample/versions/0_6_5/file.tar").
448
+ to_return(:body => sample_0_6_5_package)
449
+ end
450
+
451
+ it "installs the manifest" do
452
+ env.install_path.mkpath
453
+ manifest = source.manifests("sample").first
454
+ source.install!(manifest)
455
+ text = env.install_path.join("sample/#{bad_name_path}").read
456
+ text.should == "?"
457
+ end
458
+
459
+ end
460
+
347
461
  end
348
462
  end
349
463
  end
@@ -362,8 +362,8 @@ module Librarian
362
362
  version "0.6.5"
363
363
  METADATA
364
364
  end
365
- before do
366
365
 
366
+ before do
367
367
  # set up the git repo as normal, but let's also set up a release-stable branch
368
368
  # from which our Cheffile will only pull stable releases
369
369
  git_path.rmtree if git_path.exist?
metadata CHANGED
@@ -1,97 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: librarian-chef
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jay Feldblum
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-18 00:00:00.000000000 Z
11
+ date: 2014-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: librarian
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.1.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: chef
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0.10'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.10'
41
41
  - !ruby/object:Gem::Dependency
42
- name: archive-tar-minitar
42
+ name: minitar
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: 0.5.2
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.5.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: webmock
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  description: A Bundler for your Chef Cookbooks.
@@ -102,9 +102,9 @@ executables:
102
102
  extensions: []
103
103
  extra_rdoc_files: []
104
104
  files:
105
- - .gitignore
106
- - .rspec
107
- - .travis.yml
105
+ - ".gitignore"
106
+ - ".rspec"
107
+ - ".travis.yml"
108
108
  - CHANGELOG.md
109
109
  - Gemfile
110
110
  - LICENSE.txt
@@ -143,17 +143,17 @@ require_paths:
143
143
  - lib
144
144
  required_ruby_version: !ruby/object:Gem::Requirement
145
145
  requirements:
146
- - - '>='
146
+ - - ">="
147
147
  - !ruby/object:Gem::Version
148
148
  version: '0'
149
149
  required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  requirements:
151
- - - '>='
151
+ - - ">="
152
152
  - !ruby/object:Gem::Version
153
153
  version: '0'
154
154
  requirements: []
155
155
  rubyforge_project:
156
- rubygems_version: 2.1.3
156
+ rubygems_version: 2.2.2
157
157
  signing_key:
158
158
  specification_version: 4
159
159
  summary: A Bundler for your Chef Cookbooks.