git-story-workflow 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/git-story-workflow.gemspec +6 -3
- data/lib/git/story/app.rb +2 -2
- data/lib/git/story/semaphore.rb +31 -1
- data/lib/git/story/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f354b91d58da485c046c3eda0a06571ee59af8b
|
4
|
+
data.tar.gz: 4e023a2278d47239f859cab5969814d5b5a2cdab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 491e64e415aa2db7afc25c3efd36fd8558f9dd8b2ce07fc3108c04ad29cc6aa7cdc031596efc325544279d35f1d0bc9c00dd7362f03402c623e7939258c566f1
|
7
|
+
data.tar.gz: 641d8a133fbabf70d320e1a078d7ff29a887307907bd11a0ce62ee99039db9d1a83a89087157e9cf4d2f870eeaf31f367d0ed6c0499a9720ee43d3c3cf479fda
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.4
|
data/git-story-workflow.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: git-story-workflow 0.3.
|
2
|
+
# stub: git-story-workflow 0.3.4 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.4"
|
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]
|
10
10
|
s.authors = ["Florian Frank".freeze]
|
11
|
-
s.date = "2018-
|
11
|
+
s.date = "2018-02-12"
|
12
12
|
s.description = "Gem abstracting a git workflow\u2026".freeze
|
13
13
|
s.email = "flori@ping.de".freeze
|
14
14
|
s.executables = ["git-story".freeze]
|
@@ -29,6 +29,7 @@ Gem::Specification.new do |s|
|
|
29
29
|
s.add_development_dependency(%q<rake>.freeze, [">= 0"])
|
30
30
|
s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
|
31
31
|
s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
|
32
|
+
s.add_runtime_dependency(%q<infobar>.freeze, [">= 0"])
|
32
33
|
s.add_runtime_dependency(%q<tins>.freeze, [">= 0"])
|
33
34
|
s.add_runtime_dependency(%q<mize>.freeze, [">= 0"])
|
34
35
|
s.add_runtime_dependency(%q<term-ansicolor>.freeze, [">= 0"])
|
@@ -38,6 +39,7 @@ Gem::Specification.new do |s|
|
|
38
39
|
s.add_dependency(%q<rake>.freeze, [">= 0"])
|
39
40
|
s.add_dependency(%q<simplecov>.freeze, [">= 0"])
|
40
41
|
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
42
|
+
s.add_dependency(%q<infobar>.freeze, [">= 0"])
|
41
43
|
s.add_dependency(%q<tins>.freeze, [">= 0"])
|
42
44
|
s.add_dependency(%q<mize>.freeze, [">= 0"])
|
43
45
|
s.add_dependency(%q<term-ansicolor>.freeze, [">= 0"])
|
@@ -48,6 +50,7 @@ Gem::Specification.new do |s|
|
|
48
50
|
s.add_dependency(%q<rake>.freeze, [">= 0"])
|
49
51
|
s.add_dependency(%q<simplecov>.freeze, [">= 0"])
|
50
52
|
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
53
|
+
s.add_dependency(%q<infobar>.freeze, [">= 0"])
|
51
54
|
s.add_dependency(%q<tins>.freeze, [">= 0"])
|
52
55
|
s.add_dependency(%q<mize>.freeze, [">= 0"])
|
53
56
|
s.add_dependency(%q<term-ansicolor>.freeze, [">= 0"])
|
data/lib/git/story/app.rb
CHANGED
@@ -97,7 +97,7 @@ class Git::Story::App
|
|
97
97
|
auth_token = complex_config.story.semaphore_auth_token
|
98
98
|
project = complex_config.story.semaphore_project
|
99
99
|
url = "https://semaphoreci.com/api/v1/projects/#{project}/#{branch}/status?auth_token=#{auth_token}"
|
100
|
-
Git::Story::SemaphoreResponse.get(url)
|
100
|
+
Git::Story::SemaphoreResponse.get(url, debug: @debug)
|
101
101
|
rescue => e
|
102
102
|
"Getting #{url.inspect} => #{e.class}: #{e}".red
|
103
103
|
end
|
@@ -107,7 +107,7 @@ class Git::Story::App
|
|
107
107
|
auth_token = complex_config.story.semaphore_auth_token
|
108
108
|
project = complex_config.story.semaphore_project
|
109
109
|
url = "https://semaphoreci.com/api/v1/projects/#{project}/servers/#{server}?auth_token=#{auth_token}"
|
110
|
-
server = Git::Story::SemaphoreResponse.get(url)
|
110
|
+
server = Git::Story::SemaphoreResponse.get(url, debug: @debug)
|
111
111
|
deploys = server.deploys
|
112
112
|
upcoming = deploys.select(&:pending?)&.last
|
113
113
|
current = deploys.find(&:passed?)
|
data/lib/git/story/semaphore.rb
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
require 'json'
|
2
2
|
require 'time'
|
3
3
|
require 'open-uri'
|
4
|
+
require 'infobar'
|
4
5
|
|
5
6
|
class Git::Story::SemaphoreResponse < JSON::GenericObject
|
6
7
|
def self.get(url, debug: false)
|
7
8
|
data = open(url).read
|
8
9
|
debug and STDERR.puts JSON.pretty_generate(JSON(data))
|
9
|
-
JSON(data, object_class: self)
|
10
|
+
result = JSON(data, object_class: self)
|
11
|
+
result.debug = debug
|
12
|
+
result
|
10
13
|
end
|
11
14
|
|
12
15
|
def duration(time = nil)
|
@@ -56,6 +59,25 @@ class Git::Story::SemaphoreResponse < JSON::GenericObject
|
|
56
59
|
branch_name || server_name
|
57
60
|
end
|
58
61
|
|
62
|
+
def branch_history
|
63
|
+
if branch_history_url
|
64
|
+
self.class.get(branch_history_url, debug: debug)&.builds
|
65
|
+
else
|
66
|
+
[]
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
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
|
76
|
+
else
|
77
|
+
times.sum / times.size
|
78
|
+
end.to_f
|
79
|
+
end
|
80
|
+
|
59
81
|
def to_s
|
60
82
|
r = case
|
61
83
|
when pending? && building?
|
@@ -69,9 +91,17 @@ class Git::Story::SemaphoreResponse < JSON::GenericObject
|
|
69
91
|
else
|
70
92
|
"#{entity_name} ##{sha1} in state #{result}".blue
|
71
93
|
end
|
94
|
+
r = StringIO.new(r)
|
95
|
+
Infobar(
|
96
|
+
current: duration.to_f.to_i,
|
97
|
+
total: estimated_duration.to_i,
|
98
|
+
message: ' %l %c/%t seconds ',
|
99
|
+
output: r
|
100
|
+
).update
|
72
101
|
r <<
|
73
102
|
"\n Semaphore: #{entity_url}" <<
|
74
103
|
"\n Commit: #{commit.url}" <<
|
75
104
|
"\n Authored: #{(commit.author_name + ' <' + commit.author_email + ?>).bold} @#{commit.timestamp}"
|
105
|
+
r.tap(&:rewind).read
|
76
106
|
end
|
77
107
|
end
|
data/lib/git/story/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-story-workflow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Frank
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_hadar
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: infobar
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: tins
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|