gem_toys 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 16feed698462675a843e0f84ec189d550db52292eee4c37d10f9b8352dcbed50
4
- data.tar.gz: 5f523a901ef6e5256979056261f6b1c7051585e27e9bf9f37550ab7545215f3d
3
+ metadata.gz: 4618c51d0060981f796f40c91b6e746f6cc9860adcdbae6b291e9740b4f617df
4
+ data.tar.gz: 42efd278a9c5821c85eb776dae8f1dde46ac957d1c98842c716f5f769de313f0
5
5
  SHA512:
6
- metadata.gz: 93aac7e65dbf9093754f3dc82f0770299feba396fcba5c89d70ffebc35a3208567891171830a99a1a9d962d8d2ae258b6a4adff242eae02babcb4f0578561b17
7
- data.tar.gz: 04c08eb4ac3c2e552fe24413833fd4f3338dd0186aedd835ce2ed1cb3e2d17e0b391c90ed6ad0620f465a255558f93c5ac6c0b6a8f6a8971992794338c0272cf
6
+ metadata.gz: 1a8a580cb0ec036fcd80c6c27ef1ecf289c9d87e5696d044b585bcf2ffe05c6ef22c96fee1f2836aa0f9e9f875545b2b3cb501b5d1d3b75fd4bca4edf78b5ac9
7
+ data.tar.gz: 0ae8062f7f01ed27afdf635dbc06a25495a6d6039470a469e6ea5213eecaa66301afce1a9561bc87bd3401822f98e5c6b2443a249926ca8d0eecf0bcf18f70cf
data/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
+ ## 0.6.1 (2021-02-10)
6
+
5
7
  ## 0.6.0 (2021-02-10)
6
8
 
7
9
  * Support Ruby 3.
data/README.md CHANGED
@@ -35,7 +35,8 @@ gem install gem_toys
35
35
  ```ruby
36
36
  # .toys.rb
37
37
  require 'gem_toys'
38
- expand GemToys::Template
38
+ expand GemToys::Template,
39
+ unreleased_title: '## Unreleased' ## default is `## master (unreleased)`
39
40
 
40
41
  # `gem` namespace created, aliases are optional, but handful
41
42
  alias_tool :g, :gem
@@ -31,8 +31,12 @@ module GemToys
31
31
  version_file_content.match(/VERSION = '(.+)'/)[1]
32
32
  end
33
33
 
34
+ memoize def changelog_file_name
35
+ 'CHANGELOG.md'
36
+ end
37
+
34
38
  memoize def changelog_file_path
35
- File.join context_directory, 'CHANGELOG.md'
39
+ File.join context_directory, changelog_file_name
36
40
  end
37
41
 
38
42
  memoize def gem_file_name
@@ -118,12 +118,24 @@ module GemToys
118
118
 
119
119
  def new_changelog_content
120
120
  unreleased_title = @template.unreleased_title
121
+
122
+ unreleased_title_index = @changelog_lines.index("#{unreleased_title}\n")
123
+
124
+ abort_without_unreleased_title unless unreleased_title_index
125
+
121
126
  @changelog_lines.insert(
122
- @changelog_lines.index("#{unreleased_title}\n") + 2,
127
+ unreleased_title_index + 2,
123
128
  '#' * unreleased_title.scan(/^#+/).first.size + " #{@new_version} (#{@today})\n\n"
124
129
  ).join
125
130
  end
126
131
 
132
+ def abort_without_unreleased_title
133
+ abort <<~TEXT
134
+ `#{@template.unreleased_title}` not found in the `#{changelog_file_name}` as the title for unreleased changes.
135
+ Please, use `:unreleased_title` option if you have non-default one.
136
+ TEXT
137
+ end
138
+
127
139
  def commit_changes
128
140
  puts 'Committing changes...'
129
141
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GemToys
4
- VERSION = '0.6.0'
4
+ VERSION = '0.6.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem_toys
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Popov