From 22c9ff48a8625b90284f7ed72d50d97ed8735e11 Mon Sep 17 00:00:00 2001 From: Brian Lopez Date: Sun, 17 Oct 2010 16:51:14 -0700 Subject: [PATCH] some more rspec2 changes, organize rake tasks --- Rakefile | 37 ------------------------------------- spec/spec_helper.rb | 3 ++- tasks/jeweler.rake | 17 +++++++++++++++++ tasks/rspec.rake | 16 ++++++++++++++++ 4 files changed, 35 insertions(+), 38 deletions(-) create mode 100644 tasks/jeweler.rake create mode 100644 tasks/rspec.rake diff --git a/Rakefile b/Rakefile index df610fe..7bb616b 100644 --- a/Rakefile +++ b/Rakefile @@ -1,42 +1,5 @@ # encoding: UTF-8 -begin - require 'jeweler' - JEWELER = Jeweler::Tasks.new do |gem| - gem.name = "mysql2" - gem.summary = "A simple, fast Mysql library for Ruby, binding to libmysql" - gem.email = "seniorlopez@gmail.com" - gem.homepage = "http://github.com/brianmario/mysql2" - gem.authors = ["Brian Lopez"] - gem.require_paths = ["lib", "ext"] - gem.extra_rdoc_files = `git ls-files *.rdoc`.split("\n") - gem.files = `git ls-files`.split("\n") - gem.extensions = ["ext/mysql2/extconf.rb"] - gem.files.include %w(lib/jeweler/templates/.document lib/jeweler/templates/.gitignore) - # gem.rubyforge_project = "mysql2" - end -rescue LoadError - puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install jeweler -s http://gems.github.com" -end - require 'rake' -require 'spec/rake/spectask' - -desc "Run all examples with RCov" -Spec::Rake::SpecTask.new('spec:rcov') do |t| - t.spec_files = FileList['spec/'] - t.rcov = true - t.rcov_opts = lambda do - IO.readlines("spec/rcov.opts").map {|l| l.chomp.split " "}.flatten - end -end -Spec::Rake::SpecTask.new('spec') do |t| - t.spec_files = FileList['spec/'] - t.spec_opts << '--options' << 'spec/spec.opts' - t.verbose = true - t.warning = true -end - -task :default => :spec # Load custom tasks Dir['tasks/*.rake'].sort.each { |f| load f } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index cdc842f..a0e5770 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,7 @@ # encoding: UTF-8 -require 'rubygems' +$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__) +require 'rspec' require 'mysql2' require 'timeout' diff --git a/tasks/jeweler.rake b/tasks/jeweler.rake new file mode 100644 index 0000000..e04979c --- /dev/null +++ b/tasks/jeweler.rake @@ -0,0 +1,17 @@ +begin + require 'jeweler' + JEWELER = Jeweler::Tasks.new do |gem| + gem.name = "mysql2" + gem.summary = "A simple, fast Mysql library for Ruby, binding to libmysql" + gem.email = "seniorlopez@gmail.com" + gem.homepage = "http://github.com/brianmario/mysql2" + gem.authors = ["Brian Lopez"] + gem.require_paths = ["lib", "ext"] + gem.extra_rdoc_files = `git ls-files *.rdoc`.split("\n") + gem.files = `git ls-files`.split("\n") + gem.extensions = ["ext/mysql2/extconf.rb"] + gem.files.include %w(lib/jeweler/templates/.document lib/jeweler/templates/.gitignore) + end +rescue LoadError + puts "jeweler, or one of its dependencies, is not available. Install it with: sudo gem install jeweler" +end \ No newline at end of file diff --git a/tasks/rspec.rake b/tasks/rspec.rake new file mode 100644 index 0000000..a6628e8 --- /dev/null +++ b/tasks/rspec.rake @@ -0,0 +1,16 @@ +begin + require 'rspec' + require 'rspec/core/rake_task' + + desc "Run all examples with RCov" + RSpec::Core::RakeTask.new('spec:rcov') do |t| + t.rcov = true + end + RSpec::Core::RakeTask.new('spec') do |t| + t.verbose = true + end + + task :default => :spec +rescue LoadError + puts "rspec, or one of its dependencies, is not available. Install it with: sudo gem install rspec" +end \ No newline at end of file