Skip to content
This repository was archived by the owner on Apr 14, 2021. It is now read-only.

Commit bf7bbc8

Browse files
Add a release file list check
1 parent 2bb3fce commit bf7bbc8

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

task/release.rake

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,33 @@ require "bundler/gem_tasks"
44
task :build => ["build_metadata", "man:build", "generate_files"] do
55
Rake::Task["build_metadata:clean"].tap(&:reenable).real_invoke
66
end
7-
task :release => ["man:require", "man:build", "release:verify_github", "build_metadata"]
7+
task :release => ["man:require", "man:build", "release:verify_files", "release:verify_github", "build_metadata"]
88

99
namespace :release do
10+
task :verify_files do
11+
git_list = IO.popen("git ls-files -z", &:read).split("\x0").select {|f| f.match(%r{^(lib|exe)/}) }
12+
git_list += %w[CHANGELOG.md LICENSE.md README.md bundler.gemspec]
13+
git_list += Dir.glob("man/**/*")
14+
15+
gem_list = Gem::Specification.load("bundler.gemspec").files
16+
17+
extra_files = gem_list.to_set - git_list.to_set
18+
19+
error_msg = <<~MSG
20+
21+
You intend to ship some files with the gem that are not generated man pages
22+
nor source control files. Please review the extra list of files and try
23+
again:
24+
25+
#{extra_files.to_a.join("\n ")}
26+
27+
MSG
28+
29+
raise error_msg if extra_files.any?
30+
31+
puts "The file list is correct for a release."
32+
end
33+
1034
def gh_api_post(opts)
1135
gem "netrc", "~> 0.11.0"
1236
require "netrc"

0 commit comments

Comments
 (0)