releasinator 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +3 -3
- data/README.md +4 -1
- data/lib/downstream.rb +4 -0
- data/lib/git_util.rb +16 -0
- data/lib/printer.rb +1 -1
- data/lib/releasinator/version.rb +1 -1
- data/lib/tasks/releasinator.rake +8 -2
- data/lib/validator.rb +21 -9
- data/lib/validator_changelog.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 514f2117423fc276d733afa1e3ada8409d294c3f
|
4
|
+
data.tar.gz: 518e7c826e1ecb8588fddaed5c21de54709d96d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 110da6dcf745e7d20133ae31ba19c6ed6f984bc6447325bb0e00ac8a1331d25220a46f40875950df6967e70b63f98c0b13dad82806f7e91ecd5ea3b156e25392
|
7
|
+
data.tar.gz: 025592dcb88660d3270e0b9aa4dafd97d1b54b7acef72a7e3fa06ac47659b2d4eda94a08a940c01c6935019b69d8183fc20820d81ce2752a324770d99e3bc9f2
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
Releasinator release notes
|
2
2
|
==========================
|
3
3
|
|
4
|
+
0.6.0
|
5
|
+
-----
|
6
|
+
* Validate all bulleted items in `CHANGELOG.md` end in punctuation.
|
7
|
+
* Add new task, `validate:eof_newlines` which validates text files matching a few known extensions end in a newline character. The validation adds the newline character if not present.
|
8
|
+
* Validate files are in git with the proper name, case sensitive. Previously, the releasinator would allow files detected by the filesystem. Since Macs are case in-sensitive, incorrect cases for expected filenames were allowed.
|
9
|
+
|
4
10
|
0.5.0
|
5
11
|
-----
|
6
12
|
* The releasinator is now Open Source!
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
releasinator (0.
|
4
|
+
releasinator (0.6.0)
|
5
5
|
colorize (~> 0.7)
|
6
6
|
configatron (~> 4.5)
|
7
7
|
json (~> 1.8)
|
@@ -13,7 +13,7 @@ GEM
|
|
13
13
|
remote: https://rubygems.org/
|
14
14
|
specs:
|
15
15
|
addressable (2.4.0)
|
16
|
-
colorize (0.
|
16
|
+
colorize (0.8.0)
|
17
17
|
configatron (4.5.0)
|
18
18
|
faraday (0.9.2)
|
19
19
|
multipart-post (>= 1.2, < 3)
|
@@ -45,4 +45,4 @@ DEPENDENCIES
|
|
45
45
|
test-unit (~> 3.1)
|
46
46
|
|
47
47
|
BUNDLED WITH
|
48
|
-
1.
|
48
|
+
1.12.5
|
data/README.md
CHANGED
@@ -34,6 +34,7 @@ release
|
|
34
34
|
|
35
35
|
--> validate:all
|
36
36
|
--> validate:paths
|
37
|
+
--> validate:eof_newlines
|
37
38
|
--> validate:git_version
|
38
39
|
--> validate:gitignore
|
39
40
|
--> validate:submodules
|
@@ -122,9 +123,11 @@ The releasinator enforces certain conventions. If a filename closely matches th
|
|
122
123
|
|
123
124
|
## Behind the Scenes
|
124
125
|
|
125
|
-
#### Validations
|
126
|
+
#### Validations (in no particular order)
|
126
127
|
|
128
|
+
1. ✓ Validate releasinator version.
|
127
129
|
1. ✓ Validate git version.
|
130
|
+
1. ✓ Validate text files end in newline characters.
|
128
131
|
1. ✓ Validate git's cleanliness (no untracked, unstaged, or uncommitted files).
|
129
132
|
1. ✓ Validate current git branch is up to date with the latest version on server.
|
130
133
|
1. ✓ Validate current git branch is `master` (if no git flow), or `develop` or `release/<Release number>` if using git flow.
|
data/lib/downstream.rb
CHANGED
@@ -154,10 +154,14 @@ module Releasinator
|
|
154
154
|
if downstream_repo.options.has_key? :new_branch_name
|
155
155
|
new_branch_name = get_new_branch_name(downstream_repo.options[:new_branch_name], @current_release.version)
|
156
156
|
CommandProcessor.command("git push -u origin #{new_branch_name}")
|
157
|
+
# TODO - check that the branch exists
|
158
|
+
CommandProcessor.command("sleep 5")
|
157
159
|
Publisher.new(@releasinator_config).publish_pull_request(downstream_repo.url, @current_release, @releasinator_config[:product_name], downstream_repo.branch, new_branch_name)
|
158
160
|
else
|
159
161
|
GitUtil.push_branch("master")
|
160
162
|
GitUtil.push_tag(@current_release.version)
|
163
|
+
# TODO - check that the tag exists
|
164
|
+
CommandProcessor.command("sleep 5")
|
161
165
|
Publisher.new(@releasinator_config).publish(downstream_repo.url, @current_release) unless ! downstream_repo.release_to_github
|
162
166
|
end
|
163
167
|
end
|
data/lib/git_util.rb
CHANGED
@@ -14,6 +14,22 @@ module Releasinator
|
|
14
14
|
CommandProcessor.command("git fetch origin --prune --recurse-submodules -j9")
|
15
15
|
end
|
16
16
|
|
17
|
+
def self.exist?(path)
|
18
|
+
current_branch = get_current_branch()
|
19
|
+
# grep is case sensitive, which is what we want. Piped to cat so the grep error code is ignored.
|
20
|
+
"" != CommandProcessor.command("git ls-tree --name-only -r #{current_branch} | grep ^#{path}$ | cat")
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.all_files()
|
24
|
+
current_branch = get_current_branch()
|
25
|
+
CommandProcessor.command("git ls-tree --name-only -r #{current_branch}")
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.move(old_path, new_path)
|
29
|
+
puts "Renaming #{old_path} to #{new_path}".yellow
|
30
|
+
CommandProcessor.command("git mv -f #{old_path} #{new_path}")
|
31
|
+
end
|
32
|
+
|
17
33
|
def self.push_branch(branch_name)
|
18
34
|
checkout(branch_name)
|
19
35
|
fetch()
|
data/lib/printer.rb
CHANGED
data/lib/releasinator/version.rb
CHANGED
data/lib/tasks/releasinator.rake
CHANGED
@@ -34,7 +34,12 @@ namespace :validate do
|
|
34
34
|
@downstream.freeze
|
35
35
|
end
|
36
36
|
|
37
|
-
desc "validate
|
37
|
+
desc "validate important text files end in a newline character"
|
38
|
+
task :eof_newlines => :config do
|
39
|
+
@validator.validate_eof_newlines
|
40
|
+
end
|
41
|
+
|
42
|
+
desc "validate releasinator is up to date"
|
38
43
|
task :releasinator_version => :config do
|
39
44
|
@validator.validate_releasinator_version
|
40
45
|
end
|
@@ -50,7 +55,7 @@ namespace :validate do
|
|
50
55
|
@validator.validate_git_version
|
51
56
|
end
|
52
57
|
|
53
|
-
desc "validate
|
58
|
+
desc "validate git reports no untracked, unstaged, or uncommitted changes"
|
54
59
|
task :git => :config do
|
55
60
|
@validator.validate_clean_git
|
56
61
|
end
|
@@ -124,6 +129,7 @@ namespace :validate do
|
|
124
129
|
task :all =>
|
125
130
|
[
|
126
131
|
:paths,
|
132
|
+
:eof_newlines,
|
127
133
|
:git_version,
|
128
134
|
:gitignore,
|
129
135
|
:submodules,
|
data/lib/validator.rb
CHANGED
@@ -31,6 +31,19 @@ module Releasinator
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
def validate_eof_newlines
|
35
|
+
all_git_files = GitUtil.all_files.split
|
36
|
+
text_file_extensions = [".md", ".txt", ".gitignore", "Gemfile", "Gemfile.lock", "LICENSE", "Rakefile", ".rb"]
|
37
|
+
|
38
|
+
important_git_text_files = all_git_files.select{
|
39
|
+
|filename| text_file_extensions.any? { |extension| filename.end_with?(extension) }
|
40
|
+
}
|
41
|
+
|
42
|
+
important_git_text_files.each do |filename|
|
43
|
+
CommandProcessor.command("tail -c1 #{filename} | read -r _ || echo >> #{filename}")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
34
47
|
def validate_in_path(executable)
|
35
48
|
if "" == CommandProcessor.command("which #{executable} | cat")
|
36
49
|
Printer.fail(executable.bold + " not found on path.")
|
@@ -54,9 +67,9 @@ module Releasinator
|
|
54
67
|
end
|
55
68
|
end
|
56
69
|
|
57
|
-
def validate_changelog(
|
70
|
+
def validate_changelog(search_ignore_path=nil)
|
58
71
|
validate_base_dir
|
59
|
-
validate_exist(@releasinator_config.base_dir, "CHANGELOG.md",
|
72
|
+
validate_exist(@releasinator_config.base_dir, "CHANGELOG.md", search_ignore_path, ["release_notes.md"])
|
60
73
|
|
61
74
|
changelog_contents = get_changelog_contents
|
62
75
|
ValidatorChangelog.new(@releasinator_config).validate_changelog_contents(changelog_contents)
|
@@ -179,29 +192,29 @@ module Releasinator
|
|
179
192
|
abort()
|
180
193
|
end
|
181
194
|
|
182
|
-
def validate_exist(dir, expected_file_name,
|
195
|
+
def validate_exist(dir, expected_file_name, search_ignore_path=nil, alternate_names=[])
|
183
196
|
if !File.exist? dir
|
184
197
|
Printer.fail("Directory #{dir} not found.")
|
185
198
|
abort()
|
186
199
|
end
|
187
200
|
|
188
201
|
Dir.chdir(dir) do
|
189
|
-
if !
|
202
|
+
if !GitUtil.exist?(expected_file_name)
|
190
203
|
puts "#{dir}/#{expected_file_name} not found. Searching for similar files.".yellow
|
191
204
|
|
192
205
|
# search for files that are somewhat similar to the file being searched, ignoring case
|
193
206
|
filename_prefix = expected_file_name[0,5]
|
194
|
-
similar_files = CommandProcessor.command("find . -type f -not -path \"./#{
|
207
|
+
similar_files = CommandProcessor.command("find . -type f -not -path \"./#{search_ignore_path}/*\" -iname '#{filename_prefix}*'| sed 's|./||'").strip
|
195
208
|
num_similar_files = similar_files.split.count
|
196
209
|
puts similar_files
|
197
210
|
if num_similar_files == 1
|
198
|
-
Printer.check_proceed("Found a single similar file: #{similar_files}. Do you want to rename this to the expected #{expected_file_name}?","Please
|
211
|
+
Printer.check_proceed("Found a single similar file: #{similar_files}. Do you want to rename this to the expected #{expected_file_name}?","Please commit #{dir}/#{expected_file_name}")
|
199
212
|
rename_file(similar_files, expected_file_name)
|
200
213
|
elsif num_similar_files > 1
|
201
214
|
Printer.fail("Found more than 1 file similar to #{expected_file_name}. Please rename one, and optionally remove the others to not confuse users.")
|
202
215
|
abort()
|
203
216
|
elsif !rename_alternate_name(expected_file_name, alternate_names)
|
204
|
-
Printer.fail("Please
|
217
|
+
Printer.fail("Please commit #{dir}/#{expected_file_name}.")
|
205
218
|
abort()
|
206
219
|
end
|
207
220
|
end
|
@@ -352,8 +365,7 @@ module Releasinator
|
|
352
365
|
def rename_file(old_name, new_name)
|
353
366
|
is_git_already_clean = GitUtil.is_clean_git?
|
354
367
|
|
355
|
-
|
356
|
-
CommandProcessor.command("mv #{old_name} #{new_name}")
|
368
|
+
GitUtil.move(old_name, new_name)
|
357
369
|
# fix any references to file in readme
|
358
370
|
replace_string("README.md", "(#{old_name})", "(#{new_name})")
|
359
371
|
if is_git_already_clean
|
data/lib/validator_changelog.rb
CHANGED
@@ -94,8 +94,24 @@ module Releasinator
|
|
94
94
|
|
95
95
|
validate_semver(changelog_hash)
|
96
96
|
|
97
|
+
changelog_hash.each { |release, changelog|
|
98
|
+
validate_single_changelog_entry(changelog)
|
99
|
+
}
|
100
|
+
|
97
101
|
latest_release, latest_release_changelog = changelog_hash.first
|
98
102
|
CurrentRelease.new(latest_release, latest_release_changelog)
|
99
103
|
end
|
104
|
+
|
105
|
+
def validate_single_changelog_entry(entry)
|
106
|
+
lines = entry.split(/\r?\n/)
|
107
|
+
lines.each{ |line|
|
108
|
+
if line.match /^\s*\*\s+.*$/ # regex matches bulleted points
|
109
|
+
if !line.match /^\s*\*\s+.*[\!,\?:\.]$/ # regex matches bullet points with punctuation
|
110
|
+
Printer.fail("'#{line}' is invalid. Bulleted points should end in punctuation.")
|
111
|
+
abort()
|
112
|
+
end
|
113
|
+
end
|
114
|
+
}
|
115
|
+
end
|
100
116
|
end
|
101
117
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: releasinator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PayPal
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|