emeril 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f6302d107f9d6cf6b6b69b14bd4f6f0514d50fe6
4
+ data.tar.gz: 1e89c4e9dfdba1758ce8d4cba37cf513bb0e3afb
5
+ SHA512:
6
+ metadata.gz: e8b707e4affd40fe9520dc2ed28717b761abab6ff7d020cebebc6f07d5059327ecbcc7409466b42dc8c7801c679feded3e4e54e16bbd34e9455ec9ae9b05081b
7
+ data.tar.gz: 987c6de17c5bfbcc63fdde1607dfe3f4a002cc095b291856bfd7f65bb9801ba7dd6bf0fd60e26e211fc09bd095ab3d610b5542cd93ee4ed0f44b6fe17d54b016
data/.travis.yml CHANGED
@@ -6,6 +6,17 @@ rvm:
6
6
  - 1.9.2
7
7
  - ruby-head
8
8
 
9
+ env:
10
+ - "CHEF_VERSION="
11
+ - "CHEF_VERSION='~> 11.6.0'"
12
+ - "CHEF_VERSION='~> 11.4.4'"
13
+ - "CHEF_VERSION='~> 10.26'"
14
+
9
15
  matrix:
10
16
  allow_failures:
11
17
  - rvm: ruby-head
18
+ exclude:
19
+ - rvm: 2.0.0
20
+ env: "CHEF_VERSION='~> 11.4.4'"
21
+ - rvm: 2.0.0
22
+ env: "CHEF_VERSION='~> 10.26'"
data/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## 0.7.0 / 2013-08-26
2
+
3
+ ### Breaking Changes
4
+
5
+ * Drop support for Chef version 0.10.10. ([@fnichol][])
6
+
7
+ ### Bug fixes
8
+
9
+ * Pull request [#2][]: Dont set default publisher when community site is false. ([@capen][])
10
+
11
+ ### Improvements
12
+
13
+ * Add integration test suite and explicitly test against different versions of Chef. ([@fnichol][])
14
+
15
+
1
16
  ## 0.6.0 / 2013-05-30
2
17
 
3
18
  ### Bug fixes
@@ -22,5 +37,7 @@ The initial release, **BAM**!
22
37
 
23
38
  <!--- The following link definition list is generated by PimpMyChangelog --->
24
39
  [#1]: https://github.com/fnichol/emeril/issues/1
40
+ [#2]: https://github.com/fnichol/emeril/issues/2
41
+ [@capen]: https://github.com/capen
25
42
  [@fnichol]: https://github.com/fnichol
26
43
  [@thbishop]: https://github.com/thbishop
data/Gemfile CHANGED
@@ -1,3 +1,8 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ group :test do
6
+ # allow CI to override the version of Chef for matrix testing
7
+ gem 'chef', (ENV['CHEF_VERSION'] || '>= 0.10.10')
8
+ end
data/Guardfile CHANGED
@@ -1,6 +1,6 @@
1
1
  guard 'minitest' do
2
2
  watch(%r|^spec/(.*)_spec\.rb|)
3
- watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
3
+ watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "spec/unit/#{m[1]}#{m[2]}_spec.rb" }
4
4
  watch(%r|^spec/spec_helper\.rb|) { "spec" }
5
5
  end
6
6
 
data/README.md CHANGED
@@ -54,6 +54,7 @@ considered production cookbook files:
54
54
  * `CHANGELOG.*`
55
55
  * `metadata.{json,rb}`
56
56
  * `attributes/**/*`
57
+ * `definitions/**/*`
57
58
  * `files/**/*`
58
59
  * `libraries/**/*`
59
60
  * `providers/**/*`
data/Rakefile CHANGED
@@ -5,12 +5,18 @@ require 'tailor/rake_task'
5
5
 
6
6
  Rake::TestTask.new(:unit) do |t|
7
7
  t.libs.push "lib"
8
- t.test_files = FileList['spec/**/*_spec.rb']
8
+ t.test_files = FileList['spec/unit/**/*_spec.rb']
9
+ t.verbose = true
10
+ end
11
+
12
+ Rake::TestTask.new(:integration) do |t|
13
+ t.libs.push "lib"
14
+ t.test_files = FileList['spec/integration/**/*_spec.rb']
9
15
  t.verbose = true
10
16
  end
11
17
 
12
18
  desc "Run all test suites"
13
- task :test => [:unit]
19
+ task :test => [:unit, :integration]
14
20
 
15
21
  desc "Run cane to check quality metrics"
16
22
  Cane::RakeTask.new do |cane|
data/emeril.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.required_ruby_version = '>= 1.9.2'
22
22
 
23
- spec.add_dependency 'chef', '>= 0.10.10'
23
+ spec.add_dependency 'chef', '> 0.10.10'
24
24
 
25
25
  spec.add_development_dependency 'bundler', '~> 1.3'
26
26
  spec.add_development_dependency 'rake'
@@ -99,6 +99,7 @@ module Emeril
99
99
  def msg(message)
100
100
  logger ? logger.info(message) : super
101
101
  end
102
+ alias_method :info, :msg
102
103
 
103
104
  def err(message)
104
105
  logger ? logger.error(message) : super
@@ -36,8 +36,8 @@ module Emeril
36
36
  @metadata = options.fetch(:metadata) { default_metadata }
37
37
  @category = options.fetch(:category) { default_category }
38
38
  @git_tagger = options.fetch(:git_tagger) { default_git_tagger }
39
- @publisher = options.fetch(:publisher) { default_publisher }
40
39
  @publish_to_community = options.fetch(:publish_to_community) { true }
40
+ set_publisher(options.fetch(:publisher, nil)) if publish_to_community
41
41
  end
42
42
 
43
43
  # Tags and releases a cookbook.
@@ -77,6 +77,10 @@ module Emeril
77
77
  )
78
78
  end
79
79
 
80
+ def set_publisher(publisher)
81
+ @publisher = publisher || default_publisher
82
+ end
83
+
80
84
  def default_category
81
85
  Category.for_cookbook(metadata[:name]) || "Other"
82
86
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Emeril
4
4
 
5
- VERSION = "0.6.0"
5
+ VERSION = "0.7.0"
6
6
  end
@@ -0,0 +1,27 @@
1
+ -----BEGIN RSA PRIVATE KEY-----
2
+ MIIEpAIBAAKCAQEA0sOY9tHvVtLZ6xmVmH8d8LrRrNcWOXbrvvCrai+T3GtRvRSL
3
+ hksLrpOpD0L9EHM6NdThNF/eGA9Oq+UKAe6yXR0hwsKuxKXqQ8SEmlhZZ9GiuggD
4
+ B/zYD3ItB6SGpdkRe7kQqTChQyrIXqbRkJqxoTXLyeJDF0sCyTdp3L8IZCUWodM8
5
+ oV9TlQBJHYtG1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/S+vo8Df0m+H4UBpU
21
+ f5o6EwBSd/UQxwtZIE0lsQKBgQCswfjX8Eg8KL/lJNpIOOE3j4XXE9ptksmJl2sB
22
+ jxDnQYoiMqVO808saHVquC/vTrpd6tKtNpehWwjeTFuqITWLi8jmmQ+gNTKsC9Gn
23
+ 1Pxf2Gb67PqnEpwQGln+TRtgQ5HBrdHiQIi+5am+gnw89pDrjjO5rZwhanAo6KPJ
24
+ 1zcPNQKBgQDxFu8v4frDmRNCVaZS4f1B6wTrcMrnibIDlnzrK9GG6Hz1U7dDv8s8
25
+ Nf4UmeMzDXjlPWZVOvS5+9HKJPdPj7/onv8B2m18+lcgTTDJBkza7R1mjL1Cje/Z
26
+ KcVGsryKN6cjE7yCDasnA7R2rVBV/7NWeJV77bmzT5O//rW4yIfUIg==
27
+ -----END RSA PRIVATE KEY-----
@@ -0,0 +1,125 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://cookbooks.opscode.com/api/v1/cookbooks/emeril
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - ! '*/*'
12
+ User-Agent:
13
+ - Ruby
14
+ X-Ops-Userid: opsycodesy
15
+ response:
16
+ status:
17
+ code: 404
18
+ message: Not Found
19
+ headers:
20
+ Server:
21
+ - ngx_openresty
22
+ Date:
23
+ - Tue, 27 Aug 2013 04:18:43 GMT
24
+ Content-Type:
25
+ - text/html; charset=utf-8
26
+ Content-Length:
27
+ - '71'
28
+ Connection:
29
+ - keep-alive
30
+ Status:
31
+ - 404 Not Found
32
+ Cache-Control:
33
+ - no-cache
34
+ body:
35
+ encoding: US-ASCII
36
+ string: ! '{"error_messages":["Resource does not exist"],"error_code":"NOT_FOUND"}'
37
+ http_version:
38
+ recorded_at: Tue, 27 Aug 2013 04:18:43 GMT
39
+ - request:
40
+ method: post
41
+ uri: http://cookbooks.opscode.com/api/v1/cookbooks
42
+ body:
43
+ encoding: ASCII-8BIT
44
+ string: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XVsdGlwYXJ0Q2xpZW50Njk0ODE2WlpaWloNCkNvbnRlbnQtRGlzcG9z
62
+ aXRpb246IGZvcm0tZGF0YTsgbmFtZT0iY29va2Jvb2siDQoNCnsiY2F0ZWdv
63
+ cnkiOiJPdGhlciJ9DQotLS0tLS1SdWJ5TXVsdGlwYXJ0Q2xpZW50Njk0ODE2
64
+ WlpaWlotLQ0K
65
+ headers:
66
+ Accept:
67
+ - application/json
68
+ X-Chef-Version:
69
+ - 11.4.4
70
+ X-Ops-Sign:
71
+ - algorithm=sha1;version=1.0;
72
+ X-Ops-Userid: opsycodesy
73
+ X-Ops-Timestamp:
74
+ - '2013-08-27T04:18:43Z'
75
+ X-Ops-Content-Hash:
76
+ - ! '{{X-Ops-Content-Hash}}'
77
+ X-Ops-Authorization-1:
78
+ - ! '{{X-Ops-Authorization-1}}'
79
+ X-Ops-Authorization-2:
80
+ - ! '{{X-Ops-Authorization-2}}'
81
+ X-Ops-Authorization-3:
82
+ - ! '{{X-Ops-Authorization-3}}'
83
+ X-Ops-Authorization-4:
84
+ - ! '{{X-Ops-Authorization-4}}'
85
+ X-Ops-Authorization-5:
86
+ - ! '{{X-Ops-Authorization-5}}'
87
+ X-Ops-Authorization-6:
88
+ - ! '{{X-Ops-Authorization-6}}'
89
+ User-Agent:
90
+ - Ruby
91
+ Content-Length:
92
+ - '864'
93
+ Content-Type:
94
+ - multipart/form-data; boundary=----RubyMultipartClient694816ZZZZZ
95
+ response:
96
+ status:
97
+ code: 201
98
+ message: Created
99
+ headers:
100
+ Server:
101
+ - ngx_openresty
102
+ Date:
103
+ - Tue, 27 Aug 2013 04:18:45 GMT
104
+ Content-Type:
105
+ - application/json; charset=utf-8
106
+ Content-Length:
107
+ - '55'
108
+ Connection:
109
+ - keep-alive
110
+ Status:
111
+ - 201 Created
112
+ Location:
113
+ - http://cookbooks.opscode.com/cookbooks/emeril
114
+ Cache-Control:
115
+ - no-cache
116
+ Set-Cookie:
117
+ - logged-in-username=fnichol; domain=.opscode.com; path=/
118
+ X-Runtime:
119
+ - '2344'
120
+ body:
121
+ encoding: US-ASCII
122
+ string: ! '{"uri":"http://cookbooks.opscode.com/cookbooks/emeril"}'
123
+ http_version:
124
+ recorded_at: Tue, 27 Aug 2013 04:18:45 GMT
125
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,69 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require_relative '../spec_helper'
4
+ require 'vcr'
5
+
6
+ require 'chef/knife'
7
+ require 'emeril'
8
+
9
+ VCR.configure do |config|
10
+ config.cassette_library_dir = "spec/fixtures/vcr_cassettes"
11
+ config.hook_into :webmock
12
+
13
+ # remove sensitive authentication information from the recording
14
+ config.before_record do |interaction|
15
+ headers = interaction.request.headers
16
+ headers.keys.
17
+ select { |k| k =~ /^X-Ops-(Authorization-|Content-Hash)/ }.
18
+ each { |header| headers[header] = Array("{{#{header}}}") }
19
+ headers["X-Ops-Userid"] = "opsycodesy"
20
+ end
21
+ end
22
+
23
+ describe "Releasing and publishing a cookbook" do
24
+
25
+ include Emeril::SpecCommon
26
+
27
+ before do
28
+ @saved = Hash.new
29
+ %w{node_name client_key}.map(&:to_sym).each do |attr|
30
+ @saved[attr] = Chef::Config[attr]
31
+ end
32
+
33
+ Chef::Config[:node_name] = ENV["CHEF_NODE_NAME"] || "opsycodesy"
34
+ Chef::Config[:client_key] = ENV["CHEF_CLIENT_KEY"] || make_client_key!
35
+ end
36
+
37
+ after do
38
+ %w{node_name client_key}.map(&:to_sym).each do |attr|
39
+ Chef::Config[attr] = @saved.delete(attr)
40
+ end
41
+
42
+ FileUtils.remove_dir(cookbook_path)
43
+ end
44
+
45
+ let(:cookbook_path) { File.join(Dir.mktmpdir, "emeril")}
46
+
47
+ let(:logger) do
48
+ if ENV["DEBUG"]
49
+ Chef::Log.level = Logger::DEBUG
50
+ l = Logger.new(STDOUT)
51
+ l.level = Logger::DEBUG
52
+ l
53
+ else
54
+ Logger.new(StringIO.new)
55
+ end
56
+ end
57
+
58
+ it "releases a new cookbook" do
59
+ make_cookbook!(version: "1.2.3")
60
+
61
+ VCR.use_cassette('new_release') do
62
+ Emeril::Releaser.new(logger: logger, source_path: cookbook_path).run
63
+ end
64
+
65
+ # tag was pushed to the remote
66
+ git_tag = run_cmd("git tag", in: "#{File.dirname(cookbook_path)}/remote")
67
+ git_tag.chomp.must_equal "v1.2.3"
68
+ end
69
+ end
@@ -0,0 +1,54 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require_relative '../spec_helper'
4
+ require 'vcr'
5
+
6
+ require 'chef/knife'
7
+ require 'emeril'
8
+
9
+ describe "Releasing and but not publishing a cookbook" do
10
+
11
+ include Emeril::SpecCommon
12
+
13
+ let(:cookbook_path) { File.join(Dir.mktmpdir, "emeril")}
14
+
15
+ let(:logger) do
16
+ if ENV["DEBUG"]
17
+ Chef::Log.level = Logger::DEBUG
18
+ l = Logger.new(STDOUT)
19
+ l.level = Logger::DEBUG
20
+ l
21
+ else
22
+ Logger.new(StringIO.new)
23
+ end
24
+ end
25
+
26
+ it "releases a new cookbook" do
27
+ make_cookbook!(version: "4.5.6")
28
+
29
+ VCR.use_cassette('new_release') do
30
+ Emeril::Releaser.new(
31
+ logger: logger, source_path: cookbook_path, publish_to_community: false
32
+ ).run
33
+ end
34
+
35
+ # tag was pushed to the remote
36
+ git_tag = run_cmd("git tag", in: "#{File.dirname(cookbook_path)}/remote")
37
+ git_tag.chomp.must_equal "v4.5.6"
38
+ end
39
+
40
+ it "releases a new cookbook with a custom git tag prefix" do
41
+ make_cookbook!(version: "1.0.0")
42
+
43
+ VCR.use_cassette('new_release') do
44
+ Emeril::Releaser.new(
45
+ logger: logger, source_path: cookbook_path, publish_to_community: false,
46
+ tag_prefix: "release-"
47
+ ).run
48
+ end
49
+
50
+ # tag was pushed to the remote
51
+ git_tag = run_cmd("git tag", in: "#{File.dirname(cookbook_path)}/remote")
52
+ git_tag.chomp.must_equal "release-1.0.0"
53
+ end
54
+ end
data/spec/spec_helper.rb CHANGED
@@ -25,3 +25,72 @@ class IO
25
25
  File.open(args[0], "rb") { |f| f.read(args[1]) }
26
26
  end
27
27
  end
28
+
29
+ require 'chef'
30
+ require 'chef/cookbook_site_streaming_uploader'
31
+ class Chef
32
+ class CookbookSiteStreamingUploader
33
+ class MultipartStream
34
+ alias_method :read_original, :read
35
+
36
+ def read(how_much = nil)
37
+ read_original(how_much || size)
38
+ end
39
+ end
40
+ end
41
+ end
42
+
43
+ module Emeril
44
+
45
+ module SpecCommon
46
+
47
+ def make_cookbook!(opts = {})
48
+ FileUtils.mkdir_p("#{cookbook_path}/recipes")
49
+ remote_dir = File.join(File.dirname(cookbook_path), "remote")
50
+
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
74
+
75
+ run_cmd [
76
+ %{git init},
77
+ %{git config user.email "you@example.com"},
78
+ %{git config user.name "Your Name"},
79
+ %{git add .},
80
+ %{git commit -m "Initial"},
81
+ %{git remote add origin #{remote_dir}},
82
+ %{git init --bare #{remote_dir}}
83
+ ].join(" && ")
84
+ end
85
+
86
+ def make_client_key!
87
+ file = "#{File.dirname(cookbook_path)}/client_key.pem"
88
+ FileUtils.cp("#{File.dirname(__FILE__)}/fixtures/client_key.pem", file)
89
+ file
90
+ end
91
+
92
+ def run_cmd(cmd, opts = {})
93
+ %x{cd #{opts.fetch(:in, cookbook_path)} && #{cmd}}
94
+ end
95
+ end
96
+ end
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
- require_relative '../spec_helper'
3
+ require_relative '../../spec_helper'
4
4
  require 'vcr'
5
5
 
6
6
  require 'emeril/category'
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
- require_relative '../spec_helper'
3
+ require_relative '../../spec_helper'
4
4
  require 'tmpdir'
5
5
  require 'logger'
6
6
 
@@ -8,11 +8,13 @@ require 'emeril/git_tagger'
8
8
 
9
9
  describe Emeril::GitTagger do
10
10
 
11
- let(:sandbox_path) { File.join(Dir.mktmpdir, "emeril") }
11
+ include Emeril::SpecCommon
12
+
13
+ let(:cookbook_path) { File.join(Dir.mktmpdir, "emeril") }
12
14
 
13
15
  let(:git_tagger) do
14
16
  Emeril::GitTagger.new(
15
- :source_path => sandbox_path,
17
+ :source_path => cookbook_path,
16
18
  :version => "4.1.1",
17
19
  :logger => nil
18
20
  )
@@ -32,7 +34,7 @@ describe Emeril::GitTagger do
32
34
  end
33
35
 
34
36
  after do
35
- FileUtils.remove_dir(sandbox_path)
37
+ FileUtils.remove_dir(cookbook_path)
36
38
  end
37
39
 
38
40
  it "tags the repo" do
@@ -42,7 +44,7 @@ describe Emeril::GitTagger do
42
44
 
43
45
  it "disables the tag prefix" do
44
46
  Emeril::GitTagger.new(
45
- :source_path => sandbox_path,
47
+ :source_path => cookbook_path,
46
48
  :version => "4.1.1",
47
49
  :logger => nil,
48
50
  :tag_prefix => false
@@ -53,7 +55,7 @@ describe Emeril::GitTagger do
53
55
 
54
56
  it "uses a custom tag prefix" do
55
57
  Emeril::GitTagger.new(
56
- :source_path => sandbox_path,
58
+ :source_path => cookbook_path,
57
59
  :version => "4.1.1",
58
60
  :logger => nil,
59
61
  :tag_prefix => "version-"
@@ -72,7 +74,7 @@ describe Emeril::GitTagger do
72
74
  describe "when git repo is not clean" do
73
75
 
74
76
  before do
75
- File.open("#{sandbox_path}/README.md", "wb") { |f| f.write "Yep." }
77
+ File.open("#{cookbook_path}/README.md", "wb") { |f| f.write "Yep." }
76
78
  end
77
79
 
78
80
  it "raises GitNotCleanError" do
@@ -104,44 +106,4 @@ describe Emeril::GitTagger do
104
106
  end
105
107
  end
106
108
  end
107
-
108
- private
109
-
110
- def make_cookbook!
111
- FileUtils.mkdir_p("#{sandbox_path}/recipes")
112
- remote_dir = File.join(File.dirname(sandbox_path), "remote")
113
-
114
- File.open("#{sandbox_path}/metadata.rb", "wb") do |f|
115
- f.write <<-METADATA_RB.gsub(/^ {8}/, '')
116
- name "#{name}"
117
- maintainer "Michael Bluth"
118
- maintainer_email "michael@bluth.com"
119
- license "Apache 2.0"
120
- description "Doing stuff!"
121
- long_description "Doing stuff!"
122
- version "4.1.1"
123
- METADATA_RB
124
- end
125
- File.open("#{sandbox_path}/recipes/default.rb", "wb") do |f|
126
- f.write <<-DEFAULT_RB.gsub(/^ {8}/, '')
127
- directory "/tmp/yeah"
128
-
129
- package "bash"
130
- DEFAULT_RB
131
- end
132
-
133
- run_cmd [
134
- %{git init},
135
- %{git config user.email "you@example.com"},
136
- %{git config user.name "Your Name"},
137
- %{git add .},
138
- %{git commit -m "Initial"},
139
- %{git remote add origin #{remote_dir}},
140
- %{git init --bare #{remote_dir}}
141
- ].join(" && ")
142
- end
143
-
144
- def run_cmd(cmd, opts = {})
145
- %x{cd #{opts.fetch(:in, sandbox_path)} && #{cmd}}
146
- end
147
109
  end
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
- require_relative '../spec_helper'
3
+ require_relative '../../spec_helper'
4
4
 
5
5
  require 'emeril/metadata_chopper'
6
6
 
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
- require_relative '../spec_helper'
3
+ require_relative '../../spec_helper'
4
4
  require 'chef/knife'
5
5
  require 'chef/config'
6
6
 
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
- require_relative '../spec_helper'
3
+ require_relative '../../spec_helper'
4
4
 
5
5
  require 'emeril/releaser'
6
6
 
@@ -98,6 +98,17 @@ describe Emeril::Releaser do
98
98
  )
99
99
  end
100
100
 
101
+ it "does not call Publisher when disabling community site publishing" do
102
+ Emeril::Publisher.expects(:new).never
103
+
104
+ Emeril::Releaser.new(
105
+ :source_path => source_path,
106
+ :metadata => metadata,
107
+ :category => category,
108
+ :publish_to_community => false
109
+ )
110
+ end
111
+
101
112
  it "disables the git version tag prefix" do
102
113
  Emeril::GitTagger.expects(:new).with do |opts|
103
114
  opts[:tag_prefix] == false
metadata CHANGED
@@ -1,36 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emeril
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
5
- prerelease:
4
+ version: 0.7.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Fletcher Nichol
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-05-30 00:00:00.000000000 Z
11
+ date: 2013-08-27 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: chef
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>'
20
18
  - !ruby/object:Gem::Version
21
19
  version: 0.10.10
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>'
28
25
  - !ruby/object:Gem::Version
29
26
  version: 0.10.10
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: bundler
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,193 +41,169 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: minitest
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: guard-minitest
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: mocha
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - '>='
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - '>='
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: fakefs
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>='
101
+ - - '>='
116
102
  - !ruby/object:Gem::Version
117
103
  version: '0'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ! '>='
108
+ - - '>='
124
109
  - !ruby/object:Gem::Version
125
110
  version: '0'
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: vcr
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
- - - ! '>='
115
+ - - '>='
132
116
  - !ruby/object:Gem::Version
133
117
  version: '0'
134
118
  type: :development
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
- - - ! '>='
122
+ - - '>='
140
123
  - !ruby/object:Gem::Version
141
124
  version: '0'
142
125
  - !ruby/object:Gem::Dependency
143
126
  name: webmock
144
127
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
128
  requirements:
147
- - - ! '>='
129
+ - - '>='
148
130
  - !ruby/object:Gem::Version
149
131
  version: '0'
150
132
  type: :development
151
133
  prerelease: false
152
134
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
135
  requirements:
155
- - - ! '>='
136
+ - - '>='
156
137
  - !ruby/object:Gem::Version
157
138
  version: '0'
158
139
  - !ruby/object:Gem::Dependency
159
140
  name: cane
160
141
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
142
  requirements:
163
- - - ! '>='
143
+ - - '>='
164
144
  - !ruby/object:Gem::Version
165
145
  version: '0'
166
146
  type: :development
167
147
  prerelease: false
168
148
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
149
  requirements:
171
- - - ! '>='
150
+ - - '>='
172
151
  - !ruby/object:Gem::Version
173
152
  version: '0'
174
153
  - !ruby/object:Gem::Dependency
175
154
  name: guard-cane
176
155
  requirement: !ruby/object:Gem::Requirement
177
- none: false
178
156
  requirements:
179
- - - ! '>='
157
+ - - '>='
180
158
  - !ruby/object:Gem::Version
181
159
  version: '0'
182
160
  type: :development
183
161
  prerelease: false
184
162
  version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
163
  requirements:
187
- - - ! '>='
164
+ - - '>='
188
165
  - !ruby/object:Gem::Version
189
166
  version: '0'
190
167
  - !ruby/object:Gem::Dependency
191
168
  name: tailor
192
169
  requirement: !ruby/object:Gem::Requirement
193
- none: false
194
170
  requirements:
195
- - - ! '>='
171
+ - - '>='
196
172
  - !ruby/object:Gem::Version
197
173
  version: '0'
198
174
  type: :development
199
175
  prerelease: false
200
176
  version_requirements: !ruby/object:Gem::Requirement
201
- none: false
202
177
  requirements:
203
- - - ! '>='
178
+ - - '>='
204
179
  - !ruby/object:Gem::Version
205
180
  version: '0'
206
181
  - !ruby/object:Gem::Dependency
207
182
  name: simplecov
208
183
  requirement: !ruby/object:Gem::Requirement
209
- none: false
210
184
  requirements:
211
- - - ! '>='
185
+ - - '>='
212
186
  - !ruby/object:Gem::Version
213
187
  version: '0'
214
188
  type: :development
215
189
  prerelease: false
216
190
  version_requirements: !ruby/object:Gem::Requirement
217
- none: false
218
191
  requirements:
219
- - - ! '>='
192
+ - - '>='
220
193
  - !ruby/object:Gem::Version
221
194
  version: '0'
222
195
  - !ruby/object:Gem::Dependency
223
196
  name: countloc
224
197
  requirement: !ruby/object:Gem::Requirement
225
- none: false
226
198
  requirements:
227
- - - ! '>='
199
+ - - '>='
228
200
  - !ruby/object:Gem::Version
229
201
  version: '0'
230
202
  type: :development
231
203
  prerelease: false
232
204
  version_requirements: !ruby/object:Gem::Requirement
233
- none: false
234
205
  requirements:
235
- - - ! '>='
206
+ - - '>='
236
207
  - !ruby/object:Gem::Version
237
208
  version: '0'
238
209
  description: Release Chef cookbooks
@@ -266,45 +237,52 @@ files:
266
237
  - lib/emeril/thor.rb
267
238
  - lib/emeril/thor_tasks.rb
268
239
  - lib/emeril/version.rb
269
- - spec/emeril/category_spec.rb
270
- - spec/emeril/git_tagger_spec.rb
271
- - spec/emeril/metadata_chopper_spec.rb
272
- - spec/emeril/publisher_spec.rb
273
- - spec/emeril/releaser_spec.rb
240
+ - spec/fixtures/client_key.pem
274
241
  - spec/fixtures/vcr_cassettes/known_cookbook.yml
242
+ - spec/fixtures/vcr_cassettes/new_release.yml
275
243
  - spec/fixtures/vcr_cassettes/nonexistant_cookbook.yml
244
+ - spec/integration/new_release_spec.rb
245
+ - spec/integration/skip_publish_spec.rb
276
246
  - spec/spec_helper.rb
247
+ - spec/unit/emeril/category_spec.rb
248
+ - spec/unit/emeril/git_tagger_spec.rb
249
+ - spec/unit/emeril/metadata_chopper_spec.rb
250
+ - spec/unit/emeril/publisher_spec.rb
251
+ - spec/unit/emeril/releaser_spec.rb
277
252
  homepage: https://github.com/fnichol/emeril
278
253
  licenses:
279
254
  - MIT
255
+ metadata: {}
280
256
  post_install_message:
281
257
  rdoc_options: []
282
258
  require_paths:
283
259
  - lib
284
260
  required_ruby_version: !ruby/object:Gem::Requirement
285
- none: false
286
261
  requirements:
287
- - - ! '>='
262
+ - - '>='
288
263
  - !ruby/object:Gem::Version
289
264
  version: 1.9.2
290
265
  required_rubygems_version: !ruby/object:Gem::Requirement
291
- none: false
292
266
  requirements:
293
- - - ! '>='
267
+ - - '>='
294
268
  - !ruby/object:Gem::Version
295
269
  version: '0'
296
270
  requirements: []
297
271
  rubyforge_project:
298
- rubygems_version: 1.8.24
272
+ rubygems_version: 2.0.3
299
273
  signing_key:
300
- specification_version: 3
274
+ specification_version: 4
301
275
  summary: Release Chef cookbooks
302
276
  test_files:
303
- - spec/emeril/category_spec.rb
304
- - spec/emeril/git_tagger_spec.rb
305
- - spec/emeril/metadata_chopper_spec.rb
306
- - spec/emeril/publisher_spec.rb
307
- - spec/emeril/releaser_spec.rb
277
+ - spec/fixtures/client_key.pem
308
278
  - spec/fixtures/vcr_cassettes/known_cookbook.yml
279
+ - spec/fixtures/vcr_cassettes/new_release.yml
309
280
  - spec/fixtures/vcr_cassettes/nonexistant_cookbook.yml
281
+ - spec/integration/new_release_spec.rb
282
+ - spec/integration/skip_publish_spec.rb
310
283
  - spec/spec_helper.rb
284
+ - spec/unit/emeril/category_spec.rb
285
+ - spec/unit/emeril/git_tagger_spec.rb
286
+ - spec/unit/emeril/metadata_chopper_spec.rb
287
+ - spec/unit/emeril/publisher_spec.rb
288
+ - spec/unit/emeril/releaser_spec.rb