lib/appengine-tools/gem_bundler.rb in appengine-tools-0.0.10.1 vs lib/appengine-tools/gem_bundler.rb in appengine-tools-0.0.11
- old
+ new
@@ -74,24 +74,36 @@
bundler_dir = "#{app.gems_dir}/bundler_gems"
target_pair = "#{TARGET_ENGINE}/#{TARGET_VERSION}"
gem_patch = "require 'bundler_gems/#{target_pair}/environment'"
File.open("#{bundler_dir}/environment.rb",'w') {|f| f << gem_patch }
FileUtils.rm app.gems_jar, :force => true # blow away the old jar
+ # cleanup old extension jars
+ if File.exists? app.bundled_jars
+ YAML.load_file(app.bundled_jars).each do |jar|
+ FileUtils.rm File.join(app.webinf_lib, jar), :force => true
+ end
+ else
+ stale = 'jruby-rack-0.9.6.jar'
+ FileUtils.rm File.join(app.webinf_lib, stale), :force => true
+ end
+ jars = []
puts "=> Packaging gems"
gem_files = Dir["#{bundler_dir}/#{target_pair}/dirs/**/**"] +
Dir["#{bundler_dir}/#{target_pair}/gems/**/**"] +
Dir["#{bundler_dir}/#{target_pair}/environment.rb"] +
Dir["#{bundler_dir}/environment.rb"]
Zip::ZipFile.open(app.gems_jar, 'w') do |jar|
gem_files.reject {|f| f == app.gems_jar}.each do |file|
if file[-4..-1].eql? '.jar'
puts "Installing #{File.basename(file)}"
FileUtils.cp file, app.webinf_lib
+ jars << File.basename(file)
else
jar.add(file.sub("#{app.gems_dir}/",''), file)
end
end
end
+ open(app.bundled_jars, 'w') { |f| YAML.dump(jars, f) }
end
def verify_gemfile
return if File.exists?(app.gemfile)
puts "=> Generating gemfile"