-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathRakefile
49 lines (37 loc) · 1.31 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
require "bundler/gem_tasks"
require "rake/testtask"
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList["test/**/*_test.rb"]
end
begin
require "rubocop/rake_task"
RuboCop::RakeTask.new
task :default => [:test, :rubocop]
rescue LoadError
task :default => :test
end
# == "rake release" enhancements ==============================================
Rake::Task["release"].enhance do
puts "Don't forget to publish the release on GitHub!"
system "open https://github.com/mattbrictson/airbrussh/releases"
end
task :disable_overcommit do
ENV["OVERCOMMIT_DISABLE"] = "1"
end
Rake::Task[:build].enhance [:disable_overcommit]
task :verify_gemspec_files do
git_files = `git ls-files -z`.split("\x0")
gemspec_files = Gem::Specification.load("airbrussh.gemspec").files.sort
ignored_by_git = gemspec_files - git_files
next if ignored_by_git.empty?
raise <<-ERROR.gsub(/^\s+/, "")
The `spec.files` specified in airbrussh.gemspec include the following files
that are being ignored by git. Did you forget to add them to the repo? If
not, you may need to delete these files or modify the gemspec to ensure
that they are not included in the gem by mistake:
#{ignored_by_git.join("\n").gsub(/^/, ' ')}
ERROR
end
Rake::Task[:build].enhance [:verify_gemspec_files]