This repository has been archived by the owner on Mar 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
53 lines (46 loc) · 1.14 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
50
51
52
53
# frozen_string_literal: true
def optional_gem_task(*requires)
requires.each do |req|
require req
end
yield
rescue LoadError
gemname = req.split('/').first.capitalize
puts ">>>>> #{gemname} gem not loaded; ommitting task" unless ENV['CI']
end
optional_gem_task('rdoc/task') do
RDoc::Task.new do |rdoc|
rdoc.main = 'DEV-README.md'
rdoc.markup = 'markdown'
rdoc.rdoc_files.include('DEV-README.md', 'lib')
rdoc.rdoc_dir = 'docs'
end
end
optional_gem_task('rspec/core/rake_task') do
RSpec::Core::RakeTask.new(:spec) do |rspec|
next unless ENV['CI']
rspec.rspec_opts = [
'--format progress',
'--fail-fast',
'--no-profile'
]
end
end
optional_gem_task('rubocop/rake_task') do
RuboCop::RakeTask.new do |rubocop|
next unless ENV['CI']
rubocop.options = [
['--fail-level', 'W'],
'--display-only-fail-level-offenses',
'--fail-fast'
]
rubocop.formatters = ['simple']
end
end
optional_gem_task('rspec/core/rake_task', 'rubocop/rake_task') do
desc 'Run all tests and linters.'
task :default do
Rake::Task['rubocop'].invoke
Rake::Task['spec'].invoke
end
end