2004-11-23 20:04:44 -05:00
require 'rubygems'
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'rake/packagetask'
require 'rake/gempackagetask'
require 'rake/contrib/rubyforgepublisher'
PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
PKG_NAME = 'actionpack'
2005-01-25 15:10:24 -05:00
PKG_VERSION = '1.4.0' + PKG_BUILD
2004-11-23 20:04:44 -05:00
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
desc "Default Task"
task :default => [ :test ]
# Run the unit tests
Rake::TestTask.new { |t|
t.libs << "test"
2005-01-10 17:58:06 -05:00
# make sure we include the controller tests (c*) first as on some systems
# this will not happen automatically and the tests (as a whole) will error
t.test_files=Dir.glob( "test/c*/*_test.rb" ) + Dir.glob( "test/[ft]*/*_test.rb" )
# t.pattern = 'test/*/*_test.rb'
2004-11-23 20:04:44 -05:00
t.verbose = true
}
# Genereate the RDoc documentation
Rake::RDocTask.new { |rdoc|
rdoc.rdoc_dir = 'doc'
rdoc.title = "Action Pack -- On rails from request to response"
rdoc.options << '--line-numbers --inline-source --main README'
rdoc.rdoc_files.include('README', 'RUNNING_UNIT_TESTS', 'CHANGELOG')
rdoc.rdoc_files.include('lib/**/*.rb')
}
# Create compressed packages
dist_dirs = [ "lib", "test", "examples" ]
spec = Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = PKG_NAME
s.version = PKG_VERSION
s.summary = "Web-flow and rendering framework putting the VC in MVC."
2005-02-15 10:57:44 -05:00
s.description = %q{Eases web-request routing, handling, and response as a half-way front, half-way page controller. Implemented with specific emphasis on enabling easy unit/integration testing that doesn't require a browser.} #'
2004-11-23 20:04:44 -05:00
s.author = "David Heinemeier Hansson"
s.email = "david@loudthinking.com"
s.rubyforge_project = "actionpack"
2005-01-04 07:35:10 -05:00
s.homepage = "http://www.rubyonrails.org"
2004-11-23 20:04:44 -05:00
s.has_rdoc = true
s.requirements << 'none'
2005-02-15 10:57:44 -05:00
2005-02-15 11:43:13 -05:00
s.add_dependency('activesupport', '>= 0.9.0')
2005-02-15 10:57:44 -05:00
2004-11-23 20:04:44 -05:00
s.require_path = 'lib'
s.autorequire = 'action_controller'
s.files = [ "rakefile", "install.rb", "README", "RUNNING_UNIT_TESTS", "CHANGELOG", "MIT-LICENSE", "examples/.htaccess" ]
dist_dirs.each do |dir|
2004-11-25 11:31:27 -05:00
s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
2004-11-23 20:04:44 -05:00
end
s.files.delete "examples/benchmark.rb"
s.files.delete "examples/benchmark_with_ar.fcgi"
end
Rake::GemPackageTask.new(spec) do |p|
p.gem_spec = spec
p.need_tar = true
p.need_zip = true
end
# Publish beta gem
desc "Publish the API documentation"
task :pgem => [:package] do
2004-12-29 19:26:14 -05:00
Rake::SshFilePublisher.new("davidhh@comox.textdrive.com", "public_html/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
`ssh davidhh@comox.textdrive.com './gemupdate.sh'`
2004-11-23 20:04:44 -05:00
end
# Publish documentation
desc "Publish the API documentation"
task :pdoc => [:rdoc] do
2004-12-29 19:26:14 -05:00
Rake::SshDirPublisher.new("davidhh@comox.textdrive.com", "public_html/ap", "doc").upload
2004-11-23 20:04:44 -05:00
end
desc "Count lines in the main rake file"
task :lines do
lines = 0
codelines = 0
Dir.foreach("lib/action_controller") { |file_name|
next unless file_name =~ /.*rb/
f = File.open("lib/action_controller/" + file_name)
while line = f.gets
lines += 1
next if line =~ /^\s*$/
next if line =~ /^\s*#/
codelines += 1
end
}
puts "Lines #{lines}, LOC #{codelines}"
2005-01-10 17:58:06 -05:00
end