Added Rubocop harness to enforce Ruby code style
diff --git a/lib/rb/Rakefile b/lib/rb/Rakefile
index b33d773..7b51145 100644
--- a/lib/rb/Rakefile
+++ b/lib/rb/Rakefile
@@ -81,7 +81,7 @@
Dir::chdir(File::dirname('ext/extconf.rb')) do
unless sh "ruby #{File::basename('ext/extconf.rb')}"
$stderr.puts "Failed to run extconf"
- break
+ break
end
unless sh "make"
$stderr.puts "make failed"
@@ -103,6 +103,13 @@
ruby 'benchmark/benchmark.rb'
end
+begin
+ require "rubocop/rake_task"
+ RuboCop::RakeTask.new
+rescue LoadError
+ task(:rubocop) { abort "Install the rubocop gem to run a static analysis" }
+end
+
desc 'Builds the thrift gem'
task :gem => [:spec, :build_ext] do
unless sh 'gem', 'build', 'thrift.gemspec'