-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
72 lines (56 loc) · 1.77 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# frozen_string_literal: true
$LOAD_PATH.unshift File.join(__dir__, 'lib')
require 'bundler'
env = ENV['APP_ENV'] || 'development'
Bundler.require(:default, env)
require 'application_configuration'
ApplicationConfiguration.load!
require 'application_assets'
require 'rake/sprocketstask'
Rake::SprocketsTask.new do |sprockets|
sprockets.environment = ApplicationAssets.new
sprockets.output = File.join(__dir__, "public#{ApplicationAssets::ASSET_ROOT}")
sprockets.assets = %w[manifest.js]
end
# Aliases for capistrano-rails to invoke
# rubocop:disable Rake/Desc
namespace :assets do
task(:precompile) { Rake::Task['assets'].invoke }
task(:clean) { Rake::Task['clean_assets'].invoke }
task(:clobber) { Rake::Task['clobber_assets'].invoke }
end
# rubocop:enable Rake/Desc
unless env == 'production'
require 'fileutils'
require 'haml_lint/rake_task'
require 'rdoc/task'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
RDoc::Task.new do |rdoc|
rdoc.markup = 'markdown'
rdoc.rdoc_files.include('README.md', 'lib/**/*.rb')
rdoc.main = 'README.md'
rdoc.rdoc_dir = 'docs'
end
Rake::Task['rdoc'].enhance do
FileUtils.touch 'docs/.nojekyll'
end
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
HamlLint::RakeTask.new do |hl|
next unless ENV['CI']
hl.fail_level = 'error'
hl.quiet = false
end
RSpec::Core::RakeTask.new(:spec) do |rspec|
next unless ENV['CI']
rspec.rspec_opts = ['--format progress', '--fail-fast', '--no-profile']
end
desc 'Run all tests and linters.'
task :default do
%w[spec rubocop haml_lint].each { |t| Rake::Task[t].invoke }
end
end