Skip to content

Commit 65b8493

Browse files
committed
Merge pull request #1224 from bf4/rake_ci
Separate default rake from rake ci
2 parents 48b041e + 9e3cf02 commit 65b8493

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ install:
1717
- bundle install --retry=3
1818

1919
script:
20-
- env CAPTURE_STDERR=false bundle exec rake
20+
- env CAPTURE_STDERR=false bundle exec rake ci
2121

2222
env:
2323
- "RAILS_VERSION=4.0"

Rakefile

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,27 @@ begin
1111
rescue LoadError
1212
else
1313
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'
2021
end
21-
else
22+
elsif defined?(::Rubinius)
2223
desc 'No-op rubocop to avoid rbx segfault'
2324
task :rubocop do
2425
puts 'Skipping rubocop on rbx due to segfault'
2526
puts 'https://github.com/rubinius/rubinius/issues/3499'
2627
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
2735
end
2836
end
2937

@@ -37,3 +45,6 @@ Rake::TestTask.new do |t|
3745
end
3846

3947
task default: [:test, :rubocop]
48+
49+
desc 'CI test task'
50+
task :ci => [:default]

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ install:
2121
- bundle install --retry=3
2222

2323
test_script:
24-
- bundle exec rake test
24+
- bundle exec rake ci
2525

2626
build: off

0 commit comments

Comments
 (0)