cookbook-release 0.4.1 → 0.4.2

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
- YTI4ODkyNzExM2I1YWMyZGJiYjliMWY0YTMwYmRlMWIzNDMyMTRjZA==
4
+ YTQzZWMzNGFjMmFiOWViYzY3NjBmNDFkNDNlMmNmODNmNGExOGI2NQ==
5
5
  data.tar.gz: !binary |-
6
- NjQyZmEzMDQxNWNmYzc3NmNhODQyODk0N2ZiNjFlZDljMTQ4YmZmYQ==
6
+ MTI4ZjA0M2Y1Yzc1YjgwZjJlN2VmMWEyNmRjMDNmZTViMDQxOTUzNA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NDNiYTdjNzBlNTllZTliYzAxNDViZDc2Y2Q0NTMxYWMxMDQzMWE1OWE2NDgz
10
- YWI5ZjUxNTc0ZGQ0MTJlY2FkZjk2OWE1MGM2NzA1OTBjMWMxZjMwMTI4MWEx
11
- NDdlZjg2OGUzZDEyMGUzNTA5NDZiMmUxZWFkYWJkNDE4YWEwNjg=
9
+ OTMwOGEyYzZmYjczYjkwODhkODdlYTI5OWVjOGZkZTRlMDMzZDc4M2UwNTQw
10
+ NGNhOGQwYTQwZjAyMjMwYjM0YWVkMmE4NmJiMTJkMjM1YjA0OGY3YTAyMzc4
11
+ YmQ0ODBmY2E0NjY3YzVjM2UyYzJlMTMwMDhjN2MzZDQ3ZmY2YzI=
12
12
  data.tar.gz: !binary |-
13
- NTM4MzgzMDdiMTA5OWMzMzNjZDViN2RiNmNkNzUyYzI1MGVmY2EzYjk1MTlj
14
- OWZmNzlhOGRlMTZmNzU0MWFmM2ExOWE0YmRkYmVlZWE4MDljODEyNGUwNTk4
15
- Zjk5NTQyYWE0MjU4OTA2MTliOTIxMTFmYzZlODY2YWZhNzQyNWY=
13
+ MzgzMGZmNDdlN2U0ZmQ4ZjA5MTQ5OGNiM2EzZDM1NTFlMjliNjUxMzZiNDll
14
+ YWI0NGRkOTg4MzJlYTdiYmRhOWRkNDFiYTBhM2Q4M2EwYTVjYTRmMTJjNWNl
15
+ NjAxYjkxZDI0YTE4OWU5NGIxYTY2NDA3NmUzZTMyMDI4NGJiNGQ=
data/README.md CHANGED
@@ -16,7 +16,8 @@ Include cookbook-release into your `Gemfile`.
16
16
  Require cookbook-release into the `metadata.rb` file and replace the version by the helper:
17
17
 
18
18
  ```
19
- version Release.current_version
19
+ require 'cookbook-release'
20
+ version Release.current_version(__FILE__)
20
21
  ```
21
22
 
22
23
  Include the rake tasks in your Rakefile:
@@ -33,6 +34,7 @@ export SUPERMARKET_CLIENTKEYFILE=/tmp/my_key.pem
33
34
  export SUPERMARKET_USERID=my_username
34
35
  export SUPERMARKET_URL="http://supermarket.chef.io/api/v1/cookbooks"
35
36
  export NO_PROMPT=""
37
+ export SUPERMARKET_NO_SSL_VERIFY=1
36
38
  rake release!
37
39
  ```
38
40
 
@@ -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.1'
9
+ spec.version = '0.4.2'
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'
@@ -14,6 +14,10 @@ class GitUtilities
14
14
  }
15
15
  end
16
16
 
17
+ def self.git?(dir)
18
+ !Mixlib::ShellOut.new('git status', cwd: dir).run_command.error?
19
+ end
20
+
17
21
  def reset_command(new_version)
18
22
  "git reset --hard HEAD^ && git tag -d #{new_version}"
19
23
  end
@@ -2,12 +2,17 @@ class Release
2
2
 
3
3
  # file will be used to determine the git directory
4
4
  def self.current_version(file)
5
- r = Release.new(GitUtilities.new(cwd: File.dirname(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))
6
11
  begin
7
12
  r.new_version.first
8
13
  rescue ExistingRelease
9
14
  r.last_release
10
- end
15
+ end.tap { |v| File.write(version_file, v) }
11
16
  end
12
17
 
13
18
  class ExistingRelease < StandardError
@@ -14,6 +14,7 @@ class Supermarket
14
14
  @url = opts[:url] || ENV['SUPERMARKET_URL'] || (raise "Require a supermarket url")
15
15
  @user_id = opts[:user_id] || ENV['SUPERMARKET_USERID'] || (raise "Require a user id")
16
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']
17
18
  end
18
19
 
19
20
  include ::Chef::Mixin::ShellOut
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.1
4
+ version: 0.4.2
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-03-15 00:00:00.000000000 Z
11
+ date: 2016-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: semantic