mandy 0.5.9 → 0.5.10
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/mandy +2 -18
- data/bin/mandy-cat +6 -0
- data/bin/mandy-cp +5 -0
- data/bin/mandy-exists +5 -0
- data/bin/mandy-get +5 -0
- data/bin/mandy-hadoop +5 -0
- data/bin/mandy-install +5 -0
- data/bin/mandy-kill +5 -0
- data/bin/mandy-local +5 -0
- data/bin/mandy-map +2 -0
- data/bin/mandy-mkdir +5 -0
- data/bin/mandy-mv +5 -0
- data/bin/mandy-put +5 -0
- data/bin/mandy-reduce +2 -0
- data/bin/mandy-rm +20 -1
- data/lib/mandy.rb +3 -0
- data/lib/mandy/configuration/hadoop_configuration.rb +28 -0
- metadata +3 -6
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.10
|
data/bin/mandy
CHANGED
@@ -2,24 +2,8 @@
|
|
2
2
|
require "rubygems"
|
3
3
|
require "mandy"
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
if hadoop_home== ''
|
9
|
-
puts "You need to set the HADOOP_HOME environment variable to point to your hadoop install :("
|
10
|
-
puts "Try setting 'export HADOOP_HOME=/my/hadoop/path' in your ~/.profile maybe?"
|
11
|
-
exit(1)
|
12
|
-
end
|
13
|
-
|
14
|
-
# Hadoop Version Detection
|
15
|
-
hadoop_version = `$HADOOP_HOME/bin/hadoop version 2>&1`
|
16
|
-
|
17
|
-
if hadoop_version =~ /No such file or directory/
|
18
|
-
puts("Mandy failed to find Hadoop in #{hadoop_home} :(")
|
19
|
-
puts
|
20
|
-
puts hadoop_version
|
21
|
-
exit(1)
|
22
|
-
end
|
5
|
+
hadoop_home = HadoopConfiguration.check_home
|
6
|
+
hadoop_version = HadoopConfiguration.check_version
|
23
7
|
|
24
8
|
# Status & Help Message
|
25
9
|
puts "\nYou are running Mandy!"
|
data/bin/mandy-cat
CHANGED
data/bin/mandy-cp
CHANGED
data/bin/mandy-exists
CHANGED
data/bin/mandy-get
CHANGED
data/bin/mandy-hadoop
CHANGED
data/bin/mandy-install
CHANGED
data/bin/mandy-kill
CHANGED
data/bin/mandy-local
CHANGED
data/bin/mandy-map
CHANGED
data/bin/mandy-mkdir
CHANGED
data/bin/mandy-mv
CHANGED
data/bin/mandy-put
CHANGED
data/bin/mandy-reduce
CHANGED
data/bin/mandy-rm
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
require 'optparse'
|
3
3
|
require 'ostruct'
|
4
4
|
|
5
|
+
require "rubygems"
|
6
|
+
require "mandy"
|
7
|
+
|
8
|
+
HadoopConfiguration.check_home_and_version
|
9
|
+
|
5
10
|
exec('mandy-rm -h') unless ARGV.size >= 1
|
6
11
|
|
7
12
|
|
@@ -13,7 +18,11 @@ OptionParser.new do |opts|
|
|
13
18
|
opts.on("-c", "--conf HADOOP_CONF", "Use this cluster xml config file.") do |config|
|
14
19
|
options.config = config
|
15
20
|
end
|
16
|
-
|
21
|
+
|
22
|
+
opts.on("-f", "--force", "Use this paramter to force deletion of a relative folder, root folder or 1st level folder (like /home or /tmp)") do
|
23
|
+
options.force = true
|
24
|
+
end
|
25
|
+
|
17
26
|
opts.on_tail("-h", "--help", "Show this message") do
|
18
27
|
puts opts
|
19
28
|
exit
|
@@ -23,4 +32,14 @@ end.parse!
|
|
23
32
|
file = ARGV[0]
|
24
33
|
config = options.config || 'cluster.xml'
|
25
34
|
|
35
|
+
if !options.force and file =~ /^[^\/]/
|
36
|
+
puts "mandy-rm: Cowardly refusing to delete a relative folder. Use -f parameter to force command."
|
37
|
+
exit
|
38
|
+
end
|
39
|
+
|
40
|
+
if !options.force and File.expand_path(file).split("/").size <= 2
|
41
|
+
puts "mandy-rm: Cowardly refusing to delete a root or 1st level folder. Use -f parameter to force command."
|
42
|
+
exit
|
43
|
+
end
|
44
|
+
|
26
45
|
`$HADOOP_HOME/bin/hadoop fs -conf #{config} -rmr #{file}`
|
data/lib/mandy.rb
CHANGED
@@ -10,6 +10,7 @@ require "fileutils"
|
|
10
10
|
dsl
|
11
11
|
job
|
12
12
|
packer
|
13
|
+
configuration/hadoop_configuration
|
13
14
|
support/tuple
|
14
15
|
support/array_serializer
|
15
16
|
support/hdfs_location
|
@@ -30,6 +31,8 @@ require "fileutils"
|
|
30
31
|
errors
|
31
32
|
).each {|file| require File.join(File.dirname(__FILE__), 'mandy', file) }
|
32
33
|
|
34
|
+
include HadoopConfiguration
|
35
|
+
|
33
36
|
module Mandy
|
34
37
|
class << self
|
35
38
|
attr_accessor :local_input
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module HadoopConfiguration
|
2
|
+
def check_home
|
3
|
+
hadoop_home = `echo $HADOOP_HOME`.chomp
|
4
|
+
if hadoop_home== ''
|
5
|
+
puts "You need to set the HADOOP_HOME environment variable to point to your hadoop install :("
|
6
|
+
puts "Try setting 'export HADOOP_HOME=/my/hadoop/path' in your ~/.profile maybe?"
|
7
|
+
exit(1)
|
8
|
+
end
|
9
|
+
hadoop_home
|
10
|
+
end
|
11
|
+
|
12
|
+
def check_version
|
13
|
+
hadoop_version = `$HADOOP_HOME/bin/hadoop version 2>&1`
|
14
|
+
|
15
|
+
if hadoop_version =~ /No such file or directory/
|
16
|
+
puts("Mandy failed to find Hadoop in #{check_home} :(")
|
17
|
+
puts
|
18
|
+
puts hadoop_version
|
19
|
+
exit(1)
|
20
|
+
end
|
21
|
+
hadoop_version
|
22
|
+
end
|
23
|
+
|
24
|
+
def check_home_and_version
|
25
|
+
check_home
|
26
|
+
check_version
|
27
|
+
end
|
28
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mandy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 25
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
8
|
+
- 10
|
9
|
+
version: 0.5.10
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Andy Kent
|
@@ -27,7 +26,6 @@ dependencies:
|
|
27
26
|
requirements:
|
28
27
|
- - ">="
|
29
28
|
- !ruby/object:Gem::Version
|
30
|
-
hash: 3
|
31
29
|
segments:
|
32
30
|
- 0
|
33
31
|
version: "0"
|
@@ -78,6 +76,7 @@ files:
|
|
78
76
|
- geminstaller.yml
|
79
77
|
- lib/mandy.rb
|
80
78
|
- lib/mandy/errors.rb
|
79
|
+
- lib/mandy/configuration/hadoop_configuration.rb
|
81
80
|
- lib/mandy/support/tuple.rb
|
82
81
|
- lib/mandy/support/formatting.rb
|
83
82
|
- lib/mandy/support/array_serializer.rb
|
@@ -118,7 +117,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
118
117
|
requirements:
|
119
118
|
- - ">="
|
120
119
|
- !ruby/object:Gem::Version
|
121
|
-
hash: 3
|
122
120
|
segments:
|
123
121
|
- 0
|
124
122
|
version: "0"
|
@@ -127,7 +125,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
125
|
requirements:
|
128
126
|
- - ">="
|
129
127
|
- !ruby/object:Gem::Version
|
130
|
-
hash: 3
|
131
128
|
segments:
|
132
129
|
- 0
|
133
130
|
version: "0"
|