2004-11-23 20:04:44 -05:00
|
|
|
require 'rake'
|
|
|
|
require 'rake/testtask'
|
|
|
|
require 'rake/rdoctask'
|
|
|
|
require 'rake/gempackagetask'
|
|
|
|
|
|
|
|
require 'date'
|
2005-01-01 13:10:10 -05:00
|
|
|
require 'rbconfig'
|
2004-11-23 20:04:44 -05:00
|
|
|
|
2010-04-26 11:25:07 -04:00
|
|
|
|
2007-09-25 21:24:07 -04:00
|
|
|
task :default => :test
|
2009-11-10 19:50:15 -05:00
|
|
|
task :test => 'test:isolated'
|
2007-09-25 21:24:07 -04:00
|
|
|
|
2006-11-01 22:34:03 -05:00
|
|
|
## This is required until the regular test task
|
|
|
|
## below passes. It's not ideal, but at least
|
|
|
|
## we can see the failures
|
2009-11-10 19:50:15 -05:00
|
|
|
namespace :test do
|
|
|
|
task :isolated do
|
|
|
|
dir = ENV["TEST_DIR"] || "**"
|
|
|
|
Dir["test/#{dir}/*_test.rb"].all? do |file|
|
|
|
|
next true if file.include?("fixtures")
|
|
|
|
ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
|
|
|
|
system(ruby, '-Itest', "-I#{File.dirname(__FILE__)}/../activesupport/lib", file)
|
|
|
|
end or raise "Failures"
|
|
|
|
end
|
2006-11-01 22:34:03 -05:00
|
|
|
end
|
|
|
|
|
2009-11-10 19:50:15 -05:00
|
|
|
Rake::TestTask.new('test:regular') do |t|
|
2009-04-22 19:10:49 -04:00
|
|
|
t.libs << 'test' << "#{File.dirname(__FILE__)}/../activesupport/lib"
|
2006-08-29 05:15:28 -04:00
|
|
|
t.pattern = 'test/**/*_test.rb'
|
|
|
|
t.warning = true
|
|
|
|
t.verbose = true
|
|
|
|
end
|
2005-07-12 22:12:00 -04:00
|
|
|
|
2009-07-02 05:47:03 -04:00
|
|
|
# Update spinoffs -------------------------------------------------------------------
|
2005-07-02 02:23:35 -04:00
|
|
|
|
2009-07-02 05:47:03 -04:00
|
|
|
desc "Updates application README to the latest version Railties README"
|
|
|
|
task :update_readme do
|
2010-03-23 10:40:04 -04:00
|
|
|
readme = "lib/rails/generators/rails/app/templates/README"
|
2009-07-02 05:47:03 -04:00
|
|
|
rm readme
|
|
|
|
cp "./README", readme
|
|
|
|
end
|
|
|
|
|
2009-02-05 20:57:02 -05:00
|
|
|
desc 'Generate guides (for authors), use ONLY=foo to process just "foo.textile"'
|
2009-05-16 11:02:43 -04:00
|
|
|
task :generate_guides do
|
2009-03-24 08:15:43 -04:00
|
|
|
ENV["WARN_BROKEN_LINKS"] = "1" # authors can't disable this
|
2009-02-05 20:57:02 -05:00
|
|
|
ruby "guides/rails_guides.rb"
|
|
|
|
end
|
|
|
|
|
2010-01-30 20:20:49 -05:00
|
|
|
task :update_prototype_ujs do
|
2010-03-23 10:40:04 -04:00
|
|
|
system "curl http://github.com/rails/prototype-ujs/raw/master/src/rails.js > lib/rails/generators/rails/app/templates/public/javascripts/rails.js"
|
2010-01-30 20:20:49 -05:00
|
|
|
end
|
|
|
|
|
2004-11-23 20:04:44 -05:00
|
|
|
# Generate documentation ------------------------------------------------------------------
|
|
|
|
|
2005-10-15 23:00:44 -04:00
|
|
|
Rake::RDocTask.new { |rdoc|
|
|
|
|
rdoc.rdoc_dir = 'doc'
|
|
|
|
rdoc.title = "Railties -- Gluing the Engine to the Rails"
|
2006-02-18 19:43:10 -05:00
|
|
|
rdoc.options << '--line-numbers' << '--inline-source' << '--accessor' << 'cattr_accessor=object'
|
2007-05-28 18:55:14 -04:00
|
|
|
rdoc.options << '--charset' << 'utf-8'
|
2008-06-22 13:38:25 -04:00
|
|
|
rdoc.template = ENV['template'] ? "#{ENV['template']}.rb" : '../doc/template/horo'
|
2005-10-15 23:00:44 -04:00
|
|
|
rdoc.rdoc_files.include('README', 'CHANGELOG')
|
2010-03-29 00:10:42 -04:00
|
|
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
|
|
rdoc.rdoc_files.exclude('lib/rails/generators/**/templates/*')
|
2005-10-15 23:00:44 -04:00
|
|
|
}
|
2004-11-23 20:04:44 -05:00
|
|
|
|
|
|
|
# Generate GEM ----------------------------------------------------------------------------
|
|
|
|
|
2009-11-30 19:46:09 -05:00
|
|
|
spec = eval(File.read('railties.gemspec'))
|
2004-11-23 20:04:44 -05:00
|
|
|
|
|
|
|
Rake::GemPackageTask.new(spec) do |pkg|
|
2006-09-15 05:56:52 -04:00
|
|
|
pkg.gem_spec = spec
|
2004-11-23 20:04:44 -05:00
|
|
|
end
|
|
|
|
|
2005-03-27 08:33:54 -05:00
|
|
|
# Publishing -------------------------------------------------------
|
2009-12-29 06:19:38 -05:00
|
|
|
|
2010-02-04 21:28:45 -05:00
|
|
|
desc "Release to gemcutter"
|
2010-02-05 03:03:03 -05:00
|
|
|
task :release => :package do
|
|
|
|
require 'rake/gemcutter'
|
|
|
|
Rake::Gemcutter::Tasks.new(spec).define
|
|
|
|
Rake::Task['gem:push'].invoke
|
|
|
|
end
|
2005-03-27 08:33:54 -05:00
|
|
|
|
2009-03-05 06:20:00 -05:00
|
|
|
desc "Publish the guides"
|
2009-05-16 11:02:43 -04:00
|
|
|
task :pguides => :generate_guides do
|
2009-05-12 17:21:29 -04:00
|
|
|
require 'rake/contrib/sshpublisher'
|
2009-03-05 06:20:00 -05:00
|
|
|
mkdir_p 'pkg'
|
|
|
|
`tar -czf pkg/guides.gz guides/output`
|
|
|
|
Rake::SshFilePublisher.new("web.rubyonrails.org", "/u/sites/guides.rubyonrails.org/public", "pkg", "guides.gz").upload
|
|
|
|
`ssh web.rubyonrails.org 'cd /u/sites/guides.rubyonrails.org/public/ && tar -xvzf guides.gz && mv guides/output/* . && rm -rf guides*'`
|
2008-06-18 23:34:15 -04:00
|
|
|
end
|