@@ -11,19 +11,27 @@ begin
11
11
rescue LoadError
12
12
else
13
13
Rake ::Task [ :rubocop ] . clear if Rake ::Task . task_defined? ( :rubocop )
14
- if !defined? ( ::Rubinius )
15
- Rake ::Task [ :rubocop ] . clear if Rake ::Task . task_defined? ( :rubocop )
16
- desc 'Execute rubocop'
17
- RuboCop ::RakeTask . new ( :rubocop ) do |task |
18
- task . options = [ '--rails' , '--display-cop-names' , '--display-style-guide' ]
19
- task . fail_on_error = true
14
+ require 'rbconfig'
15
+ # https://github.com/bundler/bundler/blob/1b3eb2465a/lib/bundler/constants.rb#L2
16
+ windows_platforms = /(msdos|mswin|djgpp|mingw)/
17
+ if RbConfig ::CONFIG [ 'host_os' ] =~ windows_platforms
18
+ desc 'No-op rubocop on Windows-- unsupported platform'
19
+ task :rubocop do
20
+ puts 'Skipping rubocop on Windows'
20
21
end
21
- else
22
+ elsif defined? ( :: Rubinius )
22
23
desc 'No-op rubocop to avoid rbx segfault'
23
24
task :rubocop do
24
25
puts 'Skipping rubocop on rbx due to segfault'
25
26
puts 'https://github.com/rubinius/rubinius/issues/3499'
26
27
end
28
+ else
29
+ Rake ::Task [ :rubocop ] . clear if Rake ::Task . task_defined? ( :rubocop )
30
+ desc 'Execute rubocop'
31
+ RuboCop ::RakeTask . new ( :rubocop ) do |task |
32
+ task . options = [ '--rails' , '--display-cop-names' , '--display-style-guide' ]
33
+ task . fail_on_error = true
34
+ end
27
35
end
28
36
end
29
37
@@ -37,3 +45,6 @@ Rake::TestTask.new do |t|
37
45
end
38
46
39
47
task default : [ :test , :rubocop ]
48
+
49
+ desc 'CI test task'
50
+ task :ci => [ :default ]
0 commit comments