community_cookbook_releaser 0.1.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +15 -0
  3. data/bin/ccr +12 -9
  4. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9025a43c703f5aafc6e3db1bd00397901eea55ed
4
- data.tar.gz: 52fe09630e52650febdd6be140a472256c0d5251
3
+ metadata.gz: fbc1dc8fc24f108e9313d6661dd578b7d8c2e27c
4
+ data.tar.gz: 66bec6a22daf9bb161ae7cc543eaeb161d27796e
5
5
  SHA512:
6
- metadata.gz: 4ccc1b421e05997f46531a03ebb2ef6b8d7dcd7754b4b8d59ab76263b7c414946f40978234115d78ecb167e489f655c93d326e8d750e0198b8c7b71346d6e389
7
- data.tar.gz: 2ec5b5736823e2ba1c3ede2f81d0eac183f0c4a0826b4f36a17f9dcfe7e527bb410bbc0f07a99be0d0f42bfd931efc69bf0bda16307c66a0de257c63312f675f
6
+ metadata.gz: 3d975764baa561b80148ebd4e7c6002ae421c6690d13ac704e9f952ec94c2206d59fa870248c47e286d46d186bbb29124ad0040949ab000b1e10c9f8ef1d646b
7
+ data.tar.gz: f851913282c10bea43114fdc121446afee3ce0fa7171781b185af8c908afb026b3bc0d5f3411acff1649a0b2e940200798103e9b1ca1d7505162fd589d3f011d
data/README.md CHANGED
@@ -1,2 +1,17 @@
1
1
  # community_cookbook_releaser
2
2
  A simple script to aid in version bumps and changelog generation for Chef managed community cookbooks
3
+
4
+ ## Usage
5
+
6
+ Create a CHANGELOG.md in the current cookbook directory that conforms to the Chef Cookbook community standard. It should contain:
7
+
8
+ > This file is used to list changes made in each version of the X cookbook
9
+
10
+ Create a `~/.ccr_config.yml` with the following content:
11
+
12
+ ```yaml
13
+ token: GITHUB_PERSONAL_ACCESS_TOKEN
14
+ github_organization: YOUR_GITHUB_USER_OR_ORG
15
+ ```
16
+
17
+ Replace the values as appropriate. The access token needs to have `repo:public_repo` if it is public/open source or `repo:all` if it is private. The github organization will default to `chef-cookbooks` if it is not specified.
data/bin/ccr CHANGED
@@ -33,14 +33,20 @@ end
33
33
  def parse_config
34
34
  file_or_error('~/.ccr_config.yml')
35
35
 
36
- config = YAML.load_file(File.expand_path('~/.ccr_config.yml'))
36
+ yconfig = YAML.load_file(File.expand_path('~/.ccr_config.yml'))
37
+ yconfig['github_organization'] ||= 'chef-cookbooks'
37
38
 
38
- unless config['token']
39
+ unless yconfig['token']
39
40
  puts_red("~/.ccr_config.yml does not contain a 'token' value. Cannot continue without a Github token!")
40
41
  exit 1
41
42
  end
42
43
 
43
- config
44
+ yconfig
45
+ end
46
+
47
+ def config
48
+ @config ||= parse_config
49
+ @config
44
50
  end
45
51
 
46
52
  def bump_version(old_version)
@@ -94,11 +100,11 @@ def write_updated_changelog(new_version)
94
100
  end
95
101
 
96
102
  def changes_since_last_tag
97
- client = Octokit::Client.new(access_token: @config['token'])
103
+ client = Octokit::Client.new(access_token: config['token'])
98
104
  Octokit.auto_paginate = true
99
105
  cb_name = File.split(Dir.getwd)[-1]
100
- last_tag_sha = client.tags("chef-cookbooks/#{cb_name}")[0][:commit][:sha]
101
- commit_data = client.compare("chef-cookbooks/#{cb_name}", last_tag_sha, 'master')
106
+ last_tag_sha = client.tags("#{config['github_organization']}/#{cb_name}")[0][:commit][:sha]
107
+ commit_data = client.compare("#{config['github_organization']}/#{cb_name}", last_tag_sha, 'master')
102
108
  commit_messages = []
103
109
  commit_data['commits'].each do |commit|
104
110
  msg = commit['commit']['message'].split("\n")[0] # get just the commit title not the entire thing
@@ -114,9 +120,6 @@ puts "\e[3mA simple script to aid in version bumps and changelog generation for
114
120
  # make sure the world of cookbooks looks like we're assuming
115
121
  fail_if_cb_files
116
122
 
117
- # load the YAML config
118
- @config = parse_config
119
-
120
123
  new_cookbook_version = prompted_new_version
121
124
  update_metadata_version(current_metadata_version, new_cookbook_version)
122
125
  write_updated_changelog(new_cookbook_version)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: community_cookbook_releaser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-30 00:00:00.000000000 Z
11
+ date: 2017-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit
@@ -36,7 +36,7 @@ files:
36
36
  - LICENSE
37
37
  - README.md
38
38
  - bin/ccr
39
- homepage: http://www.chef.io
39
+ homepage: https://www.chef.io
40
40
  licenses:
41
41
  - Apache-2.0
42
42
  metadata: {}
@@ -56,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  version: '0'
57
57
  requirements: []
58
58
  rubyforge_project:
59
- rubygems_version: 2.6.11
59
+ rubygems_version: 2.6.13
60
60
  signing_key:
61
61
  specification_version: 4
62
62
  summary: A simple script in gem form for releasing chef managed community cookbooks.