Guest User

Untitled

a guest
Apr 23rd, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. require 'rubygems'
  2. require 'fileutils'
  3. require 'zip/zip'
  4. require 'zip/zipfilesystem'
  5. require 'rubygems/command_manager'
  6.  
  7. # ...
  8. def gem_bundler(args)
  9. Gem.platforms = [Gem::Platform::RUBY,
  10. Gem::Platform.new('universal-java')]
  11. Gem.configuration = Gem::ConfigFile.new(args.unshift('bundle'))
  12. puts "=> Bundling gems"
  13. begin
  14. Gem::CommandManager.instance.run(Gem.configuration.args)
  15. rescue Gem::SystemExitException => e
  16. exit e.exit_code unless e.exit_code == 0
  17. end
  18. if !args.include?('--update') and File.exists?(app.gems_jar) and
  19. File.stat(app.gems_jar).mtime > File.stat(app.gemfile).mtime
  20. return
  21. end
  22. gem_files = Dir["#{app.gems_dir}/**/**"]
  23. FileUtils.rm app.gems_jar, :force => true # blow away the old jar
  24. puts "=> Installing gems"
  25. Zip::ZipFile.open(app.gems_jar, 'w') do |jar|
  26. gem_files.reject {|f| f == app.gems_jar}.each do |file|
  27. jar.add(file.sub("#{app.gems_dir}/",''), file)
  28. end
  29. end
  30. end
  31.  
  32. # ...
Add Comment
Please, Sign In to add comment