Permalink
Browse files

RUBY-585 setting up tailor, rspec and simplecov for 2.0 branch

  • Loading branch information...
brandonblack committed Apr 23, 2013
1 parent 1fc62d9 commit 9a267ac5a7a652b9d2991b54366502bdc840b8b3
Showing with 136 additions and 29 deletions.
  1. +3 −9 .gitignore
  2. +9 −0 .tailor
  3. +15 −5 .travis.yml
  4. +16 −5 Gemfile
  5. +5 −0 Guardfile
  6. +8 −4 README.md
  7. +1 −0 lib/mongo.rb
  8. +3 −0 lib/mongo/version.rb
  9. +18 −6 mongo.gemspec
  10. 0 spec/.gitkeep
  11. 0 {lib → spec/mongo}/.gitkeep
  12. +21 −0 spec/quality_spec.rb
  13. +15 −0 spec/spec_helper.rb
  14. +22 −0 spec/support/helpers.rb
View
@@ -10,19 +10,13 @@
*~
.DS_Store
.idea/*
-.rvmrc
-.ruby-version
.yardoc
coverage
data
docs
-ext/cbson/Makefile
-ext/jbson/target/java
Gemfile.lock
+.ruby-gemset
+.ruby-version
gem-private_key.pem
-lib/bson_ext
-lib/mongo_ext/Makefile
nbproject
-tasks/benchmark/exp_series_suite_*.js
-test/tools/data/
-tmp
+tmp
View
@@ -0,0 +1,9 @@
+Tailor.config do |config|
+ config.formatters 'text', 'yaml'
+ config.file_set 'lib/**/*.rb' do |style|
+ style.max_line_length 100, level: :warn
+ end
+
+ # config.file_set 'spec/**/*.rb', :spec do |style|
+ # end
+end
View
@@ -2,17 +2,22 @@ language: ruby
rvm:
- 1.8.7
+ - 1.9.2
- 1.9.3
- 2.0.0
- - jruby
- ruby-head
+ - jruby-18mode
+ - jruby-19mode
- jruby-head
+ - rbx-18mode
+ - rbx-19mode
+ - ree
-bundler_args: --without deploy
+bundler_args: --without deploy development
-env: TRAVIS_TEST="true"
+env: CI="travis"
-script: bundle exec rake test
+script: bundle exec rspec
notifications:
email: false
@@ -23,10 +28,15 @@ services:
branches:
only:
+ - 2.x-development
- master
- - release
+ - 1.x-stable
+ - 2.x-stable
matrix:
allow_failures:
- rvm: ruby-head
- rvm: jruby-head
+ - rvm: rbx-18mode
+ - rvm: rbx-19mode
+ - rvm: ree
View
21 Gemfile
@@ -1,6 +1,10 @@
source 'https://rubygems.org'
+# TODO: replace with gemspec once bson 2.0 has been released
gem 'bson', :git => 'git://github.com/mongodb/bson-ruby.git'
+# gemspec
+
+gem 'rake'
group :deploy do
gem 'git'
@@ -9,15 +13,22 @@ group :deploy do
end
group :testing do
- gem 'rake'
gem 'rspec'
+ if RUBY_VERSION > '1.9'
+ gem 'tailor', :require => false
+ gem 'coveralls', :require => false
+ end
end
group :development do
+ gem 'pry-rescue'
+ gem 'pry-nav'
+ gem 'guard-rspec'
-end
+ gem 'rb-inotify', :require => false # Linux
+ gem 'rb-fsevent', :require => false # OS X
+ gem 'rb-fchange', :require => false # Windows
+ gem 'terminal-notifier-guard'
-platforms :jruby do
- gem 'jruby-launcher'
- gem 'jruby-jars'
+ gem 'ruby-prof', :platforms => :mri
end
View
@@ -0,0 +1,5 @@
+guard 'rspec', :all_after_pass => false do
+ watch(%r{^spec/.+_spec\.rb$})
+ watch(%r{^lib/(.+)\.rb$}) { |match| 'spec/#{match[1]}_spec.rb' }
+ watch('spec/spec_helper.rb') { 'spec' }
+end
View
@@ -1,11 +1,15 @@
# MongoDB Ruby Driver
-[![Build Status][travis-img]][travis-url] [![Jenkins Status][jenkins-img]][jenkins-url] [![Code Climate][codeclimate-img]][codeclimate-url]
+[![Gem Version][rubygems-img]][rubygems-url]
+[![Build Status][travis-img]][travis-url]
+[![Code Climate][codeclimate-img]][codeclimate-url]
+[![Coverage Status][coveralls-img]][coveralls-url]
+[rubygems-img]: https://badge.fury.io/rb/mongo.png
+[rubygems-url]: http://badge.fury.io/rb/mongo
[travis-img]: https://secure.travis-ci.org/mongodb/mongo-ruby-driver.png
[travis-url]: http://travis-ci.org/mongodb/mongo-ruby-driver
[codeclimate-img]: https://codeclimate.com/github/mongodb/mongo-ruby-driver.png
[codeclimate-url]: https://codeclimate.com/github/mongodb/mongo-ruby-driver
-[jenkins-img]: https://jenkins.10gen.com/job/mongo-ruby-driver/badge/icon
-[jenkins-url]: https://jenkins.10gen.com/job/mongo-ruby-driver/
-
+[coveralls-img]: https://coveralls.io/repos/mongodb/mongo-ruby-driver/badge.png?branch=master
+[coveralls-url]: https://coveralls.io/r/mongodb/mongo-ruby-driver
View
@@ -0,0 +1 @@
+require 'mongo/version'
View
@@ -0,0 +1,3 @@
+module Mongo
+ VERSION = '2.0.0.alpha'
+end
View
@@ -1,24 +1,36 @@
+lib = File.expand_path('../lib', __FILE__)
+$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
+require 'mongo/version'
+
Gem::Specification.new do |s|
s.name = 'mongo'
+ s.rubyforge_project = 'mongo'
s.version = Mongo::VERSION
s.platform = Gem::Platform::RUBY
+
s.authors = ['Tyler Brock', 'Gary Murakami', 'Emily Stolfo', 'Brandon Black', 'Durran Jordan']
s.email = 'mongodb-dev@googlegroups.com'
s.homepage = 'http://www.mongodb.org'
s.summary = 'Ruby driver for MongoDB'
s.description = 'A Ruby driver for MongoDB'
- s.rubyforge_project = 'mongo'
s.license = 'Apache License Version 2.0'
if File.exists?('gem-private_key.pem')
- s.signing_key = 'gem-private_key.pem'
- s.cert_chain = ['gem-public_cert.pem']
+ s.signing_key = 'gem-private_key.pem'
+ s.cert_chain = ['gem-public_cert.pem']
else
- warn 'Warning: No private key present, creating unsigned gem.'
+ warn "[#{s.name}] Warning: No private key present, creating unsigned gem."
end
- s.files = ['mongo.gemspec', 'LICENSE', 'VERSION']
- s.files += ['README.md', 'Rakefile']
+ s.files = Dir.glob('{bin,lib,spec}/**/*')
+ s.files += %w(mongo.gemspec LICENSE README.md CONTRIBUTING.md Rakefile)
+ s.test_files = Dir.glob('spec/**/*')
+
s.require_paths = ['lib']
s.has_rdoc = 'yard'
+ s.bindir = 'bin'
+
+ # TODO: uncomment after bson 2.0 release, for now use gemfile
+ # s.add_dependency = 'bson', '>= 2.0.0'
+ s.add_development_dependency = 'bundler', '>= 1.3.0'
end
View
No changes.
File renamed without changes.
View
@@ -0,0 +1,21 @@
+require 'spec_helper'
+
+describe 'Code Quality' do
+ if RUBY_VERSION > '1.9'
+
+ it 'has no style-guide violations' do
+ require 'tailor/cli'
+ result = silence do
+ t = Tailor::CLI.new %w(lib)
+ t.result
+ end
+ result = result.values.flatten.select {|v| !v.empty?}
+ expect(result.size).to eq(0)
+ end
+
+ it 'has adequate test coverage' do
+ expect(SimpleCov.result.covered_percent).to be >= 90
+ end
+
+ end
+end
View
@@ -0,0 +1,15 @@
+if RUBY_VERSION > '1.9'
+ require 'coveralls'
+ Coveralls.wear!
+end
+
+require 'mongo'
+require 'support/helpers'
+require 'rspec/autorun'
+
+RSpec.configure do |config|
+ config.color = true
+ config.fail_fast = true unless ENV['CI']
+ config.formatter = 'documentation'
+ config.include Helpers
+end
View
@@ -0,0 +1,22 @@
+module Helpers
+
+ # Helper method to allow temporary redirection of $stdout.
+ #
+ # @example
+ # silence do
+ # # your noisey code here
+ # end
+ #
+ # @param A code block to execute.
+ # @return Original $stdout value.
+ def silence &block
+ original_stdout = $stdout
+ original_stderr = $stderr
+ $stdout = $stderr = File.new('/dev/null', 'w')
+ yield block
+ ensure
+ $stdout = original_stdout
+ $stderr = original_stderr
+ end
+
+end

0 comments on commit 9a267ac

Please sign in to comment.