aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ruby/Rakefile
diff options
context:
space:
mode:
authorGravatar Tim Emiola <temiola@google.com>2015-01-16 02:58:41 -0800
committerGravatar Tim Emiola <temiola@google.com>2015-01-16 02:58:41 -0800
commite2860c5bdb98a8574673804628db6ca4dfe7c26b (patch)
tree3e9c65551dd19b1c72ca20fbed064b0821d5c530 /src/ruby/Rakefile
parent4036f002e1026fd7e1e2d5f134b5713ab7a82bcd (diff)
Adds rubocop and fixes most style violations it detected
- add rubocop as a dev dependency - fixed many style violations it reported, often using --auto-correct - add a rubocop config - .rubocop.yml shows the exceptions - .rubocopy_todo.yml tracks outstanding style issues - adds a rake task to allow rubocop styling checks to be automated
Diffstat (limited to 'src/ruby/Rakefile')
-rwxr-xr-xsrc/ruby/Rakefile32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/ruby/Rakefile b/src/ruby/Rakefile
index 0a0fbcecca..6ba9a97c89 100755
--- a/src/ruby/Rakefile
+++ b/src/ruby/Rakefile
@@ -1,46 +1,44 @@
# -*- ruby -*-
require 'rake/extensiontask'
require 'rspec/core/rake_task'
+require 'rubocop/rake_task'
+desc 'Run Rubocop to check for style violations'
+RuboCop::RakeTask.new
Rake::ExtensionTask.new 'grpc' do |ext|
ext.lib_dir = File.join('lib', 'grpc')
end
SPEC_SUITES = [
- { :id => :wrapper, :title => 'wrapper layer', :files => %w(spec/*.rb) },
- { :id => :idiomatic, :title => 'idiomatic layer', :dir => %w(spec/generic),
- :tag => '~bidi' },
- { :id => :bidi, :title => 'bidi tests', :dir => %w(spec/generic),
- :tag => 'bidi' }
+ { id: :wrapper, title: 'wrapper layer', files: %w(spec/*.rb) },
+ { id: :idiomatic, title: 'idiomatic layer', dir: %w(spec/generic),
+ tag: '~bidi' },
+ { id: :bidi, title: 'bidi tests', dir: %w(spec/generic),
+ tag: 'bidi' }
]
-desc "Run all RSpec tests"
+desc 'Run all RSpec tests'
namespace :spec do
namespace :suite do
SPEC_SUITES.each do |suite|
desc "Run all specs in #{suite[:title]} spec suite"
RSpec::Core::RakeTask.new(suite[:id]) do |t|
spec_files = []
- if suite[:files]
- suite[:files].each { |f| spec_files += Dir[f] }
- end
+ suite[:files].each { |f| spec_files += Dir[f] } if suite[:files]
if suite[:dirs]
suite[:dirs].each { |f| spec_files += Dir["#{f}/**/*_spec.rb"] }
end
t.pattern = spec_files
-
- if suite[:tag]
- t.rspec_opts = "--tag #{suite[:tag]}"
- end
+ t.rspec_opts = "--tag #{suite[:tag]}" if suite[:tag]
end
end
end
end
-task :default => "spec:suite:idiomatic" # this should be spec:suite:bidi
-task "spec:suite:wrapper" => :compile
-task "spec:suite:idiomatic" => "spec:suite:wrapper"
-task "spec:suite:bidi" => "spec:suite:idiomatic"
+task default: 'spec:suite:idiomatic' # this should be spec:suite:bidi
+task 'spec:suite:wrapper' => :compile
+task 'spec:suite:idiomatic' => 'spec:suite:wrapper'
+task 'spec:suite:bidi' => 'spec:suite:idiomatic'