cookbook-release 0.4.4 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/cookbook-release.gemspec +1 -1
- data/lib/cookbook-release/commit.rb +33 -31
- data/lib/cookbook-release/git-utilities.rb +82 -80
- data/lib/cookbook-release/release.rb +86 -81
- data/lib/cookbook-release/supermarket.rb +50 -48
- data/spec/commit_spec.rb +4 -4
- data/spec/git_spec.rb +2 -2
- data/spec/release_spec.rb +1 -1
- data/spec/supermarket_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTM2ZWFjNDBlOWRhYjYyZDk1OTQ4OThjMzFhYzcyZmQzYWIwN2RlMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzU4MDFhMGFlZjZiNWI2YThmMDNkMjY3Y2QyZGIyMjRjMjFjNTQ4MQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YjA0MjE4Nzk5NjFiYjBlMThmMTJhMGVkM2U3MDNhM2ZiOTQ5ZjU2MmM3MDI5
|
10
|
+
NjNhMmQwYTgzMzUxZjc3ZmQ0ZmNjNjlhYjVkNTk1ZDg5MmRjNDMyNmNhZTg2
|
11
|
+
OTI5YWQ3NTQ2ZTBjMTVkMGY2N2IxODEwNjBmNDI1YzA4NTlhYTg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZjI4ODIzYTYzMGUzODZkZmFiZTk1ZDU2MDUyMzk0ZTM2YjMwM2RmY2Q1MzE1
|
14
|
+
MWQyYzdkMTMzZWFjOGMyNzYzZjdlNTU5NTQ1YTJjMGVlZGU1NmNlY2U5MmMw
|
15
|
+
MDMwZThiOWM0YzhkZGJiOTZiODJkYWFjNjYxZDhhMzFjZTkwZjQ=
|
data/cookbook-release.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'English'
|
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
8
|
spec.name = 'cookbook-release'
|
9
|
-
spec.version = '0.
|
9
|
+
spec.version = '1.0.0'
|
10
10
|
spec.authors = ['Grégoire Seux']
|
11
11
|
spec.email = 'g.seux@criteo.com'
|
12
12
|
spec.summary = 'Provide primitives (and rake tasks) to release a cookbook'
|
@@ -1,41 +1,43 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
module CookbookRelease
|
2
|
+
class Commit
|
3
|
+
extend Forwardable
|
4
|
+
def_delegators :@hash, :[]
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
6
|
+
def initialize(hash)
|
7
|
+
@hash = hash
|
8
|
+
end
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
def major?
|
11
|
+
[
|
12
|
+
/breaking/i,
|
13
|
+
/\[major\]/i
|
14
|
+
].any? do |r|
|
15
|
+
self[:subject] =~ r
|
16
|
+
end
|
15
17
|
end
|
16
|
-
end
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
def patch?
|
20
|
+
[
|
21
|
+
/\bfix\b/i,
|
22
|
+
/\bbugfix\b/i,
|
23
|
+
/\[patch\]/i
|
24
|
+
].any? do |r|
|
25
|
+
self[:subject] =~ r
|
26
|
+
end
|
25
27
|
end
|
26
|
-
end
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
29
|
+
def minor?
|
30
|
+
!(major? || patch?)
|
31
|
+
end
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
def color
|
34
|
+
case true
|
35
|
+
when major?
|
36
|
+
:red
|
37
|
+
else
|
38
|
+
:grey
|
39
|
+
end
|
38
40
|
end
|
39
|
-
end
|
40
41
|
|
42
|
+
end
|
41
43
|
end
|
@@ -3,100 +3,102 @@ require 'semantic/core_ext'
|
|
3
3
|
require 'mixlib/shellout'
|
4
4
|
require 'highline/import'
|
5
5
|
|
6
|
-
|
6
|
+
module CookbookRelease
|
7
|
+
class GitUtilities
|
7
8
|
|
8
|
-
|
9
|
+
attr_accessor :no_prompt
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
def initialize(options={})
|
12
|
+
@tag_prefix = options[:tag_prefix] || ''
|
13
|
+
@shellout_opts = {
|
14
|
+
cwd: options[:cwd]
|
15
|
+
}
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
def self.git?(dir)
|
19
|
+
!Mixlib::ShellOut.new(
|
20
|
+
'git status',
|
21
|
+
cwd: dir,
|
22
|
+
environment: { GIT_DIR: dir }
|
23
|
+
).run_command.error?
|
24
|
+
end
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
def reset_command(new_version)
|
27
|
+
remote = choose_remote
|
28
|
+
"git tag -d #{new_version} ; git push #{remote} :#{new_version}"
|
29
|
+
end
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
31
|
+
def clean_index?
|
32
|
+
clean_index = Mixlib::ShellOut.new("git diff --exit-code", @shellout_opts)
|
33
|
+
clean_index.run_command
|
34
|
+
clean_staged = Mixlib::ShellOut.new("git diff --exit-code --cached", @shellout_opts)
|
35
|
+
clean_staged.run_command
|
36
|
+
!clean_index.error? && !clean_staged.error?
|
37
|
+
end
|
37
38
|
|
38
|
-
|
39
|
-
|
40
|
-
|
39
|
+
def clean_index!
|
40
|
+
raise "All changes must be committed!" unless clean_index?
|
41
|
+
end
|
41
42
|
|
42
|
-
|
43
|
+
def compute_last_release
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
45
|
+
tag = Mixlib::ShellOut.new([
|
46
|
+
'git describe',
|
47
|
+
"--tags",
|
48
|
+
"--match \"#{@tag_prefix}[0-9]\.[0-9]*\.[0-9]*\""
|
49
|
+
].join(" "), @shellout_opts)
|
50
|
+
tag.run_command
|
51
|
+
last = tag.stdout.split('-').first
|
52
|
+
unless last
|
53
|
+
$stderr.puts "No last release found, defaulting to 0.1.0"
|
54
|
+
last = '0.1.0'
|
55
|
+
end
|
56
|
+
last.to_version
|
54
57
|
end
|
55
|
-
last.to_version
|
56
|
-
end
|
57
58
|
|
58
|
-
|
59
|
-
|
60
|
-
|
59
|
+
# This string is used to split one-line git commit summary
|
60
|
+
# it just needs to be unlikely in a commit message
|
61
|
+
MAGIC_SEP = '@+-+@+-+@+-+@'
|
61
62
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
63
|
+
def compute_changelog(since)
|
64
|
+
# TODO use whole commit message instead of title only
|
65
|
+
log_cmd = Mixlib::ShellOut.new("git log --pretty=\"format:%an <%ae>#{MAGIC_SEP}%s#{MAGIC_SEP}%h\" #{since}..HEAD", @shellout_opts)
|
66
|
+
log_cmd.run_command
|
67
|
+
log = log_cmd.stdout
|
68
|
+
log.split("\n").map do |entry|
|
69
|
+
author, subject, hash = entry.chomp.split(MAGIC_SEP)
|
70
|
+
Commit.new({
|
71
|
+
author: author,
|
72
|
+
subject: subject,
|
73
|
+
hash: hash
|
74
|
+
})
|
75
|
+
end.reject { |commit| commit[:subject] =~ /^Merge branch (.*) into/i }
|
76
|
+
end
|
76
77
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
78
|
+
def tag(version)
|
79
|
+
cmd = Mixlib::ShellOut.new("git tag #{@tag_prefix}#{version}", @shellout_opts)
|
80
|
+
cmd.run_command
|
81
|
+
cmd.error!
|
82
|
+
end
|
82
83
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
84
|
+
def choose_remote
|
85
|
+
cmd = Mixlib::ShellOut.new("git remote", @shellout_opts)
|
86
|
+
cmd.run_command
|
87
|
+
cmd.error!
|
88
|
+
remotes = cmd.stdout.split("\n")
|
89
|
+
if remotes.size == 1 || @no_prompt
|
90
|
+
puts "Choosing remote #{remotes.first}" if @no_prompt
|
91
|
+
remotes.first
|
92
|
+
else
|
93
|
+
choose(*remotes)
|
94
|
+
end
|
93
95
|
end
|
94
|
-
end
|
95
96
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
97
|
+
def push_tag(version)
|
98
|
+
remote = choose_remote
|
99
|
+
cmd = Mixlib::ShellOut.new("git push #{remote} #{@tag_prefix}#{version}", @shellout_opts)
|
100
|
+
cmd.run_command
|
101
|
+
cmd.error!
|
102
|
+
end
|
101
103
|
end
|
102
104
|
end
|
@@ -1,100 +1,105 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
1
|
+
module CookbookRelease
|
2
|
+
class Release
|
3
|
+
|
4
|
+
# file will be used to determine the git directory
|
5
|
+
def self.current_version(file)
|
6
|
+
dir = File.dirname(file)
|
7
|
+
version_file = File.join(dir, '.cookbook_version')
|
8
|
+
|
9
|
+
return File.read(version_file) if !GitUtilities.git?(dir) && File.exist?(version_file)
|
10
|
+
|
11
|
+
r = Release.new(GitUtilities.new(cwd: dir))
|
12
|
+
begin
|
13
|
+
r.new_version.first
|
14
|
+
rescue ExistingRelease
|
15
|
+
r.last_release
|
16
|
+
end.tap { |v| File.write(version_file, v) }
|
17
|
+
end
|
17
18
|
|
18
|
-
|
19
|
-
|
19
|
+
class ExistingRelease < StandardError
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
+
attr_reader :git
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
def initialize(git, opts={})
|
25
|
+
@git = git
|
26
|
+
@no_prompt = opts[:no_prompt]
|
27
|
+
@git.no_prompt = @no_prompt
|
28
|
+
@category = opts[:category] || 'Other'
|
29
|
+
end
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
def last_release
|
32
|
+
@last_release ||= git.compute_last_release
|
33
|
+
end
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
35
|
+
def git_changelog
|
36
|
+
@git_changelog ||= git.compute_changelog(last_release)
|
37
|
+
end
|
37
38
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
39
|
+
# return the new version and the reasons
|
40
|
+
def new_version
|
41
|
+
%w(major minor patch).each do |level|
|
42
|
+
changes = git_changelog.select(&"#{level}?".to_sym)
|
43
|
+
return [ last_release.send("#{level}!"), changes ] if changes.size > 0
|
44
|
+
end
|
45
|
+
raise ExistingRelease, "No commit since last release (#{last_release})"
|
43
46
|
end
|
44
|
-
raise ExistingRelease, "No commit since last release (#{last_release})"
|
45
|
-
end
|
46
47
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
48
|
+
def user_defined_version
|
49
|
+
puts "Which kind of upgrade ?"
|
50
|
+
new_release_level = choose(*%w(major minor patch))
|
51
|
+
last_release.send("#{new_release_level}!")
|
52
|
+
end
|
52
53
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
54
|
+
def display_suggested_version(new_version, reasons)
|
55
|
+
puts "Suggested version: " + new_version.to_s
|
56
|
+
puts "Commits that suggest this change:"
|
57
|
+
reasons.each do |commit|
|
58
|
+
puts "* #{commit[:hash]} #{commit[:subject]} (#{commit[:author]})"
|
59
|
+
end
|
58
60
|
end
|
59
|
-
end
|
60
61
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
62
|
+
def display_changelog(new_version)
|
63
|
+
puts "Changelog for #{new_version}:"
|
64
|
+
git_changelog.each do |commit|
|
65
|
+
puts "* #{commit[:hash]} #{HighLine.color(commit[:subject], commit.color)} (#{commit[:author]})"
|
66
|
+
end
|
65
67
|
end
|
66
|
-
end
|
67
68
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
69
|
+
def prepare_release
|
70
|
+
git.clean_index!
|
71
|
+
new_version , reasons = self.new_version
|
72
|
+
puts "Last release was: " + last_release.to_s
|
73
|
+
display_suggested_version(new_version, reasons)
|
74
|
+
puts ""
|
74
75
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
76
|
+
agreed = @no_prompt || agree("Do you agree with that version?") { |q| q.default = "yes" }
|
77
|
+
new_version = user_defined_version unless agreed
|
78
|
+
puts "New release will be #{new_version}"
|
79
|
+
puts ""
|
79
80
|
|
80
|
-
|
81
|
-
|
81
|
+
new_version
|
82
|
+
end
|
82
83
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
84
|
+
def release!
|
85
|
+
new_version = prepare_release
|
86
|
+
begin
|
87
|
+
git.tag(new_version)
|
88
|
+
display_changelog(new_version)
|
89
|
+
puts ""
|
90
|
+
agreed = @no_prompt || agree("Do you agree with this changelog?") { |q| q.default = "yes" }
|
91
|
+
exit 1 unless agreed
|
92
|
+
git.push_tag(new_version)
|
93
|
+
supermarket = Supermarket.new
|
94
|
+
supermarket.publish_ck(@category)
|
95
|
+
rescue
|
96
|
+
puts HighLine.color("Release aborted, you have to reset to previous state manually", :red)
|
97
|
+
puts ":use with care: #{git.reset_command(new_version)}"
|
98
|
+
raise
|
99
|
+
end
|
98
100
|
end
|
99
101
|
end
|
100
102
|
end
|
103
|
+
|
104
|
+
# For simplicity of use
|
105
|
+
Release = CookbookRelease::Release
|
@@ -5,64 +5,66 @@ require 'chef/cookbook_site_streaming_uploader'
|
|
5
5
|
require 'chef/mixin/shell_out'
|
6
6
|
require 'json'
|
7
7
|
|
8
|
-
|
8
|
+
module CookbookRelease
|
9
|
+
class Supermarket
|
9
10
|
|
10
|
-
|
11
|
-
|
11
|
+
# This code is adapted from "knife cookbook share" and travis dpl provider
|
12
|
+
# for supermarket.
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
def initialize(opts={})
|
15
|
+
@url = opts[:url] || ENV['SUPERMARKET_URL'] || (raise "Require a supermarket url")
|
16
|
+
@user_id = opts[:user_id] || ENV['SUPERMARKET_USERID'] || (raise "Require a user id")
|
17
|
+
@client_key = opts[:client_key_file] || ENV['SUPERMARKET_CLIENTKEYFILE'] || (raise "Require a client key file")
|
18
|
+
Chef::Config[:ssl_verify_mode] = :verify_none if ENV['SUPERMARKET_NO_SSL_VERIFY']
|
19
|
+
end
|
19
20
|
|
20
|
-
|
21
|
+
include ::Chef::Mixin::ShellOut
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
def publish_ck(category)
|
24
|
+
ck = ::Chef::Cookbook::CookbookVersionLoader.new('.')
|
25
|
+
ck.load!
|
26
|
+
cookbook = ck.cookbook_version
|
27
|
+
# we have to provide a rest option otherwise it will try to load a
|
28
|
+
# client.pem key
|
29
|
+
::Chef::CookbookUploader.new(cookbook, rest: 'fake_rest').validate_cookbooks
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
tmp_cookbook_dir = Chef::CookbookSiteStreamingUploader.create_build_dir(cookbook)
|
32
|
+
begin
|
33
|
+
shell_out!("tar -czf #{cookbook.name}.tgz #{cookbook.name}", :cwd => tmp_cookbook_dir)
|
34
|
+
rescue StandardError => e
|
35
|
+
raise "Impossible to make a tarball out of the cookbook, #{e}"
|
36
|
+
end
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
38
|
+
begin
|
39
|
+
upload("#{tmp_cookbook_dir}/#{cookbook.name}.tgz", category)
|
40
|
+
puts "Uploaded to supermarket #{@url}"
|
41
|
+
FileUtils.rm_rf tmp_cookbook_dir
|
42
|
+
rescue StandardError => e
|
43
|
+
$stderr.puts "Impossible to upload the cookbook to supermarket: #{e}"
|
44
|
+
raise
|
45
|
+
end
|
44
46
|
end
|
45
|
-
end
|
46
47
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
48
|
+
def upload(filename, category)
|
49
|
+
http_resp = ::Chef::CookbookSiteStreamingUploader.post(
|
50
|
+
@url,
|
51
|
+
@user_id,
|
52
|
+
@client_key,
|
53
|
+
{
|
54
|
+
tarball: File.open(filename),
|
55
|
+
cookbook: { category: category }.to_json,
|
56
|
+
})
|
57
|
+
res = ::Chef::JSONCompat.from_json(http_resp.body)
|
58
|
+
if http_resp.code.to_i != 201
|
59
|
+
if res['error_messages']
|
60
|
+
if res['error_messages'][0] =~ /Version already exists/
|
61
|
+
raise "The same version of this cookbook already exists on the Opscode Cookbook Site."
|
62
|
+
else
|
63
|
+
raise "#{res['error_messages'][0]}"
|
64
|
+
end
|
61
65
|
else
|
62
|
-
raise "#{
|
66
|
+
raise "Unknown error while sharing cookbook\nServer response: #{http_resp.body}"
|
63
67
|
end
|
64
|
-
else
|
65
|
-
raise "Unknown error while sharing cookbook\nServer response: #{http_resp.body}"
|
66
68
|
end
|
67
69
|
end
|
68
70
|
end
|
data/spec/commit_spec.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require_relative 'spec_helper'
|
2
2
|
|
3
|
-
describe Commit do
|
3
|
+
describe CookbookRelease::Commit do
|
4
4
|
|
5
|
-
let(:breaking_change) { Commit.new(subject: '[Breaking] Removed thing') }
|
6
|
-
let(:fix_change) { Commit.new(subject: 'This is a fix') }
|
7
|
-
let(:minor_change) { Commit.new(subject: 'This introduces a feature') }
|
5
|
+
let(:breaking_change) { CookbookRelease::Commit.new(subject: '[Breaking] Removed thing') }
|
6
|
+
let(:fix_change) { CookbookRelease::Commit.new(subject: 'This is a fix') }
|
7
|
+
let(:minor_change) { CookbookRelease::Commit.new(subject: 'This introduces a feature') }
|
8
8
|
|
9
9
|
describe '.(major|patch|minor)?' do
|
10
10
|
it 'detects major changes' do
|
data/spec/git_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require_relative 'spec_helper'
|
|
3
3
|
require 'mixlib/shellout'
|
4
4
|
require 'fileutils'
|
5
5
|
|
6
|
-
describe GitUtilities do
|
6
|
+
describe CookbookRelease::GitUtilities do
|
7
7
|
before(:each) do
|
8
8
|
@tmp = Dir.mktmpdir('cookbook-release')
|
9
9
|
@old_dir = Dir.pwd
|
@@ -25,7 +25,7 @@ describe GitUtilities do
|
|
25
25
|
FileUtils.rm_rf(@tmp)
|
26
26
|
end
|
27
27
|
|
28
|
-
let(:git) { GitUtilities.new }
|
28
|
+
let(:git) { CookbookRelease::GitUtilities.new }
|
29
29
|
|
30
30
|
describe '.clean_index(?|!)' do
|
31
31
|
it 'detects clean index' do
|
data/spec/release_spec.rb
CHANGED
@@ -38,7 +38,7 @@ describe Release do
|
|
38
38
|
release = Release.new(git, no_prompt: true)
|
39
39
|
|
40
40
|
supermarket = double('supermarket')
|
41
|
-
expect(Supermarket).to receive(:new).and_return(supermarket)
|
41
|
+
expect(CookbookRelease::Supermarket).to receive(:new).and_return(supermarket)
|
42
42
|
|
43
43
|
expect(supermarket).to receive(:publish_ck).with('Other')
|
44
44
|
release.release!
|
data/spec/supermarket_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative 'spec_helper'
|
2
2
|
|
3
|
-
describe Supermarket do
|
3
|
+
describe CookbookRelease::Supermarket do
|
4
4
|
let (:opts) do
|
5
5
|
{ user_id: 'a_name', client_key_file: 'a_file',
|
6
6
|
url: 'http://a_url' }
|
@@ -34,7 +34,7 @@ version '2.0.0'
|
|
34
34
|
describe '.pusblish_ck' do
|
35
35
|
it 'publish to supermarket' do
|
36
36
|
init_cookbook
|
37
|
-
s = Supermarket.new(opts)
|
37
|
+
s = CookbookRelease::Supermarket.new(opts)
|
38
38
|
response = double('http response',
|
39
39
|
body: "{}",
|
40
40
|
code: "201"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cookbook-release
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grégoire Seux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: semantic
|