Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'rubygems'
- require 'fileutils'
- require 'zip/zip'
- require 'zip/zipfilesystem'
- require 'rubygems/command_manager'
- # ...
- def gem_bundler(args)
- Gem.platforms = [Gem::Platform::RUBY,
- Gem::Platform.new('universal-java')]
- Gem.configuration = Gem::ConfigFile.new(args.unshift('bundle'))
- puts "=> Bundling gems"
- begin
- Gem::CommandManager.instance.run(Gem.configuration.args)
- rescue Gem::SystemExitException => e
- exit e.exit_code unless e.exit_code == 0
- end
- if !args.include?('--update') and File.exists?(app.gems_jar) and
- File.stat(app.gems_jar).mtime > File.stat(app.gemfile).mtime
- return
- end
- gem_files = Dir["#{app.gems_dir}/**/**"]
- FileUtils.rm app.gems_jar, :force => true # blow away the old jar
- puts "=> Installing gems"
- Zip::ZipFile.open(app.gems_jar, 'w') do |jar|
- gem_files.reject {|f| f == app.gems_jar}.each do |file|
- jar.add(file.sub("#{app.gems_dir}/",''), file)
- end
- end
- end
- # ...
Add Comment
Please, Sign In to add comment