emeril 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,13 +2,15 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: http://cookbooks.opscode.com/api/v1/cookbooks/fooboobunnyyaya
5
+ uri: https://supermarket.getchef.com/api/v1/cookbooks/fooboobunnyyaya
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
9
  headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
10
12
  Accept:
11
- - ! '*/*'
13
+ - "*/*"
12
14
  User-Agent:
13
15
  - Ruby
14
16
  response:
@@ -16,23 +18,33 @@ http_interactions:
16
18
  code: 404
17
19
  message: Not Found
18
20
  headers:
19
- Server:
20
- - ngx_openresty
21
- Date:
22
- - Sun, 19 May 2013 03:06:33 GMT
21
+ Cache-Control:
22
+ - no-cache
23
23
  Content-Type:
24
- - text/html; charset=utf-8
24
+ - application/json; charset=utf-8
25
+ Date:
26
+ - Wed, 06 Aug 2014 03:19:56 GMT
27
+ Server:
28
+ - nginx/1.4.6 (Ubuntu)
29
+ Status:
30
+ - 404 Not Found
31
+ X-Content-Type-Options:
32
+ - nosniff
33
+ X-Frame-Options:
34
+ - SAMEORIGIN
35
+ X-Request-Id:
36
+ - 34ff1dfe-184b-4ab7-9e16-feea9b3579d1
37
+ X-Runtime:
38
+ - '0.006077'
39
+ X-Xss-Protection:
40
+ - 1; mode=block
25
41
  Content-Length:
26
- - '71'
42
+ - '87'
27
43
  Connection:
28
44
  - keep-alive
29
- Status:
30
- - 404 Not Found
31
- Cache-Control:
32
- - no-cache
33
45
  body:
34
- encoding: US-ASCII
35
- string: ! '{"error_code":"NOT_FOUND","error_messages":["Resource does not exist"]}'
46
+ encoding: UTF-8
47
+ string: '{"error_messages":["Resource does not exist."],"error_code":"NOT_FOUND"}'
36
48
  http_version:
37
- recorded_at: Sun, 19 May 2013 03:06:36 GMT
38
- recorded_with: VCR 2.5.0
49
+ recorded_at: Wed, 06 Aug 2014 03:19:56 GMT
50
+ recorded_with: VCR 2.9.2
@@ -1,12 +1,13 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
- require_relative '../spec_helper'
4
- require 'vcr'
3
+ require_relative "../spec_helper"
4
+ require "vcr"
5
5
 
6
- require 'chef/knife'
7
- require 'emeril'
6
+ require "chef/knife"
7
+ require "emeril"
8
8
 
9
9
  VCR.configure do |config|
10
+ config.ignore_hosts "codeclimate.com"
10
11
  config.cassette_library_dir = "spec/fixtures/vcr_cassettes"
11
12
  config.hook_into :webmock
12
13
 
@@ -26,23 +27,25 @@ describe "Releasing and publishing a cookbook" do
26
27
 
27
28
  before do
28
29
  @saved = Hash.new
29
- %w{node_name client_key}.map(&:to_sym).each do |attr|
30
+ %w[node_name client_key].map(&:to_sym).each do |attr|
30
31
  @saved[attr] = Chef::Config[attr]
31
32
  end
32
33
 
33
34
  Chef::Config[:node_name] = ENV["CHEF_NODE_NAME"] || "opsycodesy"
34
35
  Chef::Config[:client_key] = ENV["CHEF_CLIENT_KEY"] || make_client_key!
36
+ Chef::Config[:cache_options][:path] =
37
+ File.join(File.dirname(cookbook_path), "cache")
35
38
  end
36
39
 
37
40
  after do
38
- %w{node_name client_key}.map(&:to_sym).each do |attr|
41
+ %w[node_name client_key].map(&:to_sym).each do |attr|
39
42
  Chef::Config[attr] = @saved.delete(attr)
40
43
  end
41
44
 
42
- FileUtils.remove_dir(cookbook_path)
45
+ FileUtils.remove_dir(File.dirname(cookbook_path))
43
46
  end
44
47
 
45
- let(:cookbook_path) { File.join(Dir.mktmpdir, "emeril")}
48
+ let(:cookbook_path) { File.join(Dir.mktmpdir, "emeril") }
46
49
 
47
50
  let(:logger) do
