2008-12-29 05:18:50 +00:00
|
|
|
# require 'rubygems'
|
2008-11-05 23:50:11 +00:00
|
|
|
require "rake/gempackagetask"
|
2008-11-07 17:13:41 +00:00
|
|
|
require 'rake/rdoctask'
|
2008-11-05 23:50:11 +00:00
|
|
|
require "rake/clean"
|
2008-04-28 08:57:46 +00:00
|
|
|
require 'spec'
|
|
|
|
require 'spec/rake/spectask'
|
2008-11-05 23:34:56 +00:00
|
|
|
require 'spec/rake/verify_rcov'
|
2008-11-17 02:25:29 +00:00
|
|
|
require File.expand_path('./lib/webrat.rb')
|
2008-03-02 20:14:52 +00:00
|
|
|
|
2008-11-05 23:50:11 +00:00
|
|
|
##############################################################################
|
|
|
|
# Package && release
|
|
|
|
##############################################################################
|
|
|
|
spec = Gem::Specification.new do |s|
|
|
|
|
s.name = "webrat"
|
|
|
|
s.version = Webrat::VERSION
|
|
|
|
s.platform = Gem::Platform::RUBY
|
|
|
|
s.author = "Bryan Helmkamp"
|
|
|
|
s.email = "bryan" + "@" + "brynary.com"
|
|
|
|
s.homepage = "http://github.com/brynary/webrat"
|
|
|
|
s.summary = "Webrat. Ruby Acceptance Testing for Web applications"
|
|
|
|
s.bindir = "bin"
|
|
|
|
s.description = s.summary
|
|
|
|
s.require_path = "lib"
|
2008-12-01 04:45:45 +00:00
|
|
|
s.files = %w(History.txt install.rb MIT-LICENSE.txt README.rdoc Rakefile) + Dir["lib/**/*"] + Dir["vendor/**/*"]
|
2008-11-05 23:50:11 +00:00
|
|
|
|
|
|
|
# rdoc
|
|
|
|
s.has_rdoc = true
|
2008-11-25 01:34:10 +00:00
|
|
|
s.extra_rdoc_files = %w(README.rdoc MIT-LICENSE.txt)
|
2008-11-05 23:50:11 +00:00
|
|
|
|
|
|
|
# Dependencies
|
2008-12-29 05:47:02 +00:00
|
|
|
s.add_dependency "nokogiri", ">= 1.1.0"
|
2008-11-25 01:34:10 +00:00
|
|
|
|
|
|
|
s.rubyforge_project = "webrat"
|
2008-11-05 23:50:11 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
Rake::GemPackageTask.new(spec) do |package|
|
|
|
|
package.gem_spec = spec
|
|
|
|
end
|
|
|
|
|
|
|
|
desc 'Show information about the gem.'
|
|
|
|
task :debug_gem do
|
|
|
|
puts spec.to_ruby
|
|
|
|
end
|
|
|
|
|
|
|
|
CLEAN.include ["pkg", "*.gem", "doc", "ri", "coverage"]
|
2008-03-02 20:14:52 +00:00
|
|
|
|
|
|
|
desc "Upload rdoc to brynary.com"
|
2008-03-03 00:35:46 +00:00
|
|
|
task :publish_rdoc => :docs do
|
|
|
|
sh "scp -r doc/ brynary.com:/apps/uploads/webrat"
|
2008-04-28 08:57:46 +00:00
|
|
|
end
|
|
|
|
|
2008-10-25 16:42:38 +00:00
|
|
|
desc "Run API and Core specs"
|
2008-04-28 08:57:46 +00:00
|
|
|
Spec::Rake::SpecTask.new do |t|
|
|
|
|
t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
|
2008-12-29 05:18:50 +00:00
|
|
|
t.spec_files = FileList['spec/public/*_spec.rb'] + FileList['spec/private/*_spec.rb']
|
2008-04-28 08:57:46 +00:00
|
|
|
end
|
|
|
|
|
2008-10-25 20:56:06 +00:00
|
|
|
desc "Run all specs in spec directory with RCov"
|
|
|
|
Spec::Rake::SpecTask.new(:rcov) do |t|
|
|
|
|
t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
|
2008-12-29 05:18:50 +00:00
|
|
|
t.spec_files = FileList['spec/public/*_spec.rb'] + FileList['spec/private/*_spec.rb']
|
2008-10-25 20:56:06 +00:00
|
|
|
t.rcov = true
|
|
|
|
t.rcov_opts = lambda do
|
|
|
|
IO.readlines(File.dirname(__FILE__) + "/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
|
2008-04-28 08:57:46 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2008-10-25 20:56:06 +00:00
|
|
|
RCov::VerifyTask.new(:verify_rcov => :rcov) do |t|
|
|
|
|
t.threshold = 96.2 # Make sure you have rcov 0.7 or higher!
|
|
|
|
end
|
|
|
|
|
2008-11-06 19:44:06 +00:00
|
|
|
desc 'Install the package as a gem.'
|
|
|
|
task :install_gem => [:clean, :package] do
|
2008-12-29 05:18:50 +00:00
|
|
|
gem_filename = Dir['pkg/*.gem'].first
|
|
|
|
sh "sudo gem install --local #{gem_filename}"
|
2008-11-06 19:44:06 +00:00
|
|
|
end
|
2008-11-07 17:13:41 +00:00
|
|
|
|
2008-12-01 01:09:41 +00:00
|
|
|
desc "Delete generated RDoc"
|
|
|
|
task :clobber_docs do
|
|
|
|
FileUtils.rm_rf("doc")
|
|
|
|
end
|
|
|
|
|
2008-11-25 01:10:27 +00:00
|
|
|
desc "Generate RDoc"
|
2008-12-01 01:09:41 +00:00
|
|
|
task :docs => :clobber_docs do
|
2008-11-25 06:04:26 +00:00
|
|
|
system "hanna --title 'Webrat #{Webrat::VERSION} API Documentation'"
|
2008-11-17 04:03:44 +00:00
|
|
|
end
|
|
|
|
|
2008-11-19 02:09:48 +00:00
|
|
|
desc "Run specs using jruby"
|
|
|
|
task "spec:jruby" do
|
|
|
|
system "jruby -S rake spec"
|
2008-11-19 20:59:24 +00:00
|
|
|
end
|
|
|
|
|
2008-11-28 08:11:19 +00:00
|
|
|
desc "Run each spec in isolation to test for dependency issues"
|
|
|
|
task :spec_deps do
|
|
|
|
Dir["spec/**/*_spec.rb"].each do |test|
|
|
|
|
if !system("spec #{test} &> /dev/null")
|
|
|
|
puts "Dependency Issues: #{test}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2008-12-29 05:18:50 +00:00
|
|
|
task :prepare do
|
|
|
|
system "ln -s ../../../../.. ./spec/integration/rails/vendor/plugins/webrat"
|
|
|
|
end
|
|
|
|
|
2008-12-29 06:11:41 +00:00
|
|
|
namespace :spec do
|
|
|
|
desc "Run the integration specs"
|
|
|
|
task :integration do
|
|
|
|
Dir.chdir "spec/integration/rails" do
|
|
|
|
result = system "rake test:integration"
|
2008-12-29 08:41:50 +00:00
|
|
|
raise "Integration tests failed for rails" unless result
|
2008-12-29 06:11:41 +00:00
|
|
|
end
|
2008-12-29 07:10:05 +00:00
|
|
|
|
|
|
|
Dir.chdir "spec/integration/merb" do
|
|
|
|
result = system "rake spec"
|
2008-12-29 08:41:50 +00:00
|
|
|
raise "Integration tests failed for merb" unless result
|
|
|
|
end
|
|
|
|
|
|
|
|
Dir.chdir "spec/integration/sinatra" do
|
|
|
|
result = system "rake test"
|
|
|
|
raise "Integration tests failed for sinatra" unless result
|
2008-12-29 07:10:05 +00:00
|
|
|
end
|
2008-12-29 06:11:41 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2008-11-28 08:03:23 +00:00
|
|
|
task :default => :spec
|
|
|
|
|
2008-12-29 06:11:41 +00:00
|
|
|
task :precommit => ["spec", "spec:jruby", "spec:integration"]
|