getaround_utils 0.2.27 → 0.2.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b7c6ec94cd9838c918e501fbf99ed9e4755b20f6c14672e1f1b28d0c6e7b25d
4
- data.tar.gz: e66a6d32a26039ecb58bae3fb807fb4fabb17b54a144b5a595da547dbc4e5b01
3
+ metadata.gz: 4fca4e13fd9ea2df3a55952ab08aec5971b58269633125efc8009a8b94dde519
4
+ data.tar.gz: e5d39a9f05c9698f5da85329b7e74212384258ae1f6dfc9feeddeae646835a63
5
5
  SHA512:
6
- metadata.gz: 980a961c7ac58ae9071ff829ebf591bf21c33b8363a4ad25be27fb5d4980c85de4b07ed30dc59728e1b10138c5f55decb293f2f5a13690e7699c4611577f27af
7
- data.tar.gz: 243f748c1e344bd6e15687ed23053a13e1c1bb5a7d128bda4f4cd0f1ea2b99087c46c0ba4f444a2a81449e5fc1351e7b3c02d5c121835a4b3b662e0282034475
6
+ metadata.gz: a6d419a987df9fab2beee07f6c30856a10a10ba3500b4eb0689f28eb98df912a7c131ba02fdf81b5cf8b4510c7f307a87569f712216cc5cbe735fb13402a060d
7
+ data.tar.gz: 6bc8d044bd8ce138da2dd4d6d241a1aac8c0437695d49bfd480a1dff6e6dbca6e4774904abe2a15e5be2028d700d21d7538f6684a56095e228933a19d6c2e77d
data/Gemfile.lock CHANGED
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- getaround_utils (0.2.27)
4
+ getaround_utils (0.2.28)
5
+ rack (~> 2.0)
5
6
 
6
7
  GEM
7
8
  remote: https://rubygems.org/
@@ -17,6 +17,9 @@ Gem::Specification.new do |gem|
17
17
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
18
18
  end
19
19
 
20
+ # Common dependencies
21
+ gem.add_dependency 'rack', '~> 2.0'
22
+
20
23
  # Development dependencies
21
24
  gem.add_development_dependency 'bundler', '~> 2.0'
22
25
  gem.add_development_dependency 'getaround-rubocop', '= 0.2.8'
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+ require 'rack'
5
+
6
+ module GetaroundUtils; end
7
+
8
+ module GetaroundUtils::Engines; end
9
+
10
+ module GetaroundUtils::Engines::Health
11
+ RELEASE_VERSION_PATH = '/health/release_version'
12
+ COMMIT_SHA1_PATH = '/health/commit_sha1'
13
+ MIGRATION_STATUS_PATH = '/health/migration_status'
14
+ UNDEFINED = 'N/A'
15
+
16
+ def self.release_version
17
+ ENV['HEROKU_RELEASE_VERSION'] || ENV['PORTER_STACK_REVISION'] || ENV['PORTER_POD_REVISION']
18
+ end
19
+
20
+ def self.commit_sha1
21
+ ENV['HEROKU_SLUG_COMMIT'] || ENV['COMMIT_SHA1']
22
+ end
23
+
24
+ def self.needs_migration?
25
+ return false unless defined?(ActiveRecord)
26
+
27
+ ActiveRecord::Base.connection.migration_context.needs_migration?
28
+ end
29
+
30
+ def self.engine
31
+ Rack::Builder.new do
32
+ map RELEASE_VERSION_PATH do
33
+ use Rack::Head
34
+
35
+ run(lambda do |env|
36
+ req = Rack::Request.new(env)
37
+ return [405, { 'Content-Type' => 'text/plain' }, []] unless req.get?
38
+
39
+ content = GetaroundUtils::Engines::Health.release_version || UNDEFINED
40
+ [200, { 'Content-Type' => 'text/plain' }, [content]]
41
+ end)
42
+ end
43
+
44
+ map COMMIT_SHA1_PATH do
45
+ use Rack::Head
46
+
47
+ run(lambda do |env|
48
+ req = Rack::Request.new(env)
49
+ return [405, { 'Content-Type' => 'text/plain' }, []] unless req.get?
50
+
51
+ content = GetaroundUtils::Engines::Health.commit_sha1 || UNDEFINED
52
+ [200, { 'Content-Type' => 'text/plain' }, [content]]
53
+ end)
54
+ end
55
+
56
+ map MIGRATION_STATUS_PATH do
57
+ use Rack::Head
58
+
59
+ run(lambda do |env|
60
+ req = Rack::Request.new(env)
61
+ return [405, { 'Content-Type' => 'application/json' }, []] unless req.get?
62
+
63
+ content = { needs_migration: GetaroundUtils::Engines::Health.needs_migration? }
64
+ [200, { 'Content-Type' => 'application/json' }, [JSON.generate(content)]]
65
+ end)
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'getaround_utils/engines/health'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GetaroundUtils
4
- VERSION = '0.2.27'
4
+ VERSION = '0.2.28'
5
5
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'getaround_utils/engines'
3
4
  require 'getaround_utils/mixins'
4
5
  require 'getaround_utils/ougai'
5
6
  require 'getaround_utils/utils'
metadata CHANGED
@@ -1,16 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: getaround_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.27
4
+ version: 0.2.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Drivy
8
8
  - Laurent Humez
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-09-05 00:00:00.000000000 Z
12
+ date: 2023-11-24 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rack
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '2.0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '2.0'
14
28
  - !ruby/object:Gem::Dependency
15
29
  name: bundler
16
30
  requirement: !ruby/object:Gem::Requirement
@@ -233,6 +247,8 @@ files:
233
247
  - README.md
234
248
  - getaround_utils.gemspec
235
249
  - lib/getaround_utils.rb
250
+ - lib/getaround_utils/engines.rb
251
+ - lib/getaround_utils/engines/health.rb
236
252
  - lib/getaround_utils/mixins.rb
237
253
  - lib/getaround_utils/mixins/loggable.rb
238
254
  - lib/getaround_utils/ougai.rb
@@ -248,7 +264,7 @@ homepage: https://github.com/drivy
248
264
  licenses:
249
265
  - MIT
250
266
  metadata: {}
251
- post_install_message:
267
+ post_install_message:
252
268
  rdoc_options: []
253
269
  require_paths:
254
270
  - lib
@@ -264,7 +280,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
264
280
  version: '0'
265
281
  requirements: []
266
282
  rubygems_version: 3.1.6
267
- signing_key:
283
+ signing_key:
268
284
  specification_version: 4
269
285
  summary: Backend shared utility classes
270
286
  test_files: []