2006-06-25 10:44:22 -04:00
|
|
|
require 'rubygems'
|
|
|
|
require 'rake'
|
|
|
|
require 'rake/testtask'
|
|
|
|
require 'rake/rdoctask'
|
|
|
|
require 'rake/packagetask'
|
|
|
|
require 'rake/gempackagetask'
|
2008-03-18 00:46:51 -04:00
|
|
|
|
2006-06-25 10:44:22 -04:00
|
|
|
desc "Default Task"
|
|
|
|
task :default => [ :test ]
|
|
|
|
|
|
|
|
# Run the unit tests
|
|
|
|
|
|
|
|
Rake::TestTask.new { |t|
|
|
|
|
t.libs << "test"
|
2006-09-04 05:49:33 -04:00
|
|
|
t.pattern = 'test/**/*_test.rb'
|
|
|
|
t.warning = true
|
2006-06-25 10:44:22 -04:00
|
|
|
}
|
2009-09-05 20:24:43 -04:00
|
|
|
|
2009-11-10 19:50:15 -05:00
|
|
|
namespace :test do
|
|
|
|
task :isolated do
|
|
|
|
ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
|
|
|
|
activesupport_path = "#{File.dirname(__FILE__)}/../activesupport/lib"
|
|
|
|
Dir.glob("test/**/*_test.rb").all? do |file|
|
|
|
|
system(ruby, '-w', "-Ilib:test:#{activesupport_path}", file)
|
|
|
|
end or raise "Failures"
|
|
|
|
end
|
2009-05-13 04:10:37 -04:00
|
|
|
end
|
2006-06-25 10:44:22 -04:00
|
|
|
|
|
|
|
# Generate the RDoc documentation
|
|
|
|
|
|
|
|
Rake::RDocTask.new { |rdoc|
|
|
|
|
rdoc.rdoc_dir = 'doc'
|
|
|
|
rdoc.title = "Active Resource -- Object-oriented REST services"
|
|
|
|
rdoc.options << '--line-numbers' << '--inline-source' << '-A 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'
|
2006-12-19 09:59:30 -05:00
|
|
|
rdoc.rdoc_files.include('README', 'CHANGELOG')
|
2006-06-25 10:44:22 -04:00
|
|
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
2008-06-18 23:12:25 -04:00
|
|
|
rdoc.rdoc_files.exclude('lib/activeresource.rb')
|
2006-06-25 10:44:22 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-25 01:46:04 -04:00
|
|
|
spec = eval(File.read('activeresource.gemspec'))
|
|
|
|
|
2006-06-25 10:44:22 -04:00
|
|
|
Rake::GemPackageTask.new(spec) do |p|
|
|
|
|
p.gem_spec = spec
|
|
|
|
end
|
|
|
|
|
|
|
|
task :lines do
|
|
|
|
lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
|
|
|
|
|
2007-04-23 14:55:54 -04:00
|
|
|
for file_name in FileList["lib/active_resource/**/*.rb"]
|
2006-06-25 10:44:22 -04:00
|
|
|
next if file_name =~ /vendor/
|
|
|
|
f = File.open(file_name)
|
|
|
|
|
|
|
|
while line = f.gets
|
|
|
|
lines += 1
|
|
|
|
next if line =~ /^\s*$/
|
|
|
|
next if line =~ /^\s*#/
|
|
|
|
codelines += 1
|
|
|
|
end
|
|
|
|
puts "L: #{sprintf("%4d", lines)}, LOC #{sprintf("%4d", codelines)} | #{file_name}"
|
2009-10-16 14:56:59 -04:00
|
|
|
|
2006-06-25 10:44:22 -04:00
|
|
|
total_lines += lines
|
|
|
|
total_codelines += codelines
|
2009-10-16 14:56:59 -04:00
|
|
|
|
2006-06-25 10:44:22 -04:00
|
|
|
lines, codelines = 0, 0
|
|
|
|
end
|
|
|
|
|
|
|
|
puts "Total: Lines #{total_lines}, LOC #{total_codelines}"
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# Publishing ------------------------------------------------------
|
|
|
|
|
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
|
2006-06-25 10:44:22 -04:00
|
|
|
|
|
|
|
desc "Publish the API documentation"
|
2009-10-16 14:56:59 -04:00
|
|
|
task :pdoc => [:rdoc] do
|
2009-05-07 21:27:50 -04:00
|
|
|
require 'rake/contrib/sshpublisher'
|
2008-06-18 22:56:22 -04:00
|
|
|
Rake::SshDirPublisher.new("wrath.rubyonrails.org", "public_html/ar", "doc").upload
|
2006-06-25 10:44:22 -04:00
|
|
|
end
|