git-story-workflow 0.11.3 → 1.0.0

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: 594fee5ac595ddfe8ae4802bfc3bf4bef2c0f7c7b2e9f3ccbf76a9cbc7d8bd12
4
- data.tar.gz: 2b2c6dace41b40c654dcfe7be680d22bf978696976d59de42abd27bdb68e071f
3
+ metadata.gz: 7436139595b89b702416d8a9d0f792d2c4cf078a89d56ae462093e4a36c8b1f4
4
+ data.tar.gz: 3a2542c050b36b046b49130b356284825fa3fd6d2cfef9bffbdea7735298555f
5
5
  SHA512:
6
- metadata.gz: cf31372ba982c29af6e018ec82136bd2d254f0c728567d2ee0d1e4ccc38fe57442aafa38ad0634bc5bbc22910740113509074684dd83a024b99d509add46dc15
7
- data.tar.gz: 600489c9074d8f73f57d8156ca440fe69332e25dc80470a736ad763bfe647b4845d580338791b59e116520d0207d2b3e976dae39ef338a726894834f25a1c2ad
6
+ metadata.gz: eb7071e5a13b018ed232b9ff0e15357037b417c24720ea420b0d1ed370e83ecd8b54b65f60f4f426c8a6c6c30db236894a6839504d389bf0343e6f2efac2771f
7
+ data.tar.gz: c1755fe341e1f171169627dfe4a9b40b20a9fe34fc565f5ae2ee2d2925aebbdb38949fd5b8a1e7285730bd25fffba1c7d7b750113a44b9af4acb4204de2725a9
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.11.3
1
+ 1.0.0
@@ -1,23 +1,23 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: git-story-workflow 0.11.3 ruby lib
2
+ # stub: git-story-workflow 1.0.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "git-story-workflow".freeze
6
- s.version = "0.11.3"
6
+ s.version = "1.0.0"
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 = "2020-07-20"
11
+ s.date = "2020-09-10"
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]
15
- s.extra_rdoc_files = ["README.md".freeze, "lib/git/story.rb".freeze, "lib/git/story/app.rb".freeze, "lib/git/story/semaphore.rb".freeze, "lib/git/story/setup.rb".freeze, "lib/git/story/utils.rb".freeze, "lib/git/story/version.rb".freeze]
16
- s.files = [".gitignore".freeze, "COPYING".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "bin/git-story".freeze, "config/story.yml".freeze, "git-story-workflow.gemspec".freeze, "lib/git/story.rb".freeze, "lib/git/story/app.rb".freeze, "lib/git/story/prepare-commit-msg".freeze, "lib/git/story/semaphore.rb".freeze, "lib/git/story/setup.rb".freeze, "lib/git/story/utils.rb".freeze, "lib/git/story/version.rb".freeze, "spec/git/story/app_spec.rb".freeze, "spec/spec_helper.rb".freeze]
15
+ s.extra_rdoc_files = ["README.md".freeze, "lib/git/story.rb".freeze, "lib/git/story/app.rb".freeze, "lib/git/story/setup.rb".freeze, "lib/git/story/utils.rb".freeze, "lib/git/story/version.rb".freeze]
16
+ s.files = [".gitignore".freeze, "COPYING".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "bin/git-story".freeze, "config/story.yml".freeze, "git-story-workflow.gemspec".freeze, "lib/git/story.rb".freeze, "lib/git/story/app.rb".freeze, "lib/git/story/prepare-commit-msg".freeze, "lib/git/story/setup.rb".freeze, "lib/git/story/utils.rb".freeze, "lib/git/story/version.rb".freeze, "spec/git/story/app_spec.rb".freeze, "spec/spec_helper.rb".freeze]
17
17
  s.homepage = "http://flori.github.com/git-story-workflow".freeze
18
18
  s.licenses = ["Apache-2.0".freeze]
19
19
  s.rdoc_options = ["--title".freeze, "Git-story-workflow".freeze, "--main".freeze, "README.md".freeze]
20
- s.rubygems_version = "3.1.2".freeze
20
+ s.rubygems_version = "3.1.4".freeze
21
21
  s.summary = "Gem abstracting a git workflow".freeze
