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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDU3YzE4NWQ4YTMzZTVhY2IzYTUwOGNjNzcyMTkxZDMzZTk2MTM3MA==
4
+ ZTM2ZWFjNDBlOWRhYjYyZDk1OTQ4OThjMzFhYzcyZmQzYWIwN2RlMg==
5
5
  data.tar.gz: !binary |-
6
- ODU3NTFiNGZhZWYyNWJlNzJhMzg2YWFjZDk2MzU1NzM1ODdlOGEyMg==
6
+ MzU4MDFhMGFlZjZiNWI2YThmMDNkMjY3Y2QyZGIyMjRjMjFjNTQ4MQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YjZlYWQ5MjQ4MWU3ODkwZDZlZTNmZTJlMTQxZDA2ZjkyMjA2NGNkNWZlZTdi
10
- ODRhMzczOTA1YjUyYjRkYTVlNjcyMDdhNTEzMWNhMmExODA0ZmZhZTZjOTI1
11
- NjU2NGVkZjYzMWEyNzg3Yjc5NzhmNjk4YmE5ZWM3MGU5NWUzNDA=
9
+ YjA0MjE4Nzk5NjFiYjBlMThmMTJhMGVkM2U3MDNhM2ZiOTQ5ZjU2MmM3MDI5
10
+ NjNhMmQwYTgzMzUxZjc3ZmQ0ZmNjNjlhYjVkNTk1ZDg5MmRjNDMyNmNhZTg2
11
+ OTI5YWQ3NTQ2ZTBjMTVkMGY2N2IxODEwNjBmNDI1YzA4NTlhYTg=
12
12
  data.tar.gz: !binary |-
13
- MmUzYTBiODU3NjlmMTBhZDZlMTkzMmU0MjZmN2VkMDZkNGE4N2FhYTU0ZWFl
14
- NWEyMGFjZjg1Mzk2YWY4Y2I5NjFkYzNjZDUwY2Q4NTdmNTU0ZTAyZmY5NTEw
15
- YWE0OTA1NDAzNzFjYzJmZTg0Nzg4NzZkYWM0YWFlYjdhN2U3YWE=
13
+ ZjI4ODIzYTYzMGUzODZkZmFiZTk1ZDU2MDUyMzk0ZTM2YjMwM2RmY2Q1MzE1
14
+ MWQyYzdkMTMzZWFjOGMyNzYzZjdlNTU5NTQ1YTJjMGVlZGU1NmNlY2U5MmMw
15
+ MDMwZThiOWM0YzhkZGJiOTZiODJkYWFjNjYxZDhhMzFjZTkwZjQ=
@@ -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.4.4'
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
- class Commit
2
- extend Forwardable
3
- def_delegators :@hash, :[]
1
+ module CookbookRelease
2
+ class Commit
3
+ extend Forwardable
4
+ def_delegators :@hash, :[]
4
5
 
5
- def initialize(hash)
6
- @hash = hash
7
- end
6
+ def initialize(hash)
7
+ @hash = hash
8
+ end
8
9
 
9
- def major?
10
- [
11
- /breaking/i,
12
- /\[major\]/i
13
- ].any? do |r|
14
- self[:subject] =~ r
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
- def patch?
19
- [
20
- /\bfix\b/i,
21
- /\bbugfix\b/i,
22
- /\[patch\]/i
23
- ].any? do |r|
24
- self[:subject] =~ r
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
- def minor?
29
- !(major? || patch?)
30
- end
29
+ def minor?
30
+ !(major? || patch?)
31
+ end
31
32
 
32
- def color
33
- case true
34
- when major?
35
- :red
36
- else
37
- :grey
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
- class GitUtilities
6
+ module CookbookRelease
7
+ class GitUtilities
7
8
 
8
- attr_accessor :no_prompt
9
+ attr_accessor :no_prompt
9
10
 
10
- def initialize(options={})
11
- @tag_prefix = options[:tag_prefix] || ''
12
- @shellout_opts = {
13
- cwd: options[:cwd]
14
- }
15
- end
11
+ def initialize(options={})
12
+ @tag_prefix = options[:tag_prefix] || ''
13
+ @shellout_opts = {
14
+ cwd: options[:cwd]
15
+ }
16
+ end
16
17
 
17
- def self.git?(dir)
18
- !Mixlib::ShellOut.new(
19
- 'git status',
20
- cwd: dir,
21
- environment: { GIT_DIR: dir }
22
- ).run_command.error?
23
- end
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
- def reset_command(new_version)
26
- remote = choose_remote
27
- "git tag -d #{new_version} ; git push #{remote} :#{new_version}"
28
- end
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
- def clean_index?
31
- clean_index = Mixlib::ShellOut.new("git diff --exit-code", @shellout_opts)
32
- clean_index.run_command
33
- clean_staged = Mixlib::ShellOut.new("git diff --exit-code --cached", @shellout_opts)
34
- clean_staged.run_command
35
- !clean_index.error? && !clean_staged.error?
36
- end
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
- def clean_index!
39
- raise "All changes must be committed!" unless clean_index?
40
- end
39
+ def clean_index!
40
+ raise "All changes must be committed!" unless clean_index?
41
+ end
41
42
 
42
- def compute_last_release
43
+ def compute_last_release
43
44
 
44
- tag = Mixlib::ShellOut.new([
45
- 'git describe',
46
- "--tags",
47
- "--match \"#{@tag_prefix}[0-9]\.[0-9]*\.[0-9]*\""
48
- ].join(" "), @shellout_opts)
49
- tag.run_command
50
- last = tag.stdout.split('-').first
51
- unless last
52
- $stderr.puts "No last release found, defaulting to 0.1.0"
53
- last = '0.1.0'
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
- # This string is used to split one-line git commit summary
59
- # it just needs to be unlikely in a commit message
60
- MAGIC_SEP = '@+-+@+-+@+-+@'
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
- def compute_changelog(since)
63
- # TODO use whole commit message instead of title only
64
- log_cmd = Mixlib::ShellOut.new("git log --pretty=\"format:%an <%ae>#{MAGIC_SEP}%s#{MAGIC_SEP}%h\" #{since}..HEAD", @shellout_opts)
65
- log_cmd.run_command
66
- log = log_cmd.stdout
67
- log.split("\n").map do |entry|
68
- author, subject, hash = entry.chomp.split(MAGIC_SEP)
69
- Commit.new({
70
- author: author,
71
- subject: subject,
72
- hash: hash
73
- })
74
- end.reject { |commit| commit[:subject] =~ /^Merge branch (.*) into/i }
75
- end
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
- def tag(version)
78
- cmd = Mixlib::ShellOut.new("git tag #{@tag_prefix}#{version}", @shellout_opts)
79
- cmd.run_command
80
- cmd.error!
81
- end
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
- def choose_remote
84
- cmd = Mixlib::ShellOut.new("git remote", @shellout_opts)
85
- cmd.run_command
86
- cmd.error!
87
- remotes = cmd.stdout.split("\n")
88
- if remotes.size == 1 || @no_prompt
89
- puts "Choosing remote #{remotes.first}" if @no_prompt
90
- remotes.first
91
- else
92
- choose(*remotes)
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
- def push_tag(version)
97
- remote = choose_remote
98
- cmd = Mixlib::ShellOut.new("git push #{remote} #{@tag_prefix}#{version}", @shellout_opts)
99
- cmd.run_command
100
- cmd.error!
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
- class Release
2
-
3
- # file will be used to determine the git directory
4
- def self.current_version(file)
5
- dir = File.dirname(file)
6
- version_file = File.join(dir, '.cookbook_version')
7
-
8
- return File.read(version_file) if !GitUtilities.git?(dir) && File.exist?(version_file)
9
-
10
- r = Release.new(GitUtilities.new(cwd: dir))
11
- begin
12
- r.new_version.first
13
- rescue ExistingRelease
14
- r.last_release
15
- end.tap { |v| File.write(version_file, v) }
16
- end
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
- class ExistingRelease < StandardError
19
- end
19
+ class ExistingRelease < StandardError
20
+ end
20
21
 
21
- attr_reader :git
22
+ attr_reader :git
22
23
 
23
- def initialize(git, opts={})
24
- @git = git
25
- @no_prompt = opts[:no_prompt]
26
- @git.no_prompt = @no_prompt
27
- @category = opts[:category] || 'Other'
28
- end
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
- def last_release
31
- @last_release ||= git.compute_last_release
32
- end
31
+ def last_release
32
+ @last_release ||= git.compute_last_release
33
+ end
33
34
 
34
- def git_changelog
35
- @git_changelog ||= git.compute_changelog(last_release)
36
- end
35
+ def git_changelog
36
+ @git_changelog ||= git.compute_changelog(last_release)
37
+ end
37
38
 
38
- # return the new version and the reasons
39
- def new_version
40
- %w(major minor patch).each do |level|
41
- changes = git_changelog.select(&"#{level}?".to_sym)
42
- return [ last_release.send("#{level}!"), changes ] if changes.size > 0
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
- def user_defined_version
48
- puts "Which kind of upgrade ?"
49
- new_release_level = choose(*%w(major minor patch))
50
- last_release.send("#{new_release_level}!")
51
- end
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
- def display_suggested_version(new_version, reasons)
54
- puts "Suggested version: " + new_version.to_s
55
- puts "Commits that suggest this change:"
56
- reasons.each do |commit|
57
- puts "* #{commit[:hash]} #{commit[:subject]} (#{commit[:author]})"
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
- def display_changelog(new_version)
62
- puts "Changelog for #{new_version}:"
63
- git_changelog.each do |commit|
64
- puts "* #{commit[:hash]} #{HighLine.color(commit[:subject], commit.color)} (#{commit[:author]})"
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
- def prepare_release
69
- git.clean_index!
70
- new_version , reasons = self.new_version
71
- puts "Last release was: " + last_release.to_s
72
- display_suggested_version(new_version, reasons)
73
- puts ""
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
- agreed = @no_prompt || agree("Do you agree with that version?") { |q| q.default = "yes" }
76
- new_version = user_defined_version unless agreed
77
- puts "New release will be #{new_version}"
78
- puts ""
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
- new_version
81
- end
81
+ new_version
82
+ end
82
83
 
83
- def release!
84
- new_version = prepare_release
85
- begin
86
- git.tag(new_version)
87
- display_changelog(new_version)
88
- puts ""
89
- agreed = @no_prompt || agree("Do you agree with this changelog?") { |q| q.default = "yes" }
90
- exit 1 unless agreed
91
- git.push_tag(new_version)
92
- supermarket = Supermarket.new
93
- supermarket.publish_ck(@category)
94
- rescue
95
- puts HighLine.color("Release aborted, you have to reset to previous state manually", :red)
96
- puts ":use with care: #{git.reset_command(new_version)}"
97
- raise
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
- class Supermarket
8
+ module CookbookRelease
9
+ class Supermarket
9
10
 
10
- # This code is adapted from "knife cookbook share" and travis dpl provider
11
- # for supermarket.
11
+ # This code is adapted from "knife cookbook share" and travis dpl provider
12
+ # for supermarket.
12
13
 
13
- def initialize(opts={})
14
- @url = opts[:url] || ENV['SUPERMARKET_URL'] || (raise "Require a supermarket url")
15
- @user_id = opts[:user_id] || ENV['SUPERMARKET_USERID'] || (raise "Require a user id")
16
- @client_key = opts[:client_key_file] || ENV['SUPERMARKET_CLIENTKEYFILE'] || (raise "Require a client key file")
17
- Chef::Config[:ssl_verify_mode] = :verify_none if ENV['SUPERMARKET_NO_SSL_VERIFY']
18
- end
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
- include ::Chef::Mixin::ShellOut
21
+ include ::Chef::Mixin::ShellOut
21
22
 
22
- def publish_ck(category)
23
- ck = ::Chef::Cookbook::CookbookVersionLoader.new('.')
24
- ck.load!
25
- cookbook = ck.cookbook_version
26
- # we have to provide a rest option otherwise it will try to load a
27
- # client.pem key
28
- ::Chef::CookbookUploader.new(cookbook, rest: 'fake_rest').validate_cookbooks
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
- tmp_cookbook_dir = Chef::CookbookSiteStreamingUploader.create_build_dir(cookbook)
31
- begin
32
- shell_out!("tar -czf #{cookbook.name}.tgz #{cookbook.name}", :cwd => tmp_cookbook_dir)
33
- rescue StandardError => e
34
- raise "Impossible to make a tarball out of the cookbook, #{e}"
35
- end
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
- begin
38
- upload("#{tmp_cookbook_dir}/#{cookbook.name}.tgz", category)
39
- puts "Uploaded to supermarket #{@url}"
40
- FileUtils.rm_rf tmp_cookbook_dir
41
- rescue StandardError => e
42
- $stderr.puts "Impossible to upload the cookbook to supermarket: #{e}"
43
- raise
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
- def upload(filename, category)
48
- http_resp = ::Chef::CookbookSiteStreamingUploader.post(
49
- @url,
50
- @user_id,
51
- @client_key,
52
- {
53
- tarball: File.open(filename),
54
- cookbook: { category: category }.to_json,
55
- })
56
- res = ::Chef::JSONCompat.from_json(http_resp.body)
57
- if http_resp.code.to_i != 201
58
- if res['error_messages']
59
- if res['error_messages'][0] =~ /Version already exists/
60
- raise "The same version of this cookbook already exists on the Opscode Cookbook Site."
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 "#{res['error_messages'][0]}"
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!
@@ -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.4
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-10 00:00:00.000000000 Z
11
+ date: 2016-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: semantic