48
51
  if ENV["DEBUG"]
@@ -56,14 +59,14 @@ describe "Releasing and publishing a cookbook" do
56
59
  end
57
60
 
58
61
  it "releases a new cookbook" do
59
- make_cookbook!(version: "1.2.3")
62
+ make_cookbook!(:version => "1.2.3")
60
63
 
61
- VCR.use_cassette('new_release') do
62
- Emeril::Releaser.new(logger: logger, source_path: cookbook_path).run
64
+ VCR.use_cassette("new_release") do
65
+ Emeril::Releaser.new(:logger => logger, :source_path => cookbook_path).run
63
66
  end
64
67
 
65
68
  # tag was pushed to the remote
66
- git_tag = run_cmd("git tag", in: "#{File.dirname(cookbook_path)}/remote")
69
+ git_tag = run_cmd("git tag", :in => "#{File.dirname(cookbook_path)}/remote")
67
70
  git_tag.chomp.must_equal "v1.2.3"
68
71
  end
69
72
  end
@@ -1,16 +1,20 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
- require_relative '../spec_helper'
4
- require 'vcr'
3
+ require_relative "../spec_helper"
4
+ require "vcr"
5
5
 
6
- require 'chef/knife'
7
- require 'emeril'
6
+ require "chef/knife"
7
+ require "emeril"
8
+
9
+ VCR.configure do |config|
10
+ config.ignore_hosts "codeclimate.com"
11
+ end
8
12
 
9
13
  describe "Releasing and but not publishing a cookbook" do
10
14
 
11
15
  include Emeril::SpecCommon
12
16
 
13
- let(:cookbook_path) { File.join(Dir.mktmpdir, "emeril")}
17
+ let(:cookbook_path) { File.join(Dir.mktmpdir, "emeril") }
14
18
 
15
19
  let(:logger) do
16
20
  if ENV["DEBUG"]
@@ -24,31 +28,35 @@ describe "Releasing and but not publishing a cookbook" do
24
28
  end
25
29
 
26
30
  it "releases a new cookbook" do
27
- make_cookbook!(version: "4.5.6")
31
+ make_cookbook!(:version => "4.5.6")
28
32
 
29
- VCR.use_cassette('new_release') do
33
+ VCR.use_cassette("new_release") do
30
34
  Emeril::Releaser.new(
31
- logger: logger, source_path: cookbook_path, publish_to_community: false
35
+ :logger => logger,
36
+ :source_path => cookbook_path,
37
+ :publish_to_supermarket => false
32
38
  ).run
33
39
  end
34
40
 
35
41
  # tag was pushed to the remote
36
- git_tag = run_cmd("git tag", in: "#{File.dirname(cookbook_path)}/remote")
42
+ git_tag = run_cmd("git tag", :in => "#{File.dirname(cookbook_path)}/remote")
37
43
  git_tag.chomp.must_equal "v4.5.6"
38
44
  end
39
45
 
40
46
  it "releases a new cookbook with a custom git tag prefix" do
41
- make_cookbook!(version: "1.0.0")
47
+ make_cookbook!(:version => "1.0.0")
42
48
 
43
- VCR.use_cassette('new_release') do
49
+ VCR.use_cassette("new_release") do
44
50
  Emeril::Releaser.new(
45
- logger: logger, source_path: cookbook_path, publish_to_community: false,
46
- tag_prefix: "release-"
51
+ :logger => logger,
52
+ :source_path => cookbook_path,
53
+ :publish_to_supermarket => false,
54
+ :tag_prefix => "release-"
47
55
  ).run
48
56
  end
49
57
 
50
58
  # tag was pushed to the remote
51
- git_tag = run_cmd("git tag", in: "#{File.dirname(cookbook_path)}/remote")
59
+ git_tag = run_cmd("git tag", :in => "#{File.dirname(cookbook_path)}/remote")
52
60
  git_tag.chomp.must_equal "release-1.0.0"
53
61
  end
54
62
  end
@@ -1,23 +1,26 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
- gem 'minitest'
3
+ gem "minitest"
4
4
 
