git-story-workflow 0.3.4 → 0.3.5

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: 0f354b91d58da485c046c3eda0a06571ee59af8b
4
- data.tar.gz: 4e023a2278d47239f859cab5969814d5b5a2cdab
3
+ metadata.gz: afbc0ec1026b7efc6444cac3bfe109237e4bed31
4
+ data.tar.gz: 30c494fc6cbf366f7d8a00ee0a7e3c3532d3e6cb
5
5
  SHA512:
6
- metadata.gz: 491e64e415aa2db7afc25c3efd36fd8558f9dd8b2ce07fc3108c04ad29cc6aa7cdc031596efc325544279d35f1d0bc9c00dd7362f03402c623e7939258c566f1
7
- data.tar.gz: 641d8a133fbabf70d320e1a078d7ff29a887307907bd11a0ce62ee99039db9d1a83a89087157e9cf4d2f870eeaf31f367d0ed6c0499a9720ee43d3c3cf479fda
6
+ metadata.gz: f4764c0e9dddfab11351794a7fb71f7e1bd5916e67c8ef37be38bd0ebceed372e1cc2d0ce8fa97b425a0f8c981e2cf5b3da7b9e821215f4f89bae430435911da
7
+ data.tar.gz: 6f041023d6cdf3b186850f71ed74775dd19ba997aa751a3ca3589761ba9d5759abe05bffd953e0ec9f70b165e8d641a194710b559eebd92d06d53cc204ef9f9f
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.4
1
+ 0.3.5
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: git-story-workflow 0.3.4 ruby lib
2
+ # stub: git-story-workflow 0.3.5 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "git-story-workflow".freeze
6
- s.version = "0.3.4"
6
+ s.version = "0.3.5"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
@@ -110,7 +110,11 @@ class Git::Story::App
110
110
  server = Git::Story::SemaphoreResponse.get(url, debug: @debug)
111
111
  deploys = server.deploys
112
112
  upcoming = deploys.select(&:pending?)&.last
113
- current = deploys.find(&:passed?)
113
+ passed = deploys.select(&:passed?)
114
+ current = passed.first
115
+ if !passed.empty? && upcoming
116
+ upcoming.estimated_duration = passed.sum { |d| d.duration.to_f } / passed.size
117
+ end
114
118
  <<~end
115
119
  Server: #{server.server_name&.green}
116
120
  Branch: #{server.branch_name&.color('#ff5f00')}
@@ -20,7 +20,11 @@ class Git::Story::SemaphoreResponse < JSON::GenericObject
20
20
  time = Time.parse(finished_at)
21
21
  end
22
22
  end
23
- Tins::Duration.new(time - Time.parse(started_at))
23
+ if started_at
24
+ Tins::Duration.new(time - Time.parse(started_at))
25
+ else
26
+ Tins::Duration.new(0)
27
+ end
24
28
  end
25
29
 
26
30
  def pending?
@@ -68,14 +72,18 @@ class Git::Story::SemaphoreResponse < JSON::GenericObject
68
72
  end
69
73
 
70
74
  def estimated_duration
71
- times = branch_history.select { |b| b.result == 'passed' }.map { |b|
72
- Time.parse(b.finished_at) - Time.parse(b.started_at)
73
- }
74
- if times.empty?
75
- duration
75
+ if ed = super
76
+ ed
76
77
  else
77
- times.sum / times.size
78
- end.to_f
78
+ times = branch_history.select(&:passed?).map { |b|
79
+ Time.parse(b.finished_at) - Time.parse(b.started_at)
80
+ }
81
+ if times.empty?
82
+ duration
83
+ else
84
+ times.sum / times.size
85
+ end.to_f
86
+ end
79
87
  end
80
88
 
81
89
  def to_s
@@ -1,6 +1,6 @@
1
1
  module Git::Story
2
2
  # Git::Story version
3
- VERSION = '0.3.4'
3
+ VERSION = '0.3.5'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-story-workflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank