Apache Lucene open-source search software
SOLR-154: Updated tasks to package Rails vendor/plugins structure
Erik Hatcherb4ed197ef1ec
diff --git a/client/ruby/solrb/Rakefile b/client/ruby/solrb/Rakefileindex a7f59e0da1b..f69a93fc118 100644--- a/client/ruby/solrb/Rakefile+++ b/client/ruby/solrb/Rakefile@@ -57,11 +57,40 @@ spec = Gem::Specification.new do |s|s.has_rdoc = trueend-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 dodesc "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 @@ namespace :package docurrent_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 @@ task :todo doegrep /#.*(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