git-semaphore 2.3.1 → 2.4.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
- SHA256:
3
- metadata.gz: 17e430cbe6fa05cae51f72ab97fe2dea23f8865a90ca47904dd8b13ef7efe0e1
4
- data.tar.gz: 0361d6502579ada1244c8d3fa63a1f27c1fe850b51b2c3d1d86bf3739db2bb45
2
+ SHA1:
3
+ metadata.gz: 36e4d14f55f0ac7c3509ec0cdc0e9fa620267e6f
4
+ data.tar.gz: b1a28a651e2ce2daf1f7300839f2761093ddc8e8
5
5
  SHA512:
6
- metadata.gz: 81a99b7299ada668b3987f76f00eed738c69f607c7c0f149ff82f8dbcb92bc46f5f9097086efab8b4abba4b120c1356d070fdf9c641601f342d0326007c27b31
7
- data.tar.gz: e235d27792aa581d63e326615d19fef8000561c31cec1f7a94fcdf691896655b934d9763e29015b6a2a01c81dc94a4173cf347b4127dd6ffed93fc97025b504b
6
+ metadata.gz: 3bd6f7aefe3fcd9dad1f0b6ca9d312a2170371cb55da025ab4eea82387e95340d290170babf870be759dd822309da7036a7405e63e039cf2f9007ca83ac2548b
7
+ data.tar.gz: 2a6a7dad8ba6b7458bb535d01b72964be30a8a0b84486d96a1fa4911376238558cf35b4106641460cf932a76deaf92f52662075d52ea15d401430055b597468d
@@ -15,6 +15,8 @@ Layout/MultilineOperationIndentation:
15
15
 
16
16
  Metrics/AbcSize:
17
17
  Enabled: false
18
+ Metrics/BlockLength:
19
+ Enabled: false
18
20
  Metrics/ClassLength:
19
21
  Enabled: false
20
22
  Metrics/LineLength:
@@ -1 +1 @@
1
- 2.5.1
1
+ 2.3.8
@@ -17,7 +17,12 @@ options = Slop.parse(help: true) do |o|
17
17
  BANNER
18
18
 
19
19
  o.on '--version', 'Print the version' do
20
- puts Git::Semaphore::LONG_VERSION
20
+ dependencies = [
21
+ "rugged v#{Rugged::VERSION}",
22
+ "#{RUBY_ENGINE} #{RUBY_VERSION}p#{RUBY_PATCHLEVEL}",
23
+ ].join(', ')
24
+
25
+ puts "#{Git::Semaphore::NAME} v#{Git::Semaphore::VERSION} (#{dependencies})"
21
26
  exit(0)
22
27
  end
23
28
 
@@ -17,7 +17,7 @@ module Git
17
17
 
18
18
  def self.status(project_hash_id, branch_id, refresh, auth_token)
19
19
  @status ||= Git::Semaphore.from_json_cache(status_cache(project_hash_id, branch_id), refresh) do
20
- API.status project_hash_id, branch_id, auth_token
20
+ API::Enrich.status project_hash_id, branch_id, auth_token
21
21
  end
22
22
  end
23
23
 
@@ -15,25 +15,37 @@ module Git
15
15
  end
16
16
 
17
17
  def self.history(project_hash_id, branch_id, auth_token)
18
- API.history(project_hash_id, branch_id, auth_token).tap do |results|
19
- results['builds'].each do |build|
20
- # build['result'] = "passed", "failed", "stopped" or "pending"
21
- next unless (started_at = build['started_at'])
22
- next unless (finished_at = build['finished_at'])
23
- started_at = Time.parse(started_at)
24
- finished_at = Time.parse(finished_at)
25
- build['date'] = {
26
- started_at: started_at.to_date,
27
- finished_at: finished_at.to_date,
28
- }
29
- build['duration'] = {
30
- seconds: (finished_at - started_at).to_i,
31
- minutes: format('%0.2f', (finished_at - started_at) / 60).to_f,
32
- }
18
+ API.history(project_hash_id, branch_id, auth_token).tap do |history|
19
+ history['builds'].each do |build|
20
+ enrich(build)
33
21
  end
34
22
  end
35
23
  end
36
24
 
25
+ def self.status(project_hash_id, branch_id, auth_token)
26
+ API.status(project_hash_id, branch_id, auth_token).tap do |status|
27
+ enrich(status)
28
+ end
29
+ end
30
+
31
+ def self.enrich(build)
32
+ # build['result'] = "passed", "failed", "stopped" or "pending"
33
+ return unless (started_at = build['started_at'])
34
+ return unless (finished_at = build['finished_at'])
35
+ started_at = Time.parse(started_at)
36
+ finished_at = Time.parse(finished_at)
37
+ build['date'] = {
38
+ started_at: started_at.to_date,
39
+ finished_at: finished_at.to_date,
40
+ }
41
+ build['duration'] = {
42
+ seconds: (finished_at - started_at).to_i,
43
+ minutes: format('%0.2f', (finished_at - started_at) / 60).to_f,
44
+ }
45
+ end
46
+
47
+ private_class_method :enrich
48
+
37
49
  end
38
50
  end
39
51
  end
@@ -1,15 +1,6 @@
1
- require 'rugged'
2
-
3
1
  module Git
4
2
  module Semaphore
5
3
  NAME = 'git-semaphore'.freeze
6
- VERSION = '2.3.1'.freeze
7
-
8
- DEPENDENCY_VERSIONS = [
9
- "rugged v#{Rugged::VERSION}",
10
- "#{RUBY_ENGINE} #{RUBY_VERSION}p#{RUBY_PATCHLEVEL}",
11
- ].join(', ').freeze
12
-
13
- LONG_VERSION = "#{NAME} v#{VERSION} (#{DEPENDENCY_VERSIONS})".freeze
4
+ VERSION = '2.4.1'.freeze
14
5
  end
15
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-semaphore
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Vandenberk
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-12 00:00:00.000000000 Z
11
+ date: 2018-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rugged
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  version: '0'
132
132
  requirements: []
133
133
  rubyforge_project:
134
- rubygems_version: 2.7.6
134
+ rubygems_version: 2.5.2.3
135
135
  signing_key:
136
136
  specification_version: 4
137
137
  summary: git integration with semaphoreci.com