s3reamer 0.0.2 → 0.0.3
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.
- checksums.yaml +4 -4
- data/bin/s3reamer +23 -19
- data/lib/s3reamer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44cb148d5be1f3d30b47a839a447490c31f2f054
|
4
|
+
data.tar.gz: 81ac44c4a694bbedf5ba05fa520ec2457e1b8b38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 574f10b3d0a0a955574ed45f78d32665e19e8d4f6ecca277409fa2fc4800df1b596fc06de36c58d8ebaa7b9715099b1ff9827dbbdd578fc534494fb665b5a60a
|
7
|
+
data.tar.gz: 1b36d85b66f01033f1b32f87a1da047408e720573947b1c0ed79fee4db7e4474369da8b3c113414b2e9470e715557334ede336398c8ac49b0e0200bd89ddcd7e
|
data/bin/s3reamer
CHANGED
@@ -6,26 +6,9 @@ require 'aws-sdk'
|
|
6
6
|
require 's3reamer'
|
7
7
|
|
8
8
|
banner = "Usage: s3reamer DIRECTORY BUCKET_NAME [options]"
|
9
|
-
if ARGV.length < 2
|
10
|
-
$stderr.puts banner
|
11
|
-
exit 1
|
12
|
-
end
|
13
|
-
|
14
|
-
dir = ARGV.shift
|
15
|
-
if !File.exists?(dir)
|
16
|
-
$stderr.puts "Directory does not exist: #{dir}"
|
17
|
-
exit 1
|
18
|
-
elsif !File.directory?(dir)
|
19
|
-
$stderr.puts "Not a directory: #{dir}"
|
20
|
-
exit 1
|
21
|
-
end
|
22
|
-
|
23
|
-
bucket_name = ARGV.shift
|
24
9
|
|
25
10
|
options = {
|
26
11
|
region: 'us-east-1',
|
27
|
-
bucket_name: bucket_name,
|
28
|
-
directory: dir,
|
29
12
|
reader_timeout: 30,
|
30
13
|
reader_sleep_interval: 1,
|
31
14
|
pool_size: 4,
|
@@ -34,7 +17,7 @@ options = {
|
|
34
17
|
credentials_profile: 'default',
|
35
18
|
prefix: ''
|
36
19
|
}
|
37
|
-
OptionParser.new do |opts|
|
20
|
+
opts = OptionParser.new do |opts|
|
38
21
|
opts.banner = banner
|
39
22
|
|
40
23
|
opts.on("-r", "--region [AWS_REGION]") do |v|
|
@@ -75,7 +58,28 @@ OptionParser.new do |opts|
|
|
75
58
|
v = "#{v}/" unless v.end_with?("/")
|
76
59
|
options[:prefix] = v
|
77
60
|
end
|
78
|
-
end
|
61
|
+
end
|
62
|
+
|
63
|
+
if ARGV.length < 2
|
64
|
+
$stderr.puts opts
|
65
|
+
exit 1
|
66
|
+
end
|
67
|
+
|
68
|
+
dir = ARGV.shift
|
69
|
+
if !File.exists?(dir)
|
70
|
+
$stderr.puts "Directory does not exist: #{dir}"
|
71
|
+
exit 1
|
72
|
+
elsif !File.directory?(dir)
|
73
|
+
$stderr.puts "Not a directory: #{dir}"
|
74
|
+
exit 1
|
75
|
+
end
|
76
|
+
|
77
|
+
bucket_name = ARGV.shift
|
78
|
+
options = options.merge({
|
79
|
+
bucket_name: bucket_name,
|
80
|
+
directory: dir
|
81
|
+
})
|
82
|
+
opts.parse!
|
79
83
|
|
80
84
|
credentials = Aws::SharedCredentials.new(path: options[:credentials_file], profile_name: options[:credentials_profile])
|
81
85
|
s3 = Aws::S3::Resource.new(region: options[:region], credentials: credentials)
|
data/lib/s3reamer/version.rb
CHANGED