forked from rossta/serviceworker-rails
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
51 lines (42 loc) · 1 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
# frozen_string_literal: true
require "rubygems"
require "bundler/setup"
require "bundler/gem_tasks"
require "rake/testtask"
require "rubocop/rake_task"
APP_RAKEFILE = File.expand_path("test/sample/Rakefile", __dir__)
load "rails/tasks/engine.rake"
RuboCop::RakeTask.new
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList["test/**/*_test.rb"]
end
task default: %i[test rubocop]
namespace :app do
task :yarn_install do
Dir.chdir("test/sample") do
sh "yarn install"
end
end
task :yarn_install_frozen do
Dir.chdir("test/sample") do
sh "yarn install --frozen-lockfile"
end
end
end
task :compile do
if defined?(Webpacker)
Dir.chdir("test/sample") do
sh "yarn install --frozen-lockfile"
sh "RAILS_ENV=test ./bin/rake webpacker:compile"
end
end
end
Rake::Task[:test].enhance [:compile] do
if defined?(Webpacker)
Dir.chdir("test/sample") do
sh "RAILS_ENV=test ./bin/rake webpacker:clobber"
end
end
end