okcomputer 1.18.3 → 1.18.4

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: 1d75f6ac70b72178da8aba2204e535d0e99453cafa7e2bf969cb436d0c96c540
4
- data.tar.gz: 5492a49d928732c3353f95836f3dbf11bf6b105fefd6a1223590ca3aa8c456fa
3
+ metadata.gz: 964bccbd2510184da0f52827f5558f8745076a8c8725745a9c7659b04779c6db
4
+ data.tar.gz: 4525ecd9968072a9f2be2da58dbbe63d238e55800168e3e3b3b26006335f79a7
5
5
  SHA512:
6
- metadata.gz: a6ed7187a87456d8fbe37ac6feb097a4d49cea0b6eb7b5111b4b48f47a586f234d7b8630887a590ac64b4fbb9ed81dadeb2c05b75d7ec2615cf4c71d918b4c2e
7
- data.tar.gz: 9c8b8b2af22dd1dc38a10d2a2c2a8ef06b98814c4153d1deb57f76e107bc7496a377f57e1761304a671e5d374a5e39151b2c7e8e898bca588d130fccb6e099b8
6
+ metadata.gz: 76d6c635b55919898267bcbdb48e4a2da3342c52316038427d6771d2f277890ddd88f9389a9016a41ee2c2c0e7cb28f7a1a1b2cf5a3535ba9122724fac8eb961
7
+ data.tar.gz: 4be31489a2a1bf21d5e91aff93f675cbbe75e30c2cfbeea3687faed27ab204965e1e75765fb7c02e0b57eb6620b8ae07824e596eff3520c607009608a9405443
@@ -5,6 +5,21 @@ module OkComputer
5
5
  # * Otherwise, checks for Capistrano's REVISION file in the app root.
6
6
  # * Failing these, the check fails
7
7
  class AppVersionCheck < Check
8
+ attr_accessor :file
9
+ attr_accessor :env
10
+ attr_accessor :transform
11
+
12
+ # Public: Initialize a check for a backed-up Sidekiq queue
13
+ #
14
+ # file - The path of the version file to check
15
+ # env - The key in ENV to check for a revision SHA
16
+ # transform - The block to optionally transform the version string
17
+ def initialize(file: "REVISION", env: "SHA", &transform)
18
+ self.file = file
19
+ self.env = env
20
+ self.transform = transform || proc { |v| v }
21
+ end
22
+
8
23
  # Public: Return the application version
9
24
  def check
10
25
  mark_message "Version: #{version}"
@@ -17,21 +32,20 @@ module OkComputer
17
32
  #
18
33
  # Returns a String
19
34
  def version
20
- version_from_env || version_from_file || raise(UnknownRevision)
35
+ transform.call(version_from_env || version_from_file || raise(UnknownRevision))
21
36
  end
22
37
 
23
38
  private
24
39
 
25
40
  # Private: Version stored in environment variable
26
41
  def version_from_env
27
- ENV["SHA"]
42
+ ENV[env]
28
43
  end
29
44
 
30
45
  # Private: Version stored in Capistrano revision file
31
46
  def version_from_file
32
- if File.exist?(Rails.root.join("REVISION"))
33
- File.read(Rails.root.join("REVISION")).chomp
34
- end
47
+ path = Rails.root.join(file)
48
+ File.read(path).chomp if File.exist?(path)
35
49
  end
36
50
 
37
51
  UnknownRevision = Class.new(StandardError)
@@ -1,3 +1,3 @@
1
1
  module OkComputer
2
- VERSION = '1.18.3'
2
+ VERSION = '1.18.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: okcomputer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.18.3
4
+ version: 1.18.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Byrne