5
- if ENV['SIMPLECOV']
6
- require 'simplecov'
7
- SimpleCov.adapters.define 'gem' do
8
- command_name 'Specs'
5
+ if ENV["CODECLIMATE_REPO_TOKEN"]
6
+ require "codeclimate-test-reporter"
7
+ CodeClimate::TestReporter.start
8
+ elsif ENV["COVERAGE"]
9
+ require "simplecov"
10
+ SimpleCov.adapters.define "gem" do
11
+ command_name "Specs"
9
12
 
10
- add_filter '.gem/'
11
- add_filter '/spec/'
13
+ add_filter ".gem/"
14
+ add_filter "/spec/"
12
15
 
13
- add_group 'Libraries', '/lib/'
16
+ add_group "Libraries", "/lib/"
14
17
  end
15
- SimpleCov.start 'gem'
18
+ SimpleCov.start "gem"
16
19
  end
17
20
 
18
- require 'fakefs/safe'
19
- require 'minitest/autorun'
20
- require 'mocha/setup'
21
+ require "fakefs/safe"
22
+ require "minitest/autorun"
23
+ require "mocha/setup"
21
24
 
22
25
  # Nasty hack to redefine IO.read in terms of File#read for fakefs
23
26
  class IO
@@ -26,10 +29,11 @@ class IO
26
29
  end
27
30
  end
28
31
 
29
- require 'chef'
30
- require 'chef/cookbook_site_streaming_uploader'
32
+ require "chef"
33
+ require "chef/cookbook_site_streaming_uploader"
31
34
  class Chef
32
35
  class CookbookSiteStreamingUploader
36
+ # Backwards compat
33
37
  class MultipartStream
34
38
  alias_method :read_original, :read
35
39
 
@@ -42,35 +46,16 @@ end
42
46
 
43
47
  module Emeril
44
48
 
49
+ # Common spec helpers
45
50
  module SpecCommon
46
51
 
47
52
  def make_cookbook!(opts = {})
48
53
  FileUtils.mkdir_p("#{cookbook_path}/recipes")
49
54
  remote_dir = File.join(File.dirname(cookbook_path), "remote")
50
55
 
51
- File.open("#{cookbook_path}/metadata.rb", "wb") do |f|
52
- f.write <<-METADATA_RB.gsub(/^ {10}/, '')
53
- name "#{opts.fetch(:name, "emeril")}"
54
- maintainer "Michael Bluth"
55
- maintainer_email "michael@bluth.com"
56
- license "Apache 2.0"
57
- description "Doing stuff!"
58
- long_description "Doing stuff!"
59
- version "#{opts.fetch(:version, "4.1.1")}"
60
- METADATA_RB
61
- end
62
- File.open("#{cookbook_path}/recipes/default.rb", "wb") do |f|
63
- f.write <<-DEFAULT_RB.gsub(/^ {10}/, '')
64
- directory "/tmp/yeah"
65
-
66
- package "bash"
67
- DEFAULT_RB
68
- end
69
- File.open("#{cookbook_path}/README.md", "wb") do |f|
70
- f.write <<-README.gsub(/^ {10}/, '')
71
- # The beast of the beasts
72
- README
73
- end
56
+ create_metadata(opts)
57
+ create_recipe
58
+ create_readme
74
59
 
