lib/packer.rb in mandy-0.4.92 vs lib/packer.rb in mandy-0.4.93

- old
+ new

@@ -1,22 +1,20 @@ require "fileutils" module Mandy class Packer TMP_DIR = '/tmp/mandy' + MANDY_DIR = File.expand_path(File.join(File.dirname(__FILE__), '..')) - def self.pack(script, dir, gemfile) + def self.pack(script, dir, gemfile=nil) tmp_path = "#{TMP_DIR}/packed-job-#{Time.now.to_i}" FileUtils.mkdir_p(tmp_path) to_be_copied = File.file?(dir) ? dir : File.join(dir, '*') - FileUtils.cp_r(script, tmp_path) + FileUtils.cp(script, tmp_path) FileUtils.cp_r(Dir.glob(to_be_copied), tmp_path) - FileUtils.cp_r(gemfile, tmp_path) - Dir.chdir(tmp_path) do - `gem bundle` - `rm -r vendor/gems/gems` - `tar -cf bundle.tar *` - end + FileUtils.cp(File.join(MANDY_DIR, 'geminstaller.yml'), tmp_path) + FileUtils.cp(gemfile, File.join(tmp_path, 'gems.yml')) if gemfile and File.exists?(gemfile) + Dir.chdir(tmp_path) { `tar -cf bundle.tar *` } File.join(tmp_path, 'bundle.tar') end def self.cleanup!(file) return false unless File.extname(file) == '.tar' \ No newline at end of file