community_cookbook_releaser 0.1.1 → 0.1.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/ccr +15 -7
  3. metadata +5 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bf6292b9e30de3eefcae81c354eaeb6a3d59d1fd
4
- data.tar.gz: f73b56b25c8bf4491eb0389272bfc349a8852690
3
+ metadata.gz: aeaf69832312ef54d8d6798cb0f0b1edd553b65a
4
+ data.tar.gz: cecfe431cdf5bc6b88fbf3afcc4ceb0e008a55c1
5
5
  SHA512:
6
- metadata.gz: b2784f5293352006091fc0a04e9fdfea67b85b10d1eb6452da2a8dbd239632753e4f99b752b952ae07bc4ca2e6c5373c8eb5ccff916914d3b8c68626b29ea5d7
7
- data.tar.gz: 1b43d468f1317e8587cbe603d995e6ce5f346abd3c19c232caef7152681734ba7cba13d77a92042e4fe56c6567f7fe27b5d6adc24d6795448fd0913749a6fc43
6
+ metadata.gz: 1e0a35dccd4625e9be1142d046adaa880f192800f45a28160b86bb952dc1348535bce99a836909e8ea883c28428845b0bf633b28b8b9d6d75965eba81d459ced
7
+ data.tar.gz: fc5153c09204716706cebda667e35c5ed6e86609a1d09136a5edc01f7bdbe3e37bf0ad8bc8b8a9169e919167e134d968d05abfe552d4df9bb55af0e3a955b933
data/bin/ccr CHANGED
@@ -49,6 +49,10 @@ def bump_version(old_version)
49
49
  bumped.join('.')
50
50
  end
51
51
 
52
+ def current_metadata_version
53
+ File.open('metadata.rb').read.match(/version\s*'(\d*.\d*.\d*)'/)[1]
54
+ end
55
+
52
56
  def prompted_new_version
53
57
  current_version = File.open('metadata.rb').read.match(/version\s*'(\d*.\d*.\d*)'/)[1]
54
58
  next_version = bump_version(current_version)
@@ -60,19 +64,23 @@ def prompted_new_version
60
64
  next_version
61
65
  end
62
66
 
63
- def update_metadata_version
67
+ # update the version line in a way that we maintain formatting and don't accidently
68
+ # match a depends line further down in the cookbook with the same string
69
+ def update_metadata_version(old_version, new_version)
64
70
  contents = File.read('metadata.rb')
65
- new_contents = contents.gsub(/version\s*'(\d*.\d*.\d*)'/, "version '#{@new_version}'") # forget formatting!
71
+ old_version_line = /^version.*/.match(contents)[0]
72
+ new_version_line = old_version_line.gsub(old_version, new_version)
73
+ new_contents = contents.gsub(old_version_line, new_version_line)
66
74
  File.open('metadata.rb', 'w') { |file| file.write(new_contents) }
67
75
  end
68
76
 
69
- def write_updated_changelog
77
+ def write_updated_changelog(new_version)
70
78
  temp_content = ''
71
79
  # read in the old content to a tempstring and insert our new content where appropriate
72
80
  File.open('CHANGELOG.md', 'r').each_line do |line|
73
81
  if line =~ /^This file/
74
82
  temp_content << "#{line}\n"
75
- temp_content << "## #{@new_version} (#{Time.now.strftime('%Y-%m-%d')})\n"
83
+ temp_content << "## #{new_version} (#{Time.now.strftime('%Y-%m-%d')})\n\n"
76
84
  changes_since_last_tag.each do |change|
77
85
  temp_content << "- #{change}\n"
78
86
  end
@@ -109,8 +117,8 @@ fail_if_cb_files
109
117
  # load the YAML config
110
118
  @config = parse_config
111
119
 
112
- @new_version = prompted_new_version
113
- update_metadata_version
114
- write_updated_changelog
120
+ new_cookbook_version = prompted_new_version
121
+ update_metadata_version(current_metadata_version, new_cookbook_version)
122
+ write_updated_changelog(new_cookbook_version)
115
123
 
116
124
  puts "\nVersion bumped & changelog written out with each commit as an item. Now edit, commit, and release!"
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.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-10 00:00:00.000000000 Z
11
+ date: 2016-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit
@@ -24,8 +24,7 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- description: A systems integration framework, built to bring the benefits of configuration
28
- management to your entire infrastructure.
27
+ description: A simple script in gem form for releasing chef managed community cookbooks.
29
28
  email: tsmith@chef.io
30
29
  executables:
31
30
  - ccr
@@ -57,9 +56,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
56
  version: '0'
58
57
  requirements: []
59
58
  rubyforge_project:
60
- rubygems_version: 2.6.6
59
+ rubygems_version: 2.6.8
61
60
  signing_key:
62
61
  specification_version: 4
63
- summary: A systems integration framework, built to bring the benefits of configuration
64
- management to your entire infrastructure.
62
+ summary: A simple script in gem form for releasing chef managed community cookbooks.
65
63
  test_files: []