forked from chanzuckerberg/sorbet-rails
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
65 lines (56 loc) · 2.69 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
require 'rspec/core/rake_task'
require 'bundler/gem_tasks'
RSpec::Core::RakeTask.new(:spec)
task :default => :spec
namespace :update_spec do
require 'fileutils'
desc "Generate Rails apps for all versions."
task :all do |t, args|
Rake::Task['update_spec:v6_0'].invoke
Rake::Task['update_spec:v5_2'].invoke
Rake::Task['update_spec:v5_1'].invoke
Rake::Task['update_spec:v5_0'].invoke
end
desc "Delete the Rails 6 spec directory and regenerate it."
task :v6_0 do |t, args|
Bundler.with_clean_env do
FileUtils.rm_rf 'spec/support/v6.0' if File.directory?('spec/support/v6.0')
system("gem install rails -v 6.0.3")
system("rails _6.0.3_ -v")
system("RAILS_VERSION='6.0' rails _6.0.3_ new --template spec/generators/rails-template.rb spec/support/v6.0 --skip-javascript --skip-action-cable --skip-test --skip-sprockets --skip-spring --skip-bootsnap --skip-listen")
end
end
desc "Delete the Rails 5.2 spec directory and regenerate it."
task :v5_2 do |t, args|
Bundler.with_clean_env do
FileUtils.rm_rf 'spec/support/v5.2' if File.directory?('spec/support/v5.2')
system("gem install rails -v 5.2.3")
system("rails _5.2.3_ -v")
system("RAILS_VERSION='5.2' rails _5.2.3_ new --template spec/generators/rails-template.rb spec/support/v5.2 --skip-javascript --skip-action-cable --skip-test --skip-sprockets --skip-spring --skip-bootsnap --skip-listen")
end
end
desc "Delete the Rails 5.1 spec directory and regenerate it."
task :v5_1 do |t, args|
Bundler.with_clean_env do
FileUtils.rm_rf 'spec/support/v5.1' if File.directory?('spec/support/v5.1')
system("gem install rails -v 5.1.7")
system("rails _5.1.7_ -v")
system("RAILS_VERSION='5.1' rails _5.1.7_ new --template spec/generators/rails-template.rb spec/support/v5.1 --skip-javascript --skip-action-cable --skip-test --skip-sprockets --skip-spring --skip-listen")
end
end
desc "Delete the Rails 5.0 spec directory and regenerate it."
task :v5_0 do |t, args|
Bundler.with_clean_env do
FileUtils.rm_rf 'spec/support/v5.0' if File.directory?('spec/support/v5.0')
system("gem install rails -v 5.0.7")
system("rails _5.0.7_ -v")
system("RAILS_VERSION='5.0' rails _5.0.7_ new --template spec/generators/rails-template.rb spec/support/v5.0 --skip-javascript --skip-action-cable --skip-test --skip-sprockets --skip-spring --skip-listen")
end
end
desc "Update sorbet_test_cases.rb in all the Rails apps in spec/support."
task :sorbet_test_cases do |t, args|
['v6.0', 'v5.2', 'v5.1', 'v5.0'].each do |version|
FileUtils.cp("spec/generators/sorbet_test_cases.rb", "spec/support/#{version}/sorbet_test_cases.rb")
end
end
end