mandy 0.4.89 → 0.4.90

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.
Files changed (5) hide show
  1. data/Rakefile +1 -4
  2. data/bin/mandy-cat +30 -0
  3. data/bootstrap.rb +0 -1
  4. data/lib/packer.rb +2 -5
  5. metadata +3 -11
data/Rakefile CHANGED
@@ -10,11 +10,8 @@ Spec::Rake::SpecTask.new(:spec) do |t|
10
10
  t.spec_opts = %w{-f s -c -L mtime}
11
11
  end
12
12
 
13
- task :build do
13
+ task :gem do
14
14
  `sudo gem build mandy.gemspec`
15
15
  `mkdir pkg; mv mandy-*.gem pkg/`
16
- end
17
-
18
- task :gem => :build do
19
16
  `sudo gem install pkg/mandy-*.gem`
20
17
  end
data/bin/mandy-cat ADDED
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+ require 'optparse'
3
+ require 'ostruct'
4
+
5
+ exec('mandy-cat -h') unless ARGV.size >= 2
6
+
7
+ options = OpenStruct.new
8
+
9
+ OptionParser.new do |opts|
10
+ opts.banner = "USAGE: mandy-cat hdfs_path [options]"
11
+
12
+ opts.on("-c", "--conf HADOOP_CONF", "Use this cluster xml config file.") do |config|
13
+ options.config = config
14
+ end
15
+
16
+ opts.on_tail("-h", "--help", "Show this message") do
17
+ puts opts
18
+ exit
19
+ end
20
+ end.parse!
21
+
22
+
23
+ def absolute_path(path)
24
+ path =~ /^\// ? path : File.join(Dir.pwd, path)
25
+ end
26
+
27
+ hdfs_path = ARGV[0]
28
+ config = absolute_path(options.config || 'cluster.xml')
29
+
30
+ exec("$HADOOP_HOME/bin/hadoop fs -conf #{config} -cat #{hdfs_path}")
data/bootstrap.rb CHANGED
@@ -5,7 +5,6 @@ module Mandy
5
5
  def self.unpack(file)
6
6
  return false unless File.extname(file) == '.tar'
7
7
  `tar -xf #{file}`
8
- `gem bundle --cached`
9
8
  end
10
9
  end
11
10
  end
data/lib/packer.rb CHANGED
@@ -11,11 +11,8 @@ module Mandy
11
11
  FileUtils.cp_r(script, tmp_path)
12
12
  FileUtils.cp_r(Dir.glob(to_be_copied), tmp_path)
13
13
  FileUtils.cp_r(gemfile, tmp_path)
14
- Dir.chdir(tmp_path) do
15
- `gem bundle`
16
- `rm -rf vendor/gems/gems`
17
- `tar -cf bundle.tar *`
18
- end
14
+ Dir.chdir(tmp_path) { `gem bundle` }
15
+ Dir.chdir(tmp_path) { `tar -cf bundle.tar *` }
19
16
  File.join(tmp_path, 'bundle.tar')
20
17
  end
21
18
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mandy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.89
4
+ version: 0.4.90
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Kent
@@ -23,16 +23,6 @@ dependencies:
23
23
  - !ruby/object:Gem::Version
24
24
  version: "0"
25
25
  version:
26
- - !ruby/object:Gem::Dependency
27
- name: json
28
- type: :runtime
29
- version_requirement:
30
- version_requirements: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: "0"
35
- version:
36
26
  description: Map/Reduce
37
27
  email: andy.kent@me.com
38
28
  executables:
@@ -42,6 +32,7 @@ executables:
42
32
  - mandy-map
43
33
  - mandy-put
44
34
  - mandy-get
35
+ - mandy-cat
45
36
  - mandy-reduce
46
37
  - mandy-rm
47
38
  - mandy-mv
@@ -58,6 +49,7 @@ files:
58
49
  - bin/mandy-local
59
50
  - bin/mandy-map
60
51
  - bin/mandy-get
52
+ - bin/mandy-cat
61
53
  - bin/mandy-put
62
54
  - bin/mandy-reduce
63
55
  - readme.md