cookbook-release 1.6.0 → 1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4b745baf2a010f96d7bd64dea31e9275f5d070cf871d738f0f1e9a6271a7554
4
- data.tar.gz: 84360fb9192231adc36ef0e1031b7a4ca2cac799848a08efb6c270b7daa7943a
3
+ metadata.gz: 7538788e3e44d58e55dfe48772447e2a3bb907ae4b2d4cff09fcafc54c824335
4
+ data.tar.gz: 43b8f4c6cc08721f3afc8cbf1c49252480d23ce504d2ab3694c158af2a7f9600
5
5
  SHA512:
6
- metadata.gz: 9278ffaf0ed6073d59b733e1c79c39a80b199874ba3f94318801805ba1f70508b019ae359926272183f862e0702c4d8596f98a095f10624592c0c2eb28ffd972
7
- data.tar.gz: d08177747f17e1fb1c5a9527bd75b55be0bf9f9446e9e18529bf3d2121ed77427dbedd22d49d0b074f8d0e2d56a12dbff8d365ffcda4c5dbea7109fb43eab9ff
6
+ metadata.gz: ab64808c6d9ea7a0355e03e3caf20597786f61c29f3606ca57bbf2228c9aa4b674b02a7b133bb094b0c1cf493ad63083cbb42384ae180f88216b7e6d527a1614
7
+ data.tar.gz: 47de72ef77bdc293efffea2617868e40379ac24cd5b160d283730427ff71ba54560fd72f636f9b31b81e896f1b3d762170a9957c40923485e5ad00035cc061b2
@@ -0,0 +1,15 @@
1
+ name: Tests
2
+ on: [push, pull_request]
3
+ jobs:
4
+ test:
5
+ runs-on: ubuntu-latest
6
+ strategy:
7
+ matrix:
8
+ ruby-version: ['2.5', '2.7']
9
+ steps:
10
+ - uses: actions/checkout@v2
11
+ - uses: ruby/setup-ruby@v1
12
+ with:
13
+ ruby-version: ${{ matrix.ruby-version }}
14
+ bundler-cache: true
15
+ - run: bundle exec rake
@@ -0,0 +1,18 @@
1
+ name: Release
2
+ on:
3
+ push:
4
+ tags: [ '*' ]
5
+ jobs:
6
+ release:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v2
10
+ - uses: ruby/setup-ruby@v1
11
+ with:
12
+ ruby-version: 2.7
13
+ - run: |
14
+ install -D -m 600 <(echo -e "---\n:rubygems_api_key: ${RUBYGEMS_API_KEY}") $HOME/.gem/credentials
15
+ gem build *.gemspec
16
+ gem push *.gem
17
+ env:
18
+ RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
data/README.md CHANGED
@@ -63,6 +63,7 @@ Optional environment variables:
63
63
 
64
64
  ```
65
65
  export COOKBOOK_CATEGORY="Other" # defaults to Other
66
+ export SKIP_COOKOOK_UPLOAD=true #Just prepare release and push tag to git, but don't upload
66
67
  ```
67
68
 
68
69
  Note: this setup is intended to be used in a CI system such as jenkins or travis.
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -6,7 +6,7 @@ require 'English'
6
6
 
7
7
  Gem::Specification.new do |spec|
8
8
  spec.name = 'cookbook-release'
9
- spec.version = '1.6.0'
9
+ spec.version = '1.8.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'
@@ -8,6 +8,7 @@ module CookbookRelease
8
8
  class GitUtilities
9
9
 
10
10
  attr_accessor :no_prompt
11
+ attr_reader :sub_dir
11
12
 
12
13
  def initialize(options={})
13
14
  @tag_prefix = options[:tag_prefix] || ''
@@ -34,6 +34,7 @@ module CookbookRelease
34
34
  def initialize(git, opts={})
35
35
  @git = git
36
36
  @no_prompt = opts[:no_prompt]
37
+ @skip_upload = opts[:skip_upload]
37
38
  @git.no_prompt = @no_prompt
38
39
  @category = opts[:category] || 'Other'
39
40
  end
@@ -108,7 +109,7 @@ module CookbookRelease
108
109
  exit 1 unless agreed
109
110
  git.push_tag(new_version)
110
111
  supermarket = Supermarket.new
111
- supermarket.publish_ck(@category)
112
+ supermarket.publish_ck(@category, git.sub_dir) unless @skip_upload
112
113
  rescue
113
114
  puts HighLine.color("Release aborted, you have to reset to previous state manually", :red)
114
115
  puts ":use with care: #{git.reset_command(new_version)}"
@@ -8,7 +8,7 @@ require 'json'
8
8
  module CookbookRelease
9
9
  class Supermarket
10
10
 
11
- # This code is adapted from "knife cookbook share" and travis dpl provider
11
+ # This code is adapted from "knife cookbook share" and travis dpl provider
12
12
  # for supermarket.
13
13
 
14
14
  def initialize(opts={})
@@ -20,11 +20,11 @@ module CookbookRelease
20
20
 
21
21
  include ::Chef::Mixin::ShellOut
22
22
 
23
- def publish_ck(category)
24
- ck = ::Chef::Cookbook::CookbookVersionLoader.new('.')
23
+ def publish_ck(category, path = nil)
24
+ ck = ::Chef::Cookbook::CookbookVersionLoader.new(path || '.')
25
25
  ck.load!
26
26
  cookbook = ck.cookbook_version
27
- # we have to provide a rest option otherwise it will try to load a
27
+ # we have to provide a rest option otherwise it will try to load a
28
28
  # client.pem key
29
29
  ::Chef::CookbookUploader.new(cookbook, rest: 'fake_rest').validate_cookbooks
30
30
 
@@ -78,6 +78,7 @@ module CookbookRelease
78
78
  opts = {
79
79
  no_prompt: ENV['NO_PROMPT'],
80
80
  category: ENV['COOKBOOK_CATEGORY'],
81
+ skip_upload: ENV['SKIP_COOKOOK_UPLOAD']
81
82
  }
82
83
  git = GitUtilities.new
83
84
  Release.new(git, opts).release!
data/spec/release_spec.rb CHANGED
@@ -36,12 +36,13 @@ describe Release do
36
36
  :push_tag => true,
37
37
  )
38
38
  allow(git).to receive(:no_prompt=)
39
+ allow(git).to receive(:sub_dir).and_return(nil)
39
40
  release = Release.new(git, no_prompt: true)
40
41
 
41
42
  supermarket = double('supermarket')
42
43
  expect(CookbookRelease::Supermarket).to receive(:new).and_return(supermarket)
43
44
 
44
- expect(supermarket).to receive(:publish_ck).with('Other')
45
+ expect(supermarket).to receive(:publish_ck).with('Other', nil)
45
46
  release.release!
46
47
  end
47
48
  end
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: 1.6.0
4
+ version: 1.8.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: 2021-06-02 00:00:00.000000000 Z
11
+ date: 2023-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: semantic
@@ -162,12 +162,13 @@ executables: []
162
162
  extensions: []
163
163
  extra_rdoc_files: []
164
164
  files:
165
+ - ".github/workflows/ci.yml"
166
+ - ".github/workflows/release.yml"
165
167
  - ".gitignore"
166
- - ".travis.yml"
167
168
  - Gemfile
168
169
  - LICENSE.txt
169
170
  - README.md
170
- - Rakefile.rb
171
+ - Rakefile
171
172
  - cookbook-release.gemspec
172
173
  - lib/cookbook-release.rb
173
174
  - lib/cookbook-release/changelog.rb
@@ -200,8 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
200
201
  - !ruby/object:Gem::Version
201
202
  version: '0'
202
203
  requirements: []
203
- rubyforge_project:
204
- rubygems_version: 2.7.6.2
204
+ rubygems_version: 3.1.6
205
205
  signing_key:
206
206
  specification_version: 4
207
207
  summary: Provide primitives (and rake tasks) to release a cookbook
data/.travis.yml DELETED
@@ -1,12 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.4.0
4
- deploy:
5
- provider: rubygems
6
- api_key:
7
- secure: ylfB0GIaZxPfZ6/dSJIPujfSt3vxqVFg16lqTBq/2AAZ0qwKTZi9qeM/QZDLMX28vCXmTsYxHGepmyvv0PvJaKvy7E6YBzIKz1Y1vsEZFeAFrgIQq9cDvc4wIX2eFjI7N1ChyaRgi+YYK4BSVfKjYqGBfXk5Wyh7uqNEuWE7FzABV+RxXoHcNi+AhYkCX3NF80qNukXRtiB7XTQj6CP4Wd+Dm25iOUwx8/zNMce8Z8V3j2ysvR4Vtm/soDsr/+Z+27wIdP0VqwElV1FxtR9km8MIJhmzSsnzcvgqJpRmMvO6HLZFzwqnLBzCoPYJqm3K+uQSSfll5LbaNtixlBzIusgtGgm1UjQy1YDGkPexJd5K5CuC/LW78Y7Zrl3CeT34RDlICoztEjhJxFry3EvFxPT03lVQx5z5Fc55/u0hy3mBCiHbxHxAPJLMOtehfv35bzOS7Jv3+otBm/8jn9dXO2pJJdwxL9W2wrzljWkly4yemwceMvtMYf+xnf1zdTnMYoqkYGGl0KutbFL69w78w7BwTFQIhcJOO+g27C6V8vHtqU0U5JOgE/QNg3yWhzhQjgCpzQhmuO+Bcs3Jq2T/OcqTfwM6gufNe+Gq2TdEfeH5Y0WcRtTKJBVVQ4XWFtgONE1C1hNBFLyh7GNZDQQVYBT3c/MXeV5Q++rVJYOdSrw=
8
- gem: cookbook-release
9
- on:
10
- tags: true
11
- repo: criteo/cookbook-release
12
- skip_cleanup: 'true'
data/Rakefile.rb DELETED
@@ -1,7 +0,0 @@
1
- begin
2
- require 'rspec/core/rake_task'
3
- RSpec::Core::RakeTask.new(:spec)
4
- rescue LoadError
5
- end
6
-
7
- task :default => :spec