mandy 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/mandy-hadoop +1 -1
- data/bootstrap.rb +0 -15
- data/lib/packer.rb +2 -6
- metadata +1 -1
data/bin/mandy-hadoop
CHANGED
@@ -51,7 +51,7 @@ input = ARGV[1]
|
|
51
51
|
output_folder = ARGV[2]
|
52
52
|
config = options.config || 'cluster.xml'
|
53
53
|
puts "Packaging Gems for distribution..."
|
54
|
-
payload = Mandy::Packer.pack(options.payload || ARGV[0], gemfile(options.gemfile))
|
54
|
+
payload = Mandy::Packer.pack(file, options.payload || ARGV[0], gemfile(options.gemfile))
|
55
55
|
cmdenv = options.cmdenv
|
56
56
|
|
57
57
|
at_exit do
|
data/bootstrap.rb
CHANGED
@@ -2,25 +2,10 @@ require "fileutils"
|
|
2
2
|
|
3
3
|
module Mandy
|
4
4
|
class Packer
|
5
|
-
TMP_DIR = '/tmp/mandy'
|
6
|
-
|
7
|
-
def self.pack(dir)
|
8
|
-
return dir if File.file?(dir)
|
9
|
-
FileUtils.mkdir_p(TMP_DIR)
|
10
|
-
tmp_path = "#{TMP_DIR}/packed-job-#{Time.now.to_i}.tar"
|
11
|
-
Dir.chdir(dir) { `tar -cf #{tmp_path} *` }
|
12
|
-
tmp_path
|
13
|
-
end
|
14
|
-
|
15
5
|
def self.unpack(file)
|
16
6
|
return false unless File.extname(file) == '.tar'
|
17
7
|
`tar -xf #{file}`
|
18
8
|
end
|
19
|
-
|
20
|
-
def self.cleanup!(file)
|
21
|
-
return false unless File.extname(file) == '.tar'
|
22
|
-
`rm #{file}`
|
23
|
-
end
|
24
9
|
end
|
25
10
|
end
|
26
11
|
|
data/lib/packer.rb
CHANGED
@@ -4,10 +4,11 @@ module Mandy
|
|
4
4
|
class Packer
|
5
5
|
TMP_DIR = '/tmp/mandy'
|
6
6
|
|
7
|
-
def self.pack(dir, gemfile)
|
7
|
+
def self.pack(script, dir, gemfile)
|
8
8
|
tmp_path = "#{TMP_DIR}/packed-job-#{Time.now.to_i}"
|
9
9
|
FileUtils.mkdir_p(tmp_path)
|
10
10
|
to_be_copied = File.file?(dir) ? dir : File.join(dir, '*')
|
11
|
+
FileUtils.cp_r(script, tmp_path)
|
11
12
|
FileUtils.cp_r(Dir.glob(to_be_copied), tmp_path)
|
12
13
|
FileUtils.cp_r(gemfile, tmp_path)
|
13
14
|
Dir.chdir(tmp_path) { `gem bundle` }
|
@@ -15,11 +16,6 @@ module Mandy
|
|
15
16
|
File.join(tmp_path, 'bundle.tar')
|
16
17
|
end
|
17
18
|
|
18
|
-
def self.unpack(file)
|
19
|
-
return false unless File.extname(file) == '.tar'
|
20
|
-
`tar -xf #{file}`
|
21
|
-
end
|
22
|
-
|
23
19
|
def self.cleanup!(file)
|
24
20
|
return false unless File.extname(file) == '.tar'
|
25
21
|
`rm #{file}`
|