lib/warbler/task.rb in nicksieger-warbler-0.9.12 vs lib/warbler/task.rb in nicksieger-warbler-0.9.13
- old
+ new
@@ -1,7 +1,7 @@
#--
-# (c) Copyright 2007-2008 Sun Microsystems, Inc.
+# (c) Copyright 2007-2009 Sun Microsystems, Inc.
# See the file LICENSES.txt included with the distribution for
# software license details.
#++
require 'rake'
@@ -225,11 +225,15 @@
define_file_task(f, "#{@config.staging_dir}/#{apply_pathmaps(f, :public_html)}")
end
end
def define_webinf_file_tasks
- target_files = @config.dirs.map do |d|
+ target_files = @config.dirs.select do |d|
+ exists = File.directory?(d)
+ warn "warning: application directory `#{d}' does not exist or is not a directory; skipping" unless exists
+ exists
+ end.map do |d|
define_file_task(d, "#{@config.staging_dir}/#{apply_pathmaps(d, :application)}")
end
files = FileList[*(@config.dirs.map{|d| "#{d}/**/*"})]
files.include *(@config.includes.to_a)
files.exclude *(@config.excludes.to_a)
@@ -290,10 +294,13 @@
matched = Gem.source_index.search(gem)
fail "gem '#{gem}' not installed" if matched.empty?
spec = matched.last
+ # skip gems with no load path
+ return if spec.loaded_from == ""
+
gem_name = "#{spec.name}-#{spec.version}"
unless spec.platform.nil? || spec.platform == Gem::Platform::RUBY
[spec.platform, spec.original_platform].each do |p|
name = "#{gem_name}-#{p}"
if File.exist?(File.join(Gem.dir, 'cache', "#{name}.gem"))
@@ -316,10 +323,10 @@
src = File.join(Gem.dir, 'cache', "#{gem_name}.gem")
dest = "#{config.staging_dir}/#{apply_pathmaps(src, :gems)}"
task gem_unpack_task_name => [dest.pathmap("%d")] do |t|
require 'rubygems/installer'
- Gem::Installer.new(src).unpack(dest)
+ Gem::Installer.new(src, :unpack => true).unpack(dest)
end
if @config.gem_dependencies
spec.dependencies.each do |dep|
define_single_gem_tasks(dep, targets)