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 +4 -4
- data/VERSION +1 -1
- data/git-story-workflow.gemspec +2 -2
- data/lib/git/story/app.rb +5 -1
- data/lib/git/story/semaphore.rb +16 -8
- data/lib/git/story/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: afbc0ec1026b7efc6444cac3bfe109237e4bed31
|
4
|
+
data.tar.gz: 30c494fc6cbf366f7d8a00ee0a7e3c3532d3e6cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4764c0e9dddfab11351794a7fb71f7e1bd5916e67c8ef37be38bd0ebceed372e1cc2d0ce8fa97b425a0f8c981e2cf5b3da7b9e821215f4f89bae430435911da
|
7
|
+
data.tar.gz: 6f041023d6cdf3b186850f71ed74775dd19ba997aa751a3ca3589761ba9d5759abe05bffd953e0ec9f70b165e8d641a194710b559eebd92d06d53cc204ef9f9f
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.5
|
data/git-story-workflow.gemspec
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: git-story-workflow 0.3.
|
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.
|
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]
|
data/lib/git/story/app.rb
CHANGED
@@ -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
|
-
|
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')}
|
data/lib/git/story/semaphore.rb
CHANGED
@@ -20,7 +20,11 @@ class Git::Story::SemaphoreResponse < JSON::GenericObject
|
|
20
20
|
time = Time.parse(finished_at)
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
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
|
-
|
72
|
-
|
73
|
-
}
|
74
|
-
if times.empty?
|
75
|
-
duration
|
75
|
+
if ed = super
|
76
|
+
ed
|
76
77
|
else
|
77
|
-
times.
|
78
|
-
|
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
|
data/lib/git/story/version.rb
CHANGED