aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Michael Lumish <mlumish@google.com>2015-03-24 09:24:40 -0700
committerGravatar Michael Lumish <mlumish@google.com>2015-03-24 09:24:40 -0700
commite6c108e9cb50f902f9a645772065f75ede91f95d (patch)
tree633816f66ff71f3998af11a51d44789c2bf79fb3
parent7bca47e08ca4415f7de17646931a22bf7a857927 (diff)
parentf20d76097266e6a708ad1b6d4d1cb45b1c5b581c (diff)
Merge pull request #1119 from tbetbetbe/grpc_ruby_update_rakefile
Updates the Rakefile
-rwxr-xr-xsrc/ruby/Rakefile53
1 files changed, 27 insertions, 26 deletions
diff --git a/src/ruby/Rakefile b/src/ruby/Rakefile
index b27305d16c..afb354e922 100755
--- a/src/ruby/Rakefile
+++ b/src/ruby/Rakefile
@@ -2,14 +2,17 @@
require 'rake/extensiontask'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
+require 'bundler/gem_tasks'
-desc 'Run Rubocop to check for style violations'
+# Add rubocop style checking tasks
RuboCop::RakeTask.new
+# Add the extension compiler task
Rake::ExtensionTask.new 'grpc' do |ext|
ext.lib_dir = File.join('lib', 'grpc')
end
+# Define the test suites
SPEC_SUITES = [
{ id: :wrapper, title: 'wrapper layer', files: %w(spec/*.rb) },
{ id: :idiomatic, title: 'idiomatic layer', dir: %w(spec/generic),
@@ -19,36 +22,34 @@ SPEC_SUITES = [
{ id: :server, title: 'rpc server thread tests', dir: %w(spec/generic),
tag: 'server' }
]
+namespace :suite do
+ SPEC_SUITES.each do |suite|
+ desc "Run all specs in the #{suite[:title]} spec suite"
+ RSpec::Core::RakeTask.new(suite[:id]) do |t|
+ spec_files = []
+ suite[:files].each { |f| spec_files += Dir[f] } if suite[:files]
+
+ if suite[:dir]
+ suite[:dir].each { |f| spec_files += Dir["#{f}/**/*_spec.rb"] }
+ end
+ helper = 'spec/spec_helper.rb'
+ spec_files << helper unless spec_files.include?(helper)
-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 = []
- 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
- t.rspec_opts = "--tag #{suite[:tag]}" if suite[:tag]
- if suite[:tags]
- t.rspec_opts = suite[:tags].map { |x| "--tag #{x}" }.join(' ')
- end
+ t.pattern = spec_files
+ t.rspec_opts = "--tag #{suite[:tag]}" if suite[:tag]
+ if suite[:tags]
+ t.rspec_opts = suite[:tags].map { |x| "--tag #{x}" }.join(' ')
end
end
end
end
-desc 'Compiles the extension then runs all the tests'
-task :all
+# Define dependencies between the suites.
+task 'suite:wrapper' => [:compile, :rubocop]
+task 'suite:idiomatic' => 'suite:wrapper'
+task 'suite:bidi' => 'suite:wrapper'
+task 'suite:server' => 'suite:wrapper'
+desc 'Compiles the gRPC extension then runs all the tests'
+task all: ['suite:idiomatic', 'suite:bidi', 'suite:server']
task default: :all
-task 'spec:suite:wrapper' => [:compile, :rubocop]
-task 'spec:suite:idiomatic' => 'spec:suite:wrapper'
-task 'spec:suite:bidi' => 'spec:suite:wrapper'
-task 'spec:suite:server' => 'spec:suite:wrapper'
-task all: ['spec:suite:idiomatic', 'spec:suite:bidi', 'spec:suite:server']