lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ehatc...@apache.org
Subject svn commit: r505107 - /lucene/solr/trunk/client/ruby/solrb/Rakefile
Date Fri, 09 Feb 2007 00:51:20 GMT
Author: ehatcher
Date: Thu Feb  8 16:51:19 2007
New Revision: 505107

URL: http://svn.apache.org/viewvc?view=rev&rev=505107
Log:
SOLR-150: Add rake task to easily package solrb for use in a Rails app's vendor directory

Modified:
    lucene/solr/trunk/client/ruby/solrb/Rakefile

Modified: lucene/solr/trunk/client/ruby/solrb/Rakefile
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/ruby/solrb/Rakefile?view=diff&rev=505107&r1=505106&r2=505107
==============================================================================
--- lucene/solr/trunk/client/ruby/solrb/Rakefile (original)
+++ lucene/solr/trunk/client/ruby/solrb/Rakefile Thu Feb  8 16:51:19 2007
@@ -62,6 +62,31 @@
   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")



Mime
View raw message