librarian-chef-nochef 0.1.0 → 0.1.2

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: ea91ccc5f7006b77445fedb1a2ab9d9aa6065ca5
4
- data.tar.gz: 71d7308d5e6bdc20b5e282443ad3853be43ba4c4
3
+ metadata.gz: 1776eedb3577464019f6b232c891e4b7752db83e
4
+ data.tar.gz: affadaade23fec033ef69e590fc65ae60993c47d
5
5
  SHA512:
6
- metadata.gz: 3fe405bcc7a9b730cc037afbcff568425874fa6d5e726e88209a6a9dc2b5a4625aaf6cb4fbd292920025f9beddc9abeab3427ad0ee01b95df119b9e55bc5e11a
7
- data.tar.gz: 25c3866794c15f8b068b52d316478c173a277a47f1a0e5f2858678ef6d7321a6a5d2d0d5e685bd8825d8cda802cfa16ae737476e21e4a267bc9d8907cbb4e56a
6
+ metadata.gz: 28bcb8ec76bc92c0ad61410461c770e69dbe4d8eec4e757adbbd434cc9f60fb3c808a8cb9d4642b02b67eb87c229a360b45cee3071cd08757d3a3d9bfa8ec7d1
7
+ data.tar.gz: a1df6245778085613b90dd9a8aa8fc98fec1a3d8713a8d505388940372ff9b5d0228cc29cc14afdc578955a52df14c2d38f027793108571e22204a5d1b83d83f
@@ -25,7 +25,7 @@ module Librarian
25
25
  end
26
26
 
27
27
  def compile_manifest(name, path)
28
- md = Metadata.new(path.join('metadata.rb').to_s)
28
+ md = Metadata.new('metadata.rb', path)
29
29
  { "name" => name, "version" => md.version, "dependencies" => md.dependencies }
30
30
  end
31
31
 
@@ -9,10 +9,12 @@ module Librarian
9
9
 
10
10
  attr_reader :dependencies
11
11
 
12
- def initialize(file_name)
12
+ def initialize(file_name, path)
13
13
  @dependencies = {}
14
14
  @version = "0.0.0"
15
- self.instance_eval File.read(file_name)
15
+ Dir.chdir(path) do
16
+ self.instance_eval File.read(file_name)
17
+ end
16
18
  end
17
19
 
18
20
  def depends(cookbook, version_constraint = nil)
@@ -337,7 +337,9 @@ module Librarian
337
337
  end
338
338
 
339
339
  def http(uri)
340
- environment.net_http_class(uri.host).new(uri.host, uri.port)
340
+ net_http = environment.net_http_class(uri.host).new(uri.host, uri.port)
341
+ net_http.use_ssl = true if uri.scheme == 'https'
342
+ net_http
341
343
  end
342
344
 
343
345
  def http_get(uri)
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = "librarian-chef-nochef"
7
- gem.version = "0.1.0"
7
+ gem.version = "0.1.2"
8
8
  gem.authors = ["Emiliano Ticci", "Jay Feldblum"]
9
9
  gem.email = ["emiticci@gmail.com", "y_feldblum@yahoo.com"]
10
10
  gem.summary = %q{A Bundler for your Chef Cookbooks that does not depends on chef.}
@@ -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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: librarian-chef-nochef
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emiliano Ticci
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-06 00:00:00.000000000 Z
12
+ date: 2014-05-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: librarian