22
22
  s.test_files = ["spec/git/story/app_spec.rb".freeze, "spec/spec_helper.rb".freeze]
23
23
 
@@ -21,5 +21,4 @@ end
21
21
  require 'git/story/version'
22
22
  require 'git/story/utils'
23
23
  require 'git/story/setup'
24
- require 'git/story/semaphore'
25
24
  require 'git/story/app'
@@ -107,62 +107,6 @@ class Git::Story::App
107
107
  end
108
108
  end
109
109
 
110
- command doc: '[BRANCH] display test status of branch, -n SECONDS refreshes'
111
- def test_status(branch = current(check: false))
112
- url = nil
113
- watch do
114
- auth_token = complex_config.story.semaphore_auth_token
115
- project = complex_config.story.semaphore_test_project
116
- url = "https://semaphoreci.com/api/v1/projects/#{project}/#{branch}/status?auth_token=#{auth_token}"
117
- Git::Story::SemaphoreResponse.get(url, debug: @debug)
118
- end
119
- rescue => e
120
- "Getting #{url.inspect} => #{e.class}: #{e}".red
121
- end
122
-
123
- command doc: '[SERVER] display deploy status of branch, -n SECONDS refreshes'
124
- def deploy_status(server = complex_config.story.semaphore_default_server)
125
- url = nil
126
- watch do
127
- auth_token = complex_config.story.semaphore_auth_token
128
- project = complex_config.story.semaphore_test_project
129
- url = "https://semaphoreci.com/api/v1/projects/#{project}/servers/#{server}?auth_token=#{auth_token}"
130
- server = Git::Story::SemaphoreResponse.get(url, debug: @debug)
131
- deploys = server.deploys
132
- upcoming = deploys.select(&:pending?)&.last
133
- passed = deploys.select(&:passed?)
134
- current = passed.first
135
- if !passed.empty? && upcoming
136
- upcoming.estimated_duration = passed.sum { |d| d.duration.to_f } / passed.size
137
- end
138
- <<~end
139
- Server: #{server.server_name&.green}
140
- Branch: #{server.branch_name&.color('#ff5f00')}
141
- Semaphore: #{server.server_url}
142
- Strategy: #{server.strategy}
143
- Upcoming:
144
- #{upcoming}
145
- Current:
146
- #{current}
147
- end
148
- end
149
- rescue => e
150
- "Getting #{url.inspect} => #{e.class}: #{e}".red
151
- end
152
-
153
- command doc: '[BRANCH] display build status for branch, -n SECONDS refreshes'
154
- def build_status(branch = current(check: false))
155
- watch do
156
- [
157
- "Test Status".bold,
158
- test_status(branch) || 'n/a',
159
- "Deploy Status".bold,
160
- deploy_status || 'n/a',
161
- ] * "\n\n"
162
- end
163
- end
164
-
165
-
166
110
  command doc: '[STORY_ID] fetch status of current story, -n SECONDS refreshes'
167
111
  def status(story_id = current(check: true)&.[](/_(\d+)\z/, 1)&.to_i)
168
112
  if story = fetch_story(story_id)
@@ -1,6 +1,6 @@
1
1
  module Git::Story
2
2
  # Git::Story version
3
- VERSION = '0.11.3'
3
+ VERSION = '1.0.0'
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,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.11.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-20 00:00:00.000000000 Z
11
+ date: 2020-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_hadar
@@ -159,7 +159,6 @@ extra_rdoc_files:
159
159
  - README.md
160
160
  - lib/git/story.rb
161
161
  - lib/git/story/app.rb
162
- - lib/git/story/semaphore.rb
163
162
  - lib/git/story/setup.rb
164
163
  - lib/git/story/utils.rb
165
164
  - lib/git/story/version.rb
@@ -176,7 +175,6 @@ files:
176
175
  - lib/git/story.rb
177
176
  - lib/git/story/app.rb
178
177
  - lib/git/story/prepare-commit-msg
179
- - lib/git/story/semaphore.rb
180
178
  - lib/git/story/setup.rb
181
179
  - lib/git/story/utils.rb
182
180
  - lib/git/story/version.rb
@@ -205,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
203
  - !ruby/object:Gem::Version
206
204
  version: '0'
207
205
  requirements: []
208
- rubygems_version: 3.1.2
206
+ rubygems_version: 3.1.4
209
207
  signing_key:
210
208
  specification_version: 4
211
209
  summary: Gem abstracting a git workflow
@@ -1,141 +0,0 @@
1
- require 'json'
2
- require 'time'
3
- require 'open-uri'
4
- require 'infobar'
5
-
6
- class Git::Story::SemaphoreResponse < JSON::GenericObject
7
- def self.get(url, debug: false)
8
- data = URI.open(url).read
9
- debug and STDERR.puts JSON.pretty_generate(JSON(data))
10
- result = JSON(data, object_class: self)
11
- result.debug = debug
12
- result
13
- end
14
-
15
- def duration(time = nil)
16
- unless time
17
- if finished_at.nil?
18
- time = Time.now
19
- else
20
- time = Time.parse(finished_at)
21
- end
22
- end
23
- if started_at
24
- Tins::Duration.new(time - Time.parse(started_at))
25
- else
26
- Tins::Duration.new(0)
27
- end
28
- end
29
-
30
- def pending?
31
- result == 'pending'
32
- end
33
-
34
- def building?
35
- !started_at.nil?
36
- end
37
-
38
- def passed?
39
- result == 'passed'
40
- end
41
-
42
- def failed?
43
- result == 'failed'
44
- end
45
-
46
- def canceled?
47
- result == 'canceled'
48
- end
49
-
50
- def finished?
51
- finished_at.blank?
52
- end
53
-
54
- def sha1
55
- commit.id[0,10]
56
- end
57
-
58
- def entity_url
59
- server_html_url || build_url
60
- end
61
-
62
- def entity_name
63
- branch_name || server_name
64
- end
65
-
66
- def branch_history
67
- if branch_history_url
68
- self.class.get(branch_history_url, debug: debug)&.builds
69
- else
70
- []
71
- end
72
- end
73
-
74
- def estimated_duration
75
- if ed = super
76
- ed
77
- else
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
87
- end
88
-
89
- def infobar_style
90
- case
91
- when passed?, pending?
92
- {
93
- done_fg_color: '#005f00',
94
- done_bg_color: '#00d700',
95
- todo_fg_color: '#00d700',
96
- todo_bg_color: '#005f00',
97
- }
98
- else
99
- {
100
- done_fg_color: '#5f0000',
101
- done_bg_color: '#d70000',
102
- todo_fg_color: '#d70000',
103
- todo_bg_color: '#5f0000',
104
- }
105
- end
106
- end
107
-
108
- def to_s
109
- r = case
110
- when pending? && building?
111
- "#{entity_name} ##{sha1} building for #{duration(Time.now)}".yellow.bold
112
- when pending?
113
- "#{entity_name} ##{sha1} pending at the moment".yellow
114
- when passed?
115
- "#{entity_name} ##{sha1} passed after #{duration}".green
116
- when failed?
117
- "#{entity_name} ##{sha1} failed after #{duration}".red
118
- else
119
- "#{entity_name} ##{sha1} in state #{result}".blue
120
- end
121
- r = StringIO.new(r)
122
- duration_seconds = duration.to_f.to_i
123
- if passed? || failed?
124
- total_seconds = duration_seconds
125
- else
126
- total_seconds = estimated_duration.to_i
127
- end
128
- Infobar(
129
- current: duration_seconds,
130
- total: total_seconds,
131
- message: ' %l %c/%t seconds ',
132
- style: infobar_style,
133
- output: r
134
- ).update
135
- r <<
136
- "\n Semaphore: #{entity_url}" <<
137
- "\n Commit: #{commit.url}\n#{commit.message&.gsub(/^/, " " * 10)&.color(33)}" <<
138
- "\n Authored: #{(commit.author_name + ' <' + commit.author_email + ?>).bold} @#{commit.timestamp}"
139
- r.tap(&:rewind).read
140
- end
141
- end