elastic-backup-2s3 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 47eee9a9335bffd0b8bab48968951cdc083e2681
4
- data.tar.gz: f7fd70416ea1b88a132cb96a4bdf3a02beadf151
3
+ metadata.gz: 2a7912acef5681f663794fdb260b5435edfbc883
4
+ data.tar.gz: fb62fb7e9c85edddd704349dc90ad7d3df0d7c34
5
5
  SHA512:
6
- metadata.gz: 9c0d514cee046bc8d4e5ab3d4ed51924a2826fc48613c63272b71e56cff4cab5c79b8443a3cb8c8937edf6da4accabcc4118057ea8d41f3250ace73529edcc06
7
- data.tar.gz: 36e251166434dc4ac969621bc73e3d2690ec57616913934a3a30a0a05412dc81f0885db2294f9aafa129ed0173ba052593d1ee4a71e0b64d68c3bfb8205df073
6
+ metadata.gz: b794448194231cf4cf42ee5f0e67895caffc99e20069306f9e56ffa0a1ecff25c5318a3e99c90046ff185fffdb4b9278eabb0403390e4748dd3eb6c68ed3bc3f
7
+ data.tar.gz: b1e26801a774e95a4674c820ae3a39d0aa6c3947d96a95d1175361f7f73588919cb2a93b2c7976b0588a2f71a9841367d87fb92de634a014b5358979f07286be
data/.semver CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 0
4
- :patch: 1
4
+ :patch: 2
5
5
  :special: ''
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: elastic-backup-2s3 0.0.1 ruby lib
5
+ # stub: elastic-backup-2s3 0.0.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "elastic-backup-2s3"
9
- s.version = "0.0.1"
9
+ s.version = "0.0.2"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
@@ -54,11 +54,12 @@ module ElasticBackup
54
54
  snapshot: '_all')
55
55
  unless options[:detailed]
56
56
  table = Text::Table.new
57
- table.head = ['Snapshot', 'State', 'Started']
57
+ table.head = ['Snapshot', 'State', 'Started', 'Duration']
58
58
  table.rows = statuses['snapshots'].map { |s|
59
59
  [s["snapshot"],
60
60
  s["state"],
61
- s["start_time"]]
61
+ s["start_time"],
62
+ s['end_time_in_millis'].nil? ? 'N/A' : Snapshot.pretty_time(s['end_time_in_millis'] - s['start_time_in_millis']) ]
62
63
  }
63
64
  puts table
64
65
  else
@@ -15,6 +15,26 @@ module ElasticBackup
15
15
  @opt ||= options
16
16
  end
17
17
 
18
+ # return a pretty time format from milliseconds
19
+ def pretty_time(milliseconds)
20
+ secs = milliseconds / 1000
21
+ mins = secs / 60
22
+ hours = mins / 60
23
+ days = hours / 24
24
+
25
+ if days > 0
26
+ "#{days} days #{hours % 24} hours"
27
+ elsif hours > 0
28
+ "#{hours} hours #{mins % 60} mimutes"
29
+ elsif mins > 0
30
+ "#{mins} minutes #{secs % 60} seconds"
31
+ elsif secs > 0
32
+ "#{secs} seconds"
33
+ else
34
+ "#{milliseconds} milliseconds"
35
+ end
36
+ end
37
+
18
38
  # Take the s3 url and break it down to
19
39
  # its components [BUCKET, PATH, SNAPSHOT]
20
40
  def s3url_splice(surl)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastic-backup-2s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Mitchell