easy_changelog 0.3.2 → 1.0.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 +4 -4
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +1 -1
- data/lib/easy_changelog/configuration.rb +12 -2
- data/lib/easy_changelog/task_options_parser.rb +1 -0
- data/lib/easy_changelog/tasks/changelog.rake +13 -0
- data/lib/easy_changelog/version.rb +1 -1
- data/lib/easy_changelog.rb +12 -9
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e400f241e2089e8ee8b3141460ee11584b671f8d418e7580c8c61ac435725b53
|
|
4
|
+
data.tar.gz: c93aa0f0c4037b3191cf28b74bdf0aeb5aff8ff827a0465acfc7976b37820a05
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b0d4b08b17021a74a960ff3c75584c66668308944a6c7cf019599a69bdc06fc8493f9d2fefa7f21373ada19036f594fb038b2a004c8219589ed85a109bf5a6f5
|
|
7
|
+
data.tar.gz: 27600e93f884f1f48d8088b0d0421305c027ab78272cc26fe1b57cebf65d7e9a7aba4e66d7508fe0aef112803245a7acd788819e14f30dcb90a05c7cfaef3862
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
## master (unreleased)
|
|
4
4
|
|
|
5
|
+
## 1.0.0 (2025-01-22)
|
|
6
|
+
### Breaking Changes
|
|
7
|
+
|
|
8
|
+
* [#e2b27fa](https://github.com/ivan05almeida/easy_changelog/commit/e2b27fa): Add loose type mapping. ([@ivan05almeida][])
|
|
9
|
+
|
|
10
|
+
## 0.4.0 (2025-01-22)
|
|
11
|
+
### New features
|
|
12
|
+
|
|
13
|
+
* [#51e9888](https://github.com/ivan05almeida/easy_changelog/commit/51e9888): Allow user option. ([@ivan05almeida][])
|
|
14
|
+
|
|
5
15
|
## 0.3.2 (2025-01-22)
|
|
6
16
|
### Bug fixes
|
|
7
17
|
|
data/Gemfile.lock
CHANGED
|
@@ -22,7 +22,7 @@ class EasyChangelog
|
|
|
22
22
|
@filename_max_length = 50
|
|
23
23
|
@type_mapping = {
|
|
24
24
|
breaking: { title: 'Breaking Changes', level: :major },
|
|
25
|
-
|
|
25
|
+
feature: { title: 'New features', level: :minor },
|
|
26
26
|
fix: { title: 'Bug fixes', level: :patch }
|
|
27
27
|
}
|
|
28
28
|
@include_empty_task_id = false
|
|
@@ -66,11 +66,15 @@ class EasyChangelog
|
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
def type_mapping=(value)
|
|
69
|
-
raise ArgumentError, 'type_mapping must be a Hash' unless value.is_a?(Hash)
|
|
69
|
+
raise ArgumentError, 'type_mapping must be a Hash or :loose' unless value.is_a?(Hash) || value == :loose
|
|
70
70
|
|
|
71
71
|
@type_mapping = value
|
|
72
72
|
end
|
|
73
73
|
|
|
74
|
+
def loose?
|
|
75
|
+
@type_mapping == :loose
|
|
76
|
+
end
|
|
77
|
+
|
|
74
78
|
def user_signature=(value)
|
|
75
79
|
raise ArgumentError, 'user_signature must be a Regexp' unless value.is_a?(Regexp) || value.nil?
|
|
76
80
|
|
|
@@ -78,14 +82,20 @@ class EasyChangelog
|
|
|
78
82
|
end
|
|
79
83
|
|
|
80
84
|
def changelog_types
|
|
85
|
+
return [] if @type_mapping == :loose
|
|
86
|
+
|
|
81
87
|
@type_mapping.keys
|
|
82
88
|
end
|
|
83
89
|
|
|
84
90
|
def sections
|
|
91
|
+
return [''] if @type_mapping == :loose
|
|
92
|
+
|
|
85
93
|
@type_mapping.values.map { |v| v[:title] }
|
|
86
94
|
end
|
|
87
95
|
|
|
88
96
|
def section_for(type)
|
|
97
|
+
return '' if @type_mapping == :loose
|
|
98
|
+
|
|
89
99
|
@type_mapping[type][:title]
|
|
90
100
|
end
|
|
91
101
|
|
|
@@ -11,6 +11,7 @@ class EasyChangelog
|
|
|
11
11
|
|
|
12
12
|
opts.banner = "Usage: rake changelog:#{type} [options]"
|
|
13
13
|
|
|
14
|
+
opts.on('-u', '--user=ARG', 'Git Username') { |arg| options[:user] = arg }
|
|
14
15
|
opts.on('-b', '--body=ARG', 'Changelog Body Entry') { |arg| options[:body] = arg }
|
|
15
16
|
opts.on('-r', '--ref-id=ARG', 'Ref ID') { |arg| options[:ref_id] = arg }
|
|
16
17
|
opts.on('-R', '--ref-type=ARG', 'Ref type (issues|pull|commit)') { |arg| options[:ref_type] = arg }
|
|
@@ -23,6 +23,19 @@ namespace :changelog do
|
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
+
desc 'Create a Changelog entry (default)'
|
|
27
|
+
task :new do
|
|
28
|
+
environment
|
|
29
|
+
options = EasyChangelog::TaskOptionsParser.parse(:new, ARGV)
|
|
30
|
+
options[:type] = :new
|
|
31
|
+
|
|
32
|
+
entry = EasyChangelog::Entry.new(**options)
|
|
33
|
+
path = entry.write
|
|
34
|
+
cmd = "git add #{path}"
|
|
35
|
+
sh cmd
|
|
36
|
+
puts "Entry '#{path}' created and added to git index"
|
|
37
|
+
end
|
|
38
|
+
|
|
26
39
|
desc 'Merge entries and delete them'
|
|
27
40
|
task :merge do
|
|
28
41
|
environment
|
data/lib/easy_changelog.rb
CHANGED
|
@@ -81,7 +81,13 @@ class EasyChangelog
|
|
|
81
81
|
def unreleased_content
|
|
82
82
|
entry_map = parse_entries(@entries)
|
|
83
83
|
merged_map = merge_entries(entry_map)
|
|
84
|
-
merged_map.flat_map
|
|
84
|
+
merged_map.flat_map do |header, things|
|
|
85
|
+
if header.empty?
|
|
86
|
+
[*things, '']
|
|
87
|
+
else
|
|
88
|
+
["### #{header}\n", *things, '']
|
|
89
|
+
end
|
|
90
|
+
end.join("\n")
|
|
85
91
|
end
|
|
86
92
|
|
|
87
93
|
def merge_content
|
|
@@ -142,14 +148,11 @@ class EasyChangelog
|
|
|
142
148
|
|
|
143
149
|
# @return [Hash<type, Array<String>]]
|
|
144
150
|
def parse_release(unreleased)
|
|
145
|
-
unreleased
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
.to_h do |header, *entries|
|
|
151
|
-
[HEADER.match(header)[1], entries]
|
|
152
|
-
end
|
|
151
|
+
entries = unreleased.lines.map(&:chomp).reject(&:empty?)
|
|
152
|
+
|
|
153
|
+
return { '' => entries } if EasyChangelog.configuration.loose?
|
|
154
|
+
|
|
155
|
+
entries.slice_before(HEADER).to_h { |header, *header_entries| [HEADER.match(header)[1], header_entries] }
|
|
153
156
|
end
|
|
154
157
|
|
|
155
158
|
def parse_entries(path_content_map)
|