75
60
  run_cmd [
76
61
  %{git init},
@@ -92,5 +77,39 @@ module Emeril
92
77
  def run_cmd(cmd, opts = {})
93
78
  %x{cd #{opts.fetch(:in, cookbook_path)} && #{cmd}}
94
79
  end
80
+
81
+ private
82
+
83
+ def create_metadata(opts)
84
+ File.open("#{cookbook_path}/metadata.rb", "wb") do |f|
85
+ f.write <<-METADATA_RB.gsub(/^ {10}/, "")
86
+ name "#{opts.fetch(:name, "emeril")}"
87
+ maintainer "Michael Bluth"
88
+ maintainer_email "michael@bluth.com"
89
+ license "Apache 2.0"
90
+ description "Doing stuff!"
91
+ long_description "Doing stuff!"
92
+ version "#{opts.fetch(:version, "4.1.1")}"
93
+ METADATA_RB
94
+ end
95
+ end
96
+
97
+ def create_recipe
98
+ File.open("#{cookbook_path}/recipes/default.rb", "wb") do |f|
99
+ f.write <<-DEFAULT_RB.gsub(/^ {10}/, "")
100
+ directory "/tmp/yeah"
101
+
102
+ package "bash"
103
+ DEFAULT_RB
104
+ end
105
+ end
106
+
107
+ def create_readme
108
+ File.open("#{cookbook_path}/README.md", "wb") do |f|
109
+ f.write <<-README.gsub(/^ {10}/, "")
110
+ # The beast of the beasts
111
+ README
112
+ end
113
+ end
95
114
  end
96
115
  end
@@ -1,12 +1,13 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
- require_relative '../../spec_helper'
4
- require 'vcr'
3
+ require_relative "../../spec_helper"
4
+ require "vcr"
5
5
 
6
- require 'emeril/category'
6
+ require "emeril/category"
7
7
 
8
8
  VCR.configure do |config|
9
- config.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
9
+ config.ignore_hosts "codeclimate.com"
10
+ config.cassette_library_dir = "spec/fixtures/vcr_cassettes"
10
11
  config.hook_into :webmock
11
12
  end
12
13
 
@@ -14,14 +15,14 @@ describe Emeril::Category do
14
15
 
15
16
  describe ".for_cookbook" do
16
17
  it "returns a category string for a known cookbook" do
17
- VCR.use_cassette('known_cookbook') do
18
- Emeril::Category.for_cookbook('mysql').must_equal 'Databases'
18
+ VCR.use_cassette("known_cookbook") do
19
+ Emeril::Category.for_cookbook("mysql").must_equal "Databases"
19
20
  end
20
21
  end
21
22
 
22
23
  it "returns nil for a nonexistant cookbook" do
23
- VCR.use_cassette('nonexistant_cookbook') do
24
- Emeril::Category.for_cookbook('fooboobunnyyaya').must_be_nil
24
+ VCR.use_cassette("nonexistant_cookbook") do
25
+ Emeril::Category.for_cookbook("fooboobunnyyaya").must_be_nil
25
26
  end
26
27
  end
27
28
  end
@@ -1,10 +1,10 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
- require_relative '../../spec_helper'
4
- require 'tmpdir'
5
- require 'logger'
3
+ require_relative "../../spec_helper"
4
+ require "tmpdir"
5
+ require "logger"
6
6
 
7
- require 'emeril/git_tagger'
7
+ require "emeril/git_tagger"
8
8
 
9
9
  describe Emeril::GitTagger do
10
10
 
@@ -39,7 +39,7 @@ describe Emeril::GitTagger do
39
39
 
40
40
  it "tags the repo" do
41
41
  git_tagger.run
42
- run_cmd(%{git tag}).must_match /^v4.1.1$/
42
+ run_cmd(%{git tag}).must_match(/^v4.1.1$/)
43
43
  end
44
44
 
45
45
  it "disables the tag prefix" do
@@ -50,7 +50,7 @@ describe Emeril::GitTagger do
50
50
  :tag_prefix => false
51
51
  ).run
52
52
 
53
- run_cmd(%{git tag}).must_match /^4.1.1$/
53
+ run_cmd(%{git tag}).must_match(/^4.1.1$/)
54
54
  end
55
55
 
56
56
  it "uses a custom tag prefix" do
@@ -61,7 +61,7 @@ describe Emeril::GitTagger do
61
61
  :tag_prefix => "version-"
62
62
  ).run
63
63
 
64
- run_cmd(%{git tag}).must_match /^version-4.1.1$/
64
+ run_cmd(%{git tag}).must_match(/^version-4.1.1$/)
65
65
  end
66
66
 
67
67
  it "pushes the tag to the remote" do
@@ -1,8 +1,8 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
- require_relative '../../spec_helper'
3
+ require_relative "../../spec_helper"
4
4
 
5
- require 'emeril/metadata_chopper'
5
+ require "emeril/metadata_chopper"
6
6
 
7
7
  describe Emeril::MetadataChopper do
8
8
 
@@ -56,7 +56,7 @@ describe Emeril::MetadataChopper do
56
56
 
57
57
  def stub_metadata!(name = "foobar", version = "5.2.1")
58
58
  File.open("/tmp/metadata.rb", "wb") do |f|
59
- f.write <<-METADATA_RB.gsub(/^ {8}/, '')
59
+ f.write <<-METADATA_RB.gsub(/^ {8}/, "")
60
60
  name "#{name}"
61
61
  maintainer "Michael Bluth"
