SOLR-154: Updated tasks to package Rails vendor/plugins structure

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@505499 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Erik Hatcher 2007-02-09 21:01:18 +00:00
parent b5a9abd793
commit b4ed197ef1
1 changed files with 46 additions and 4 deletions

View File

@ -57,11 +57,40 @@ spec = Gem::Specification.new do |s|
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 @@ namespace :package do
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 @@ task :todo do
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