semmy 0.3.0 → 0.4.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/lib/semmy/changelog.rb +49 -27
- data/lib/semmy/configuration.rb +8 -2
- data/lib/semmy/files.rb +2 -1
- data/lib/semmy/tasks.rb +1 -1
- data/lib/semmy/tasks/changelog_sections.rb +8 -9
- data/lib/semmy/version.rb +1 -1
- data/lib/semmy/version_string.rb +23 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e37930e9fb640ca1d09d44ad75a455267528fdcb
|
4
|
+
data.tar.gz: d9b8a83c5b32ed68a8409b40107709676ec24aef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97963c7d57e85aa7f04d94f0fbb9c3def74e5a387163f390e0764b8cff55ed2762693d3bafded2206f2fa5a5666c58b0a9a73eae1b27f3492e62a0adeb09c0ce
|
7
|
+
data.tar.gz: bf42378f8c9817d88923613b9daab2c37fb96fae91ca1a262cc3f39fb9e3b2c58be477d6e758b04ddd4288e87ca26a761088431837422b015d467cca5fb17c5f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
### Version 0.4.0
|
4
|
+
|
5
|
+
2017-07-13
|
6
|
+
|
7
|
+
[Compare changes](https://github.com/tf/semmy/compare/0-3-stable...v0.4.0)
|
8
|
+
|
9
|
+
- Only keep sections for current minor version in changelog and link
|
10
|
+
to previous stable branch.
|
11
|
+
- Compare minor versions to previous stable branch.
|
12
|
+
|
3
13
|
### Version 0.3.0
|
4
14
|
|
5
15
|
2016-09-09
|
data/lib/semmy/changelog.rb
CHANGED
@@ -42,7 +42,7 @@ module Semmy
|
|
42
42
|
|
43
43
|
def version_heading
|
44
44
|
config.changelog_version_section_heading % {
|
45
|
-
version:
|
45
|
+
version: version
|
46
46
|
}
|
47
47
|
end
|
48
48
|
|
@@ -53,48 +53,63 @@ module Semmy
|
|
53
53
|
def compare_link_for_versions
|
54
54
|
Changelog.compare_link(config,
|
55
55
|
homepage: options[:homepage],
|
56
|
-
old_version_tag:
|
57
|
-
new_version_tag:
|
56
|
+
old_version_tag: old_ref,
|
57
|
+
new_version_tag: Changelog.version_tag(version))
|
58
58
|
end
|
59
59
|
|
60
|
-
def
|
61
|
-
|
60
|
+
def old_ref
|
61
|
+
if VersionString.patch_level?(version)
|
62
|
+
Changelog.version_tag(VersionString.previous_version(version))
|
63
|
+
else
|
64
|
+
VersionString.previous_stable_branch_name(version, config.stable_branch_name)
|
65
|
+
end
|
62
66
|
end
|
63
67
|
|
64
|
-
def
|
65
|
-
|
68
|
+
def version
|
69
|
+
options[:version]
|
66
70
|
end
|
67
71
|
end
|
68
72
|
|
69
|
-
|
73
|
+
UpdateForMinor = Struct.new(:config, :options) do
|
70
74
|
def call(contents)
|
71
|
-
|
72
|
-
|
73
|
-
|
75
|
+
replace_starting_at(version_line_matcher,
|
76
|
+
contents,
|
77
|
+
unreleased_section)
|
74
78
|
end
|
75
79
|
|
76
80
|
private
|
77
81
|
|
78
|
-
def unreleased_section
|
82
|
+
def unreleased_section
|
79
83
|
<<-END.unindent
|
80
84
|
#{config.changelog_unrelased_section_heading}
|
81
85
|
|
82
|
-
#{compare_link_for_master
|
86
|
+
#{compare_link_for_master}
|
83
87
|
|
84
88
|
#{config.changelog_unrelased_section_blank_slate}
|
89
|
+
|
90
|
+
#{link_to_changelog_on_previous_minor_stable_branch}
|
85
91
|
END
|
86
92
|
end
|
87
93
|
|
88
|
-
def compare_link_for_master
|
94
|
+
def compare_link_for_master
|
89
95
|
Changelog.compare_link(config,
|
90
96
|
homepage: options[:homepage],
|
91
|
-
old_version_tag:
|
97
|
+
old_version_tag: previous_stable_branch_name,
|
92
98
|
new_version_tag: 'master')
|
93
99
|
end
|
94
100
|
|
95
|
-
def
|
96
|
-
|
97
|
-
|
101
|
+
def link_to_changelog_on_previous_minor_stable_branch
|
102
|
+
config.changelog_previous_changes_link % {
|
103
|
+
branch: previous_stable_branch_name,
|
104
|
+
url: Changelog.file_url(config,
|
105
|
+
homepage: options[:homepage],
|
106
|
+
branch: previous_stable_branch_name)
|
107
|
+
}
|
108
|
+
end
|
109
|
+
|
110
|
+
def previous_stable_branch_name
|
111
|
+
VersionString.previous_stable_branch_name(options[:version],
|
112
|
+
config.stable_branch_name)
|
98
113
|
end
|
99
114
|
|
100
115
|
def version_line_matcher
|
@@ -103,13 +118,12 @@ module Semmy
|
|
103
118
|
})
|
104
119
|
end
|
105
120
|
|
106
|
-
def
|
107
|
-
text
|
108
|
-
|
109
|
-
fail(InsertPointNotFound,
|
110
|
-
"Insert point not found.")
|
111
|
-
end
|
121
|
+
def replace_starting_at(line_matcher, text, inserted_text)
|
122
|
+
unless text =~ line_matcher
|
123
|
+
fail(InsertPointNotFound, 'Insert point not found.')
|
112
124
|
end
|
125
|
+
|
126
|
+
[text.split(line_matcher).first, inserted_text].join
|
113
127
|
end
|
114
128
|
end
|
115
129
|
|
@@ -122,13 +136,21 @@ module Semmy
|
|
122
136
|
end
|
123
137
|
|
124
138
|
def compare_url(config, interpolations)
|
125
|
-
config.
|
126
|
-
|
127
|
-
|
139
|
+
config.compare_url % url_interpolations(config, interpolations)
|
140
|
+
end
|
141
|
+
|
142
|
+
def file_url(config, interpolations)
|
143
|
+
config.file_url % url_interpolations(config, interpolations)
|
144
|
+
.merge(path: config.changelog_path)
|
128
145
|
end
|
129
146
|
|
130
147
|
private
|
131
148
|
|
149
|
+
def url_interpolations(config, interpolations)
|
150
|
+
interpolations.merge(repository: repository_url(config,
|
151
|
+
interpolations[:homepage]))
|
152
|
+
end
|
153
|
+
|
132
154
|
def repository_url(config, homepage)
|
133
155
|
if config.github_repository
|
134
156
|
"https://github.com/#{config.github_repository}"
|
data/lib/semmy/configuration.rb
CHANGED
@@ -9,11 +9,14 @@ module Semmy
|
|
9
9
|
|
10
10
|
attr_accessor :github_repository
|
11
11
|
|
12
|
+
attr_accessor :compare_url
|
13
|
+
attr_accessor :file_url
|
14
|
+
|
12
15
|
attr_accessor :changelog_path
|
13
16
|
attr_accessor :changelog_version_section_heading
|
14
|
-
attr_accessor :changelog_compare_url
|
15
17
|
attr_accessor :changelog_unrelased_section_heading
|
16
18
|
attr_accessor :changelog_unrelased_section_blank_slate
|
19
|
+
attr_accessor :changelog_previous_changes_link
|
17
20
|
|
18
21
|
attr_accessor :source_files_with_docs_tags
|
19
22
|
attr_accessor :rewritten_since_doc_tag
|
@@ -26,11 +29,14 @@ module Semmy
|
|
26
29
|
@prepare_commit_message = 'Prepare %{version} release'
|
27
30
|
@bump_commit_message = 'Bump version to %{version}'
|
28
31
|
|
32
|
+
@compare_url = '%{repository}/compare/%{old_version_tag}...%{new_version_tag}'
|
33
|
+
@file_url = '%{repository}/blob/%{branch}/%{path}'
|
34
|
+
|
29
35
|
@changelog_path = 'CHANGELOG.md'
|
30
36
|
@changelog_version_section_heading = '### Version %{version}'
|
31
|
-
@changelog_compare_url = '%{repository}/compare/%{old_version_tag}...%{new_version_tag}'
|
32
37
|
@changelog_unrelased_section_heading = '### Changes on `master`'
|
33
38
|
@changelog_unrelased_section_blank_slate = 'None so far.'
|
39
|
+
@changelog_previous_changes_link = "See\n[%{branch} branch](%{url})\nfor previous changes."
|
34
40
|
|
35
41
|
@source_files_with_docs_tags = '{app,lib}/**/*.{js,rb,scss}'
|
36
42
|
@rewritten_since_doc_tag = 'edge'
|
data/lib/semmy/files.rb
CHANGED
data/lib/semmy/tasks.rb
CHANGED
@@ -4,28 +4,27 @@ module Semmy
|
|
4
4
|
def define
|
5
5
|
namespace 'changelog' do
|
6
6
|
task 'close_section' do
|
7
|
-
|
8
|
-
old_version = VersionString.previous_version(new_version)
|
7
|
+
version = Project.version
|
9
8
|
homepage = Gemspec.homepage
|
10
9
|
|
11
|
-
Shell.info("Inserting #{
|
10
|
+
Shell.info("Inserting #{version} section " \
|
12
11
|
"in #{config.changelog_path}.")
|
13
12
|
|
14
13
|
Files.rewrite(config.changelog_path,
|
15
14
|
Changelog::CloseSection.new(config,
|
16
|
-
|
17
|
-
old_version: old_version,
|
15
|
+
version: version,
|
18
16
|
homepage: homepage,
|
19
17
|
date: Date.today))
|
20
18
|
end
|
21
19
|
|
22
|
-
task '
|
23
|
-
Shell.info('
|
20
|
+
task 'update_for_minor' do
|
21
|
+
Shell.info('Updating changelog ' \
|
24
22
|
"in #{config.changelog_path}.")
|
25
23
|
|
26
24
|
Files.rewrite(config.changelog_path,
|
27
|
-
Changelog::
|
28
|
-
|
25
|
+
Changelog::UpdateForMinor.new(config,
|
26
|
+
version: Project.version,
|
27
|
+
homepage: Gemspec.homepage))
|
29
28
|
end
|
30
29
|
end
|
31
30
|
end
|
data/lib/semmy/version.rb
CHANGED
data/lib/semmy/version_string.rb
CHANGED
@@ -36,6 +36,10 @@ module Semmy
|
|
36
36
|
version.split('.')[0..1].join('.')
|
37
37
|
end
|
38
38
|
|
39
|
+
def patch_level?(version)
|
40
|
+
components(version)[:patch].to_i > 0
|
41
|
+
end
|
42
|
+
|
39
43
|
def components(version)
|
40
44
|
components = version.split('.')
|
41
45
|
|
@@ -59,5 +63,24 @@ module Semmy
|
|
59
63
|
|
60
64
|
components.join('.')
|
61
65
|
end
|
66
|
+
|
67
|
+
def previous_stable_branch_name(version, stable_branch_name_pattern)
|
68
|
+
stable_branch_name_pattern % previous_minor_version_components(version)
|
69
|
+
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
def previous_minor_version_components(version)
|
74
|
+
components = version.split('.').map(&:to_i)
|
75
|
+
|
76
|
+
if components[1].zero?
|
77
|
+
fail(NoPreviousMinor, "Cannot get previous minor version of #{version}.")
|
78
|
+
end
|
79
|
+
|
80
|
+
{
|
81
|
+
major: components[0],
|
82
|
+
minor: components[1] - 1
|
83
|
+
}
|
84
|
+
end
|
62
85
|
end
|
63
86
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: semmy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Fischbach
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|
@@ -173,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
173
|
version: '0'
|
174
174
|
requirements: []
|
175
175
|
rubyforge_project:
|
176
|
-
rubygems_version: 2.
|
176
|
+
rubygems_version: 2.6.8
|
177
177
|
signing_key:
|
178
178
|
specification_version: 4
|
179
179
|
summary: Rake tasks for a semantic versioning of gems
|