62
62
  maintainer_email "michael@bluth.com"
@@ -1,14 +1,15 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
- require_relative '../../spec_helper'
4
- require 'chef/knife'
5
- require 'chef/config'
3
+ require_relative "../../spec_helper"
4
+ require "chef/knife"
5
+ require "chef/config"
6
6
 
7
- require 'emeril/publisher'
7
+ require "emeril/publisher"
8
8
 
9
+ # Dummy Knife plugin
9
10
  class DummyKnife < Emeril::Publisher::SharePlugin
10
11
 
11
- def run ; end
12
+ def run; end
12
13
  end
13
14
 
14
15
  describe Emeril::Publisher do
@@ -17,7 +18,7 @@ describe Emeril::Publisher do
17
18
  let(:category) { "Utilities" }
18
19
 
19
20
  let(:publisher) do
20
- if ENV['DEBUG']
21
+ if ENV["DEBUG"]
21
22
  logger = Logger.new(STDOUT)
22
23
  logger.level = Logger::DEBUG
23
24
  else
@@ -35,7 +36,7 @@ describe Emeril::Publisher do
35
36
 
36
37
  before do
37
38
  @saved = Hash.new
38
- %w{node_name client_key}.map(&:to_sym).each do |attr|
39
+ %w[node_name client_key].map(&:to_sym).each do |attr|
39
40
  @saved[attr] = Chef::Config[attr]
40
41
  end
41
42
 
@@ -44,7 +45,7 @@ describe Emeril::Publisher do
44
45
  end
45
46
 
46
47
  after do
47
- %w{node_name client_key}.map(&:to_sym).each do |attr|
48
+ %w[node_name client_key].map(&:to_sym).each do |attr|
48
49
  Chef::Config[attr] = @saved.delete(attr)
49
50
  end
50
51
  end
@@ -133,7 +134,7 @@ describe Emeril::Publisher do
133
134
  it "calls super if logger is nil" do
134
135
  ui_without_logger.msg("yo")
135
136
 
136
- stdout.string.must_match /^yo$/
137
+ stdout.string.must_match(/^yo$/)
137
138
  end
138
139
  end
139
140
 
@@ -148,7 +149,7 @@ describe Emeril::Publisher do
148
149
  it "calls super if logger is nil" do
149
150
  ui_without_logger.err("yolo")
150
151
 
151
- stderr.string.must_match /^yolo$/
152
+ stderr.string.must_match(/^yolo$/)
152
153
  end
153
154
  end
154
155
 
@@ -163,7 +164,7 @@ describe Emeril::Publisher do
163
164
  it "calls super if logger is nil" do
164
165
  ui_without_logger.err("caution")
165
166
 
166
- stderr.string.must_match /^caution$/
167
+ stderr.string.must_match(/^caution$/)
167
168
  end
168
169
  end
169
170
 
@@ -178,7 +179,7 @@ describe Emeril::Publisher do
178
179
  it "calls super if logger is nil" do
179
180
  ui_without_logger.fatal("die")
180
181
 
181
- stderr.string.must_match /die$/
182
+ stderr.string.must_match(/die$/)
182
183
  end
183
184
  end
184
185
 
@@ -197,10 +198,9 @@ describe Emeril::Publisher do
197
198
 
198
199
  def make_cookbook!
199
200
  FileUtils.mkdir_p("#{cookbook_path}/recipes")
200
- remote_dir = File.join(File.dirname(cookbook_path), "remote")
201
201
 
202
202
  File.open("#{cookbook_path}/metadata.rb", "wb") do |f|
203
- f.write <<-METADATA_RB.gsub(/^ {8}/, '')
203
+ f.write <<-METADATA_RB.gsub(/^ {8}/, "")
204
204
  name "#{name}"
205
205
  maintainer "Michael Bluth"
206
206
  maintainer_email "michael@bluth.com"
@@ -211,7 +211,7 @@ describe Emeril::Publisher do
211
211
  METADATA_RB
212
212
  end
213
213
  File.open("#{cookbook_path}/recipes/default.rb", "wb") do |f|
214
- f.write <<-DEFAULT_RB.gsub(/^ {8}/, '')
214
+ f.write <<-DEFAULT_RB.gsub(/^ {8}/, "")
215
215
  directory "/tmp/yeah"
216
216
 
217
217
  package "bash"