s3cp 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,6 +1,11 @@
1
- === 0.2.6 / (Pending)
1
+ === 0.2.7 / (Pending)
2
2
 
3
- === 0.2.5 / (Pending)
3
+ === 0.2.6 / 2012-03-06
4
+
5
+ * Fixed: Possible division-by-zero error in s3du if it encounters
6
+ zero-length files.
7
+
8
+ === 0.2.5 / 2012-03-02
4
9
 
5
10
  * Added: "s3du" command to calculate disk usage.
6
11
  Supports --depth, --regex, --unit parameters and more!
data/README.md CHANGED
@@ -31,6 +31,7 @@ If you want to hack on s3cp and build the gem yourself, you will need Bundler (h
31
31
  s3cp local_file.bin s3://mybucket/some/path
32
32
  s3mod s3://mybucket/path/to/some/file.txt public-read
33
33
  s3stat s3://mybucket/path/to/some/file.txt
34
+ s3du --depth 2 --unit mb s3://mybucket/some/path/
34
35
 
35
36
  Use the `-h` option to learn about command-line options.
36
37
 
@@ -100,6 +101,16 @@ To install Bash completion for S3 URLs, add the following to ~/.bashrc:
100
101
  --tty TTY mode
101
102
  -h, --help Show this message
102
103
 
104
+ ---
105
+
106
+ $ s3du [path] # Display disk usage
107
+
108
+ --unit UNIT Force unit to use for file size display: B, KB, MB, GB, TB, EB, ZB, YB, BB.
109
+ --precision PRECISION Precision used to display sizes, e.g. 3 => 0.123GB. (default 0)
110
+ --depth DEPTH Depth to report space usage (default 0).
111
+ --regex REGEX Regular expression to match keys.
112
+ -h, --help Show this message
113
+
103
114
  ---
104
115
 
105
116
  $ s3mod
data/lib/s3cp/s3du.rb CHANGED
@@ -32,7 +32,7 @@ options[:depth] = 0
32
32
  options[:regex] = nil
33
33
 
34
34
  op = OptionParser.new do |opts|
35
- opts.banner = "s3ls [path]"
35
+ opts.banner = "s3du [path] # Display disk usage"
36
36
  opts.separator ''
37
37
 
38
38
  opts.on("--unit UNIT", "Force unit to use for file size display: #{S3CP::UNITS.join(', ')}.") do |unit|
data/lib/s3cp/utils.rb CHANGED
@@ -81,7 +81,7 @@ module S3CP
81
81
  num = num / 1024
82
82
  end
83
83
  else
84
- e = (Math.log(num) / Math.log(1024)).floor
84
+ e = (num == 0) ? 0 : (Math.log(num) / Math.log(1024)).floor
85
85
  s = "%0.#{precision}f" % round((num.to_f / 1024**e), precision)
86
86
  s + UNITS[e]
87
87
  end
data/lib/s3cp/version.rb CHANGED
@@ -16,5 +16,5 @@
16
16
  # the License.
17
17
 
18
18
  module S3CP
19
- VERSION = "0.2.5"
19
+ VERSION = "0.2.6"
20
20
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3cp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 5
10
- version: 0.2.5
9
+ - 6
10
+ version: 0.2.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alex Boisvert
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-03-02 00:00:00 Z
18
+ date: 2012-03-06 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  prerelease: false