-
Notifications
You must be signed in to change notification settings - Fork 62
/
Rakefile
42 lines (34 loc) · 964 Bytes
/
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
# frozen_string_literal: true
require 'rubygems'
require 'bundler'
require 'yard'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
Bundler::GemHelper.install_tasks
task test: %i[rubocop spec]
task default: :test
# Rubocop
desc 'Run Rubocop lint checks'
task :rubocop do
RuboCop::RakeTask.new
end
desc 'Gem checksum'
task :checksum do
gem_name = ENV.fetch('GEM_NAME', nil)
break unless gem_name
require 'digest/sha2'
cur_dir = __dir__
built_gem_path = File.join(cur_dir, "pkg/#{gem_name}.gem")
checksum = Digest::SHA512.new.hexdigest(File.read(built_gem_path))
checksum_path = File.join(cur_dir, "checksum/#{gem_name}.gem.sha512")
File.write(checksum_path, checksum)
puts "Wrote #{checksum_path}"
end
desc 'Run specs'
RSpec::Core::RakeTask.new('spec') do |task|
task.pattern = 'spec/**/*_spec.rb'
end
YARD::Rake::YardocTask.new(:doc) do |task|
task.files = %w[lib/**/*.rb - README.md]
task.options = %w[no-private]
end