Rakefile in rack-oauth2-server-2.4.1 vs Rakefile in rack-oauth2-server-2.4.2
- old
+ new
@@ -1,19 +1,43 @@
require "rake/testtask"
spec = Gem::Specification.load(Dir["*.gemspec"].first)
+GEMFILE_MAP = {"gemfiles/Rails2" => "Rails 2.3", "gemfiles/Rails3" => "Rails 3.x", "gemfiles/Sinatra1.1" => "Sinatra 1.1", "gemfiles/Sinatra1.2" => "Sinatra 1.2", "gemfiles/Sinatra1.3" => "Sinatra 1.3"}
+
desc "Install dependencies"
task :setup do
- puts "Installing gems for testing with Sinatra ..."
- sh "bundle install"
- puts "Installing gems for testing with Rails 2.3 ..."
- sh "env BUNDLE_GEMFILE=Rails2 bundle install"
- puts "Installing gems for testing with Rails 3.x ..."
- sh "env BUNDLE_GEMFILE=Rails3 bundle install"
+ GEMFILE_MAP.each do |gemfile, name|
+ puts "Installing gems for testing with #{name} ..."
+ sh "env BUNDLE_GEMFILE=#{File.dirname(__FILE__) + '/' + gemfile} bundle install"
+ end
end
+desc "Run all tests"
+Rake::TestTask.new do |task|
+ task.test_files = FileList['test/**/*_test.rb']
+ if Rake.application.options.trace
+ #task.warning = true
+ task.verbose = true
+ elsif Rake.application.options.silent
+ task.ruby_opts << "-W0"
+ else
+ task.verbose = true
+ end
+ task.ruby_opts << "-I."
+end
+
+namespace :test do
+ GEMFILE_MAP.each do |gemfile, name|
+ desc "Run all tests against #{name}"
+ task gemfile.downcase.gsub(/\./, "_") do
+ sh "env BUNDLE_GEMFILE=#{gemfile} bundle exec rake"
+ end
+ end
+ task :all=>GEMFILE_MAP.map {|gemfile, name| "test:#{gemfile.downcase.gsub(/\./, "_")}"}
+end
+
desc "Run this in development mode when updating the CoffeeScript file"
task :coffee do
sh "coffee -w -o lib/rack/oauth2/admin/js/ lib/rack/oauth2/admin/js/application.coffee"
end
@@ -32,45 +56,14 @@
sh "#{sudo} gem install #{spec.name}-#{spec.version}.gem"
end
desc "Push new release to gemcutter and git tag"
task :push=>["test:all", "build"] do
- sh "git push"
puts "Tagging version #{spec.version} .."
- sh "git tag v#{spec.version}"
- sh "git push --tag"
+ sh "git tag -a v#{spec.version}"
+ sh "git push --tags"
puts "Building and pushing gem .."
sh "gem push #{spec.name}-#{spec.version}.gem"
-end
-
-desc "Run all tests"
-Rake::TestTask.new do |task|
- task.test_files = FileList['test/**/*_test.rb']
- if Rake.application.options.trace
- #task.warning = true
- task.verbose = true
- elsif Rake.application.options.silent
- task.ruby_opts << "-W0"
- else
- task.verbose = true
- end
- task.ruby_opts << "-I."
-end
-
-namespace :test do
- task :all=>["test:sinatra", "test:rails2", "test:rails3"]
- desc "Run all tests against Sinatra"
- task :sinatra do
- sh "env BUNDLE_GEMFILE=Gemfile bundle exec rake"
- end
- desc "Run all tests against Rails 2.3.x"
- task :rails2 do
- sh "env BUNDLE_GEMFILE=Rails2 bundle exec rake"
- end
- desc "Run all tests against Rails 3.x"
- task :rails3 do
- sh "env BUNDLE_GEMFILE=Rails3 bundle exec rake"
- end
end
task :default do
ENV["FRAMEWORK"] = "rails"
begin