kapnismology 2.3.2 → 2.4.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
  SHA1:
3
- metadata.gz: 02f52858c157f4316cdcdf714508cb931e63e84d
4
- data.tar.gz: c06b4a9f6cf659980ed86dd96791344aad4dbbb7
3
+ metadata.gz: 6c0e774535593967181d8b1fd490b470a95a41e0
4
+ data.tar.gz: 87a3a37511698208882a899de4631f8a69af9b77
5
5
  SHA512:
6
- metadata.gz: 3274e8f47fac57a7c9af202a9fdb48d84519d9a7833636dfa2d13884ee93332a879d0e314d57cc1a2b3218a44e5fa93b52ecdfeb2e02266819e4aad19cb55ade
7
- data.tar.gz: 7b9bad1cee8c6200450b6312df2adbc3b7d89170cb5c1085e0bd481ac6dd3f09507307e8ba5987d5fd45cb64c0d83f59f45f2f077d255da8f15eb7eeb94f01c8
6
+ metadata.gz: 1ce123b813acda1e6b3994d7b522532aa24ebf34ae815df6b5f09f9bdf776ae70402d9905024e7c1ec908fab7f31cb0d8d4ee4756b5577237389fb1c6bcc8504
7
+ data.tar.gz: daa53a22ae581bd33231406a4755108729eab9ee5eb04853103c3510b7212b47fd43b8434d4938eddbac6a664591a02d17ad4e8c22c6a051aa61e19070e0b859
@@ -1,22 +1,47 @@
1
+ require "json"
2
+
1
3
  module Kapnismology
2
4
  # This class provides information about the running environment the smoketest is being
3
5
  # executed under.
4
6
  class ApplicationInformation
5
- INFO_UNKNOWN = ''
7
+ GIT_SHOW_COMMAND = "git show HEAD --abbrev-commit --oneline".freeze
8
+ ECS_CONTAINER_METADATA_FILE = ENV["ECS_CONTAINER_METADATA_FILE"].freeze
9
+ INFO_UNKNOWN = "".freeze
6
10
 
7
11
  def trace_id
8
12
  Object.const_defined?(:Trace) ? Trace.id.trace_id.to_s : INFO_UNKNOWN
9
13
  end
10
14
 
11
15
  def codebase_revision
12
- latest_commit_info.split(/\s/).first || INFO_UNKNOWN
16
+ ref = latest_commit_info
17
+ ref ? ref.split(/\s/).first : INFO_UNKNOWN
13
18
  rescue Errno::ENOENT, StandardError
14
- INFO_UNKNOWN
19
+ INFO_UNKNOWN
15
20
  end
16
21
 
17
22
  private
23
+
18
24
  def latest_commit_info
19
- `git show HEAD --abbrev-commit --oneline`
25
+ latest_ref_from_git || latest_ref_from_ecs_metadata || nil
26
+ end
27
+
28
+ def latest_ref_from_git
29
+ result = `#{GIT_SHOW_COMMAND}`
30
+ $?.success? ? result : nil
31
+ end
32
+
33
+ # This assumes the ImageName features the git ref as the last part of a string delimited by dots.
34
+ # See spec/support/ecs_metadata.json as well as
35
+ # https://docs.aws.amazon.com/AmazonECS/latest/developerguide/container-metadata.html
36
+ def latest_ref_from_ecs_metadata
37
+ return if ECS_CONTAINER_METADATA_FILE.nil?
38
+ return unless !ECS_CONTAINER_METADATA_FILE.strip.empty? && File.readable?(ECS_CONTAINER_METADATA_FILE)
39
+
40
+ begin
41
+ JSON.parse(File.read(ECS_CONTAINER_METADATA_FILE))["ImageName"].split(".").last[0...7]
42
+ rescue JSON::ParserError
43
+ nil
44
+ end
20
45
  end
21
46
  end
22
47
  end
@@ -1,3 +1,3 @@
1
1
  module Kapnismology
2
- VERSION = '2.3.2'.freeze
2
+ VERSION = '2.4.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kapnismology
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.2
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordi Polo Carres
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-18 00:00:00.000000000 Z
11
+ date: 2018-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '9.0'
61
+ version: '10'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '9.0'
68
+ version: '10'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: mutant
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 0.5.3
117
+ version: '1.0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 0.5.3
124
+ version: '1.0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: sqlite3
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -164,6 +164,20 @@ dependencies:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0.7'
167
+ - !ruby/object:Gem::Dependency
168
+ name: simplecov
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '0.16'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '0.16'
167
181
  description: Engine for smoke tests and base classes
168
182
  email:
169
183
  - mumismo@gmail.com
@@ -201,7 +215,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
201
215
  requirements:
202
216
  - - ">="
203
217
  - !ruby/object:Gem::Version
204
- version: 2.1.8
218
+ version: 2.3.0
205
219
  required_rubygems_version: !ruby/object:Gem::Requirement
206
220
  requirements:
207
221
  - - ">="
@@ -209,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
223
  version: '0'
210
224
  requirements: []
211
225
  rubyforge_project:
212
- rubygems_version: 2.6.11
226
+ rubygems_version: 2.6.14
213
227
  signing_key:
214
228
  specification_version: 4
215
229
  summary: Engine for smoke tests.