imw 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/imw/archives.rb +7 -0
- data/lib/imw/compressed_files.rb +7 -0
- data/lib/imw/formats/delimited.rb +15 -0
- data/lib/imw/schemes/hdfs.rb +2 -2
- data/lib/imw/schemes/local.rb +1 -1
- data/lib/imw/tools/summarizer.rb +8 -2
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.6
|
data/lib/imw/archives.rb
CHANGED
data/lib/imw/compressed_files.rb
CHANGED
@@ -71,6 +71,13 @@ module IMW
|
|
71
71
|
IMW.open(decompressed_path)
|
72
72
|
end
|
73
73
|
|
74
|
+
# Compressed files should not return snippets.
|
75
|
+
#
|
76
|
+
# @return [nil]
|
77
|
+
def snippet
|
78
|
+
nil
|
79
|
+
end
|
80
|
+
|
74
81
|
# Decompress this file in its present directory, overwriting any
|
75
82
|
# existing files while keeping the original compressed file.
|
76
83
|
#
|
@@ -45,6 +45,21 @@ module IMW
|
|
45
45
|
io.close unless options[:persist]
|
46
46
|
self
|
47
47
|
end
|
48
|
+
|
49
|
+
# Return a 10-line sample of this file.
|
50
|
+
#
|
51
|
+
# @return [Array<Array>]
|
52
|
+
def snippet
|
53
|
+
require 'fastercsv'
|
54
|
+
returning([]) do |rows|
|
55
|
+
row_num = 1
|
56
|
+
FasterCSV.new(io, delimited_options).each do |row|
|
57
|
+
break if row_num > 10
|
58
|
+
rows << row
|
59
|
+
row_num += 1
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
48
63
|
end
|
49
64
|
|
50
65
|
module Csv
|
data/lib/imw/schemes/hdfs.rb
CHANGED
@@ -27,7 +27,7 @@ module IMW
|
|
27
27
|
# @param [String, IMW::Resource] new_uri
|
28
28
|
# @return [IMW::Resource] the new resource
|
29
29
|
def cp new_uri
|
30
|
-
IMW::
|
30
|
+
IMW::Tools::Transferer.new(:cp, self, new_uri).transfer!
|
31
31
|
end
|
32
32
|
|
33
33
|
# Move this resource to the +new_uri+.
|
@@ -35,7 +35,7 @@ module IMW
|
|
35
35
|
# @param [String, IMW::Resource] new_uri
|
36
36
|
# @return [IMW::Resource] the new resource
|
37
37
|
def mv new_uri
|
38
|
-
IMW::
|
38
|
+
IMW::Tools::Transferer.new(:mv, self, new_uri).transfer!
|
39
39
|
end
|
40
40
|
|
41
41
|
# Delete this resource from the HDFS.
|
data/lib/imw/schemes/local.rb
CHANGED
data/lib/imw/tools/summarizer.rb
CHANGED
@@ -42,7 +42,13 @@ module IMW
|
|
42
42
|
#
|
43
43
|
# @return [Array<Hash>]
|
44
44
|
def summary
|
45
|
-
@summary ||= inputs.map
|
45
|
+
@summary ||= inputs.map do |input|
|
46
|
+
if input.respond_to?(:summary)
|
47
|
+
input.summary
|
48
|
+
else
|
49
|
+
{}
|
50
|
+
end
|
51
|
+
end
|
46
52
|
end
|
47
53
|
|
48
54
|
protected
|
@@ -58,7 +64,7 @@ module IMW
|
|
58
64
|
input.should_exist!("Cannot summarize.")
|
59
65
|
end
|
60
66
|
@resources = inputs.map do |input|
|
61
|
-
input.is_directory? ? input.all_resources : input
|
67
|
+
input.is_local? && input.is_directory? ? input.all_resources : input
|
62
68
|
end.compact.flatten
|
63
69
|
end
|
64
70
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dhruv Bansal
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2010-06-
|
13
|
+
date: 2010-06-15 00:00:00 -05:00
|
14
14
|
default_executable: imw
|
15
15
|
dependencies: []
|
16
16
|
|