SOLR-150: Add rake task to easily package solrb for use in a Rails app's vendor directory

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@505107 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Erik Hatcher 2007-02-09 00:51:19 +00:00
parent cf8186165b
commit 4ac217681f
1 changed files with 25 additions and 0 deletions

View File

@ -62,6 +62,31 @@ Rake::GemPackageTask.new(spec) do |pkg|
pkg.need_tar = true
end
namespace :package do
desc "Package solrb for use in Rails' /vendor directory. Takes an optional DIR parameter which is the root of the Rails app you'd like to package this for."
task :vendor do
require "fileutils"
current_dir = File.dirname(__FILE__)
vendor_dir = File.join(ENV["DIR"] || File.join(current_dir, "pkg"), "vendor")
solr_dir = File.join(vendor_dir, "solr")
File.makedirs(solr_dir)
Dir.glob(File.join(current_dir, "lib", "**", "*")).each do |d|
new_d = d.gsub(File.join(current_dir, "lib"), vendor_dir)
if File.directory?(d)
File.makedirs(new_d)
elsif d =~ /solr\.rb$/
File.cp(d, File.join(solr_dir, "solr.rb"))
elsif d !~ /.svn/
File.cp(d, new_d)
end
end
end
end
desc "Generate rdoc documentation"
Rake::RDocTask.new('doc') do |rd|
rd.rdoc_files.include("lib/**/*.rb")