alive_state 1.0.1 → 1.1.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: d6a1970fbece8eabbc02e5172a82ecc8dd0d3533
4
- data.tar.gz: 0e71fbcb6e96a361b1e9572a8adf77c2a310fe42
3
+ metadata.gz: 69dd30f20ea7b65fe725211131cef1b71c5946b5
4
+ data.tar.gz: 49540e42baa065b1541bc1add1941ff397aaa3d9
5
5
  SHA512:
6
- metadata.gz: 3bc44a92ef0977ce626f2bbe714326fa8508b73ecb0f6bdee387ac291078829a67028ffcd571fc349716cbedc7ec20439cbb5628bc25de2f60a999087df9b478
7
- data.tar.gz: e16a1189e33b3236b8774eab3f6461884a22c13c9be1ed9422eebe8a9ab80f9f7ae3fe6db204c9f7a8d102d72b99a525f00f8eebf6da5cf1dc75de1b200c0f0c
6
+ metadata.gz: 95d21b7bdbfd6bdd9a314ca49b76b9f77fb881ca39996c87fb5da4501499863eba1c9bbfb0333877578579a23cfed81e8a75c94b3664752f0de1ca0b254655fd
7
+ data.tar.gz: cfd5caae08fc53520b5d4fbf489bb29b2fcd93eb55947a6db02e77650b5270c6c65ae968b85a1275b36cbf935606f11becbb51b5ad7abf90f7463ef09fab9d35
data/README.md CHANGED
@@ -32,6 +32,7 @@ Response in the format of json:
32
32
  {
33
33
  "state": "green",
34
34
  "observed_at": "2014-03-21T12:34:56.789",
35
+ "version": "2.0.0 as40321",
35
36
  "application": {
36
37
  "active_record": true
37
38
  }
@@ -1,6 +1,7 @@
1
1
  require 'alive_state/version'
2
2
  require 'alive_state/configure'
3
3
  require 'alive_state/default'
4
+ require 'alive_state/info'
4
5
  require 'alive_state/registry'
5
6
  require 'alive_state/application'
6
7
  require 'alive_state/middleware'
@@ -1,7 +1,7 @@
1
1
  module AliveState
2
2
  module Configure
3
3
  class << self
4
- attr_accessor :path, :format, :insert_middleware
4
+ attr_accessor :path, :format, :insert_middleware, :version
5
5
 
6
6
  def setup
7
7
  keys.each do |key|
@@ -3,6 +3,7 @@ module AliveState
3
3
  PATH = 'status'.freeze
4
4
  FORMAT = 'json'.freeze
5
5
  InsertMiddleware = true.freeze
6
+ VERSION = ''.freeze
6
7
 
7
8
  class << self
8
9
  def options
@@ -20,6 +21,10 @@ module AliveState
20
21
  def insert_middleware
21
22
  InsertMiddleware
22
23
  end
24
+
25
+ def version
26
+ VERSION
27
+ end
23
28
  end
24
29
  end
25
30
  end
@@ -0,0 +1,38 @@
1
+ module AliveState
2
+ module Info
3
+ class << self
4
+ def version
5
+ @version ||= read_file
6
+ end
7
+
8
+ def reversion
9
+ @reversion ||= read_git
10
+ end
11
+
12
+ def version_format
13
+ [self.version, self.reversion].join(' ').strip
14
+ end
15
+
16
+ private
17
+ def read_file
18
+ File.read(AliveState.config.version).strip
19
+ rescue
20
+ ''
21
+ end
22
+
23
+ def read_git
24
+ raw = ''
25
+ cmd = 'git log --pretty=format:%h -n 1'
26
+ IO.popen(cmd, 'r') do |stdout|
27
+ stdout.each do |row|
28
+ raw << row
29
+ end
30
+ end
31
+ raw.chomp
32
+ rescue
33
+ ''
34
+ end
35
+ # end private
36
+ end
37
+ end
38
+ end
@@ -22,6 +22,7 @@ module AliveState
22
22
  raw = {
23
23
  state: :green,
24
24
  observed_at: Time.current.to_s,
25
+ version: AliveState::Info.version_format,
25
26
  application: {}
26
27
  }
27
28
 
@@ -1,3 +1,3 @@
1
1
  module AliveState
2
- VERSION = '1.0.1'.freeze
2
+ VERSION = '1.1.0'.freeze
3
3
  end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe AliveState::Info do
4
+ describe "version" do
5
+ it "returns info version" do
6
+ expect(AliveState::Info.version).not_to be_nil
7
+ end
8
+ end
9
+
10
+ describe "reversion" do
11
+ it "returns info reversion" do
12
+ expect(AliveState::Info.reversion).not_to be_nil
13
+ end
14
+ end
15
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alive_state
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ogom
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-12 00:00:00.000000000 Z
11
+ date: 2015-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -56,11 +56,13 @@ files:
56
56
  - lib/alive_state/application.rb
57
57
  - lib/alive_state/configure.rb
58
58
  - lib/alive_state/default.rb
59
+ - lib/alive_state/info.rb
59
60
  - lib/alive_state/middleware.rb
60
61
  - lib/alive_state/rails.rb
61
62
  - lib/alive_state/registry.rb
62
63
  - lib/alive_state/version.rb
63
64
  - spec/alive_state_spec.rb
65
+ - spec/lib/info_spec.rb
64
66
  - spec/lib/version_spec.rb
65
67
  - spec/spec_helper.rb
66
68
  homepage: http://ogom.github.io/alive_state
@@ -89,5 +91,6 @@ specification_version: 4
89
91
  summary: Alive Application State.
90
92
  test_files:
91
93
  - spec/alive_state_spec.rb
94
+ - spec/lib/info_spec.rb
92
95
  - spec/lib/version_spec.rb
93
96
  - spec/spec_helper.rb