cody 0.8.0 → 0.8.1

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
  SHA256:
3
- metadata.gz: d8ae54a008252e6ce83388bea8b82a78b6f3fff32724fc822b63d02baa39fdee
4
- data.tar.gz: 717b8030c9046966f909eef2b64487482e1a8e1819d6e12d43747520499de642
3
+ metadata.gz: 7f1f0a386b9a31e991c4780b802ad8db436b1a7fc0a620eae0be450b44ea35bb
4
+ data.tar.gz: b22ac1a609aca0baebe683b51818253b7eae58512e9bbd0c6f9c4019ab94d800
5
5
  SHA512:
6
- metadata.gz: 6a340b073735c12b2166ef78a43d79851c047780074a46f638021c7a0d7c60d8f380e4674ae2be09587f6b00400ced580391af72970cc96236869c108539fafe
7
- data.tar.gz: 503328e1e3feb629877eb1dc901da9e2e3a52ed1a450b2da299ed662bb3cf38d9506d09ede8a8fccbb470186ebddaceeb4110ce37554d69a3146dc0b7dc17433
6
+ metadata.gz: bab07629f7f5762273e3a0c199514ef5cab34edd7350e725c26c1d55c8a25d92d2e5515ea5074b497c6272cde07861741586dd28951b71856a8cd5b07163d0c1
7
+ data.tar.gz: 3e14ba65fcb5ab8d2abfe0cef22b370725cf65b779cbeacfa080f5e4a1bca526072f30b9b9993ebf8162f7a61b5315e00625099940a4192c69533c2c5220e594
data/CHANGELOG.md CHANGED
@@ -3,6 +3,9 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [0.8.1]
7
+ - #8 report build time at end of logs
8
+
6
9
  ## [0.8.0]
7
10
  - #7 add cody logs command and automatically tail logs after a cody start
8
11
 
data/lib/cody/tailer.rb CHANGED
@@ -20,6 +20,7 @@ module Cody
20
20
 
21
21
  def run
22
22
  puts "Showing logs for build #{@build_id}"
23
+
23
24
  complete = false
24
25
  until complete do
25
26
  build = find_build
@@ -34,8 +35,11 @@ module Cody
34
35
  start_cloudwatch_tail unless ENV["CODY_TEST"]
35
36
  sleep 5 if !@@end_loop_signal && !complete && !ENV["CODY_TEST"]
36
37
  end
38
+
37
39
  AwsLogs::Tail.stop_follow!
38
40
  @thread.join if @thread
41
+
42
+ puts "The build took #{build_time(build)} to complete."
39
43
  end
40
44
 
41
45
  def start_cloudwatch_tail
@@ -115,5 +119,21 @@ module Cody
115
119
  exit # immediate exit
116
120
  }
117
121
  end
122
+
123
+ def build_time(build)
124
+ duration = build.phases.inject(0) { |sum,p| sum + p.duration_in_seconds.to_i }
125
+ pretty_time(duration)
126
+ end
127
+
128
+ # http://stackoverflow.com/questions/4175733/convert-duration-to-hoursminutesseconds-or-similar-in-rails-3-or-ruby
129
+ def pretty_time(total_seconds)
130
+ minutes = (total_seconds / 60) % 60
131
+ seconds = total_seconds % 60
132
+ if total_seconds < 60
133
+ "#{seconds.to_i}s"
134
+ else
135
+ "#{minutes.to_i}m #{seconds.to_i}s"
136
+ end
137
+ end
118
138
  end
119
139
  end
data/lib/cody/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Cody
2
- VERSION = "0.8.0"
2
+ VERSION = "0.8.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cody
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen