You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by eh...@apache.org on 2007/02/09 22:01:19 UTC

svn commit: r505499 - /lucene/solr/trunk/client/ruby/solrb/Rakefile

Author: ehatcher
Date: Fri Feb  9 13:01:18 2007
New Revision: 505499

URL: http://svn.apache.org/viewvc?view=rev&rev=505499
Log:
SOLR-154: Updated tasks to package Rails vendor/plugins structure

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=505499&r1=505498&r2=505499
==============================================================================
--- lucene/solr/trunk/client/ruby/solrb/Rakefile (original)
+++ lucene/solr/trunk/client/ruby/solrb/Rakefile Fri Feb  9 13:01:18 2007
@@ -57,11 +57,40 @@
   s.has_rdoc = true
 end
 
-Rake::GemPackageTask.new(spec) do |pkg|
-  pkg.need_zip = true
-  pkg.need_tar = true
+namespace :gem do
+  Rake::GemPackageTask.new(spec) do |pkg|
+    pkg.need_zip = true
+    pkg.need_tar = true
+    pkg.package_dir = "pkg/gem"
+  end
 end
 
+namespace :rails do
+  desc "Creates rails plugin structure and distributable packages. init.rb is created and removed on the fly."
+  task :package => "init.rb" do
+    File.rm_f("init.rb")
+  end
+  Rake::PackageTask.new("solrb-rails", SOLRB_VERSION) do |pkg|
+    pkg.need_zip = true
+    pkg.need_tar = true
+    pkg.package_dir = "pkg/rails"
+    pkg.package_files.include("lib/**/*.rb", "test/unit/**/*.rb", "init.rb", "LICENSE.txt", "README")
+  end
+  
+  file "init.rb" do
+    open("init.rb", "w") do |file|
+      file.puts LICENSE
+      file.puts "require 'solr.rb'"
+    end
+  end
+  
+end
+
+task :package => ["rails:package", "gem:package"]
+task :repackage => [:clobber_package, :package]
+task :clobber_package => ["rails:clobber_package", "gem:clobber_package"] do rm_r "pkg" rescue nil end
+task :clobber => [:clobber_package]
+
 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
@@ -70,7 +99,8 @@
     current_dir = File.dirname(__FILE__)
     
     vendor_dir = File.join(ENV["DIR"] || File.join(current_dir, "pkg"), "vendor")
-    solr_dir = File.join(vendor_dir, "solr")
+    lib_dir = File.join(vendor_dir, "lib")
+    solr_dir = File.join(vendor_dir, "lib/solr")
     File.makedirs(solr_dir)
     
     Dir.glob(File.join(current_dir, "lib", "**", "*")).each do |d|
@@ -157,3 +187,15 @@
   egrep /#.*(FIXME|TODO|TBD)/
 end
 
+LICENSE = <<STR
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+STR
\ No newline at end of file