healthier 0.1.3 → 0.1.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: e3d31d17199c50606705f54e8711cce324edaa9a2e8e56a557d73529d976ef83
4
- data.tar.gz: d63895420862e07ca45402790400cbfea4c96628827f8b157506491d14b06823
3
+ metadata.gz: 711f2ef8a3f208c3e4a4cc710fc86f73ff049a1734e0726caca32ef2d3c597f0
4
+ data.tar.gz: ceb81192506fb5d7132840da224ac48bdb6f31d216dc2867da3d2afca0bd5576
5
5
  SHA512:
6
- metadata.gz: 9a5b5e7f4a60fdf90c0ba443761f9a27ba2992b4ef5ebb534d92825df2409d9fcaa029962867ccab53ed8deef8ecf344b0557dd76d5dc19fc6428db0f472ea50
7
- data.tar.gz: 3866fec75e625ca437d672354632227901629641a97c4d04b7fb0559aa1594baee27d365e4e5fc6c59961e11009f7608560cef5df9f8a4851cc9d5c7501f52b0
6
+ metadata.gz: 4c2b4a07809bdb88f6bd292ba9b284c5b6612ca525c0929341d4757aa01a6b98a56c3c0e60a160859e8e1b93d7c41cf13dfe9f1946997ec038b15d46b3516b8f
7
+ data.tar.gz: 8b260ec426e1544f745843ede0eaa38719aa08dd75636aa6a839a65412b7308d8bc2f0a90eba950779b76571d6b8117b9cb73de389861f24f6307fe335cc4731
data/README.md CHANGED
@@ -26,23 +26,35 @@ Or install it yourself as:
26
26
  $ gem install healthier
27
27
  ```
28
28
 
29
- In your application routes.rb file:
29
+ # Installer:
30
30
 
31
- ```ruby
32
- mount Healthier::Engine => '/healthier'
31
+ ```bash
32
+ rails generate healthier:config
33
33
  ```
34
34
 
35
- In the config directory, make a healthier folder and create a file
36
- called services.yml:
37
-
35
+ This will generate these two files:
36
+ 1. config/healthier.yml
38
37
  ```yaml
39
38
  ---
40
39
  healthier:
41
40
  depends_on:
42
- - name: 'postgresql'
43
- - name: 'mongodb'
44
- - name: 'redis'
45
- - name: 'rabbitmq'
41
+ # Uncomment accordingly
42
+ # - name: 'postgresql'
43
+ # - name: 'mongodb'
44
+ # - name: 'redis'
45
+ # - name: 'rabbitmq'
46
+ ```
47
+ 2. config/initializers/healthier.rb
48
+ ```ruby
49
+ Healthier.setup do |config|
50
+ config.depends_on = config.healthier.call
51
+ end
52
+ ```
53
+
54
+ In your application routes.rb file:
55
+
56
+ ```ruby
57
+ mount Healthier::Engine => '/healthier'
46
58
  ```
47
59
 
48
60
  ENVs for basic authentication:
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Healthier
4
+ # Generates a healthier.yml
5
+ class ConfigGenerator < Rails::Generators::Base
6
+ source_root File.expand_path('templates', __dir__)
7
+
8
+ def create_healthier_file
9
+ create_file 'config/initializers/healthier.rb', <<~RUBY
10
+ # frozen_string_literal: true
11
+
12
+ Healthier.setup do |config|
13
+ config.depends_on = config.healthier.call
14
+ end
15
+ RUBY
16
+ end
17
+
18
+ def create_healthier_yaml
19
+ create_file 'config/healthier.yml', <<~YAML
20
+ ---
21
+ healthier:
22
+ # Uncomment accordingly
23
+ depends_on:
24
+ # - name: 'postgresql'
25
+ # - name: 'mongodb'
26
+ # - name: 'redis'
27
+ # - name: 'rabbitmq'
28
+ YAML
29
+ end
30
+ end
31
+ end
@@ -37,11 +37,7 @@ module Healthier
37
37
  end
38
38
 
39
39
  def conf
40
- @conf ||= YAML.load_file(config_path)['healthier']
41
- end
42
-
43
- def config_path
44
- Rails.root.join('config/healthier/services.yml')
40
+ @conf ||= Healthier.depends_on['healthier']
45
41
  end
46
42
 
47
43
  def ping_it(service)
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Healthier
4
4
  # MAJOR.MINOR.PATCH
5
- VERSION = '0.1.3'
5
+ VERSION = '0.1.4'
6
6
  end
data/lib/healthier.rb CHANGED
@@ -5,5 +5,10 @@ require 'healthier/engine'
5
5
 
6
6
  # Healthier
7
7
  module Healthier
8
- # Your code goes here...
8
+ def self.setup
9
+ yield self
10
+ end
11
+
12
+ mattr_accessor :healthier, default: -> { YAML.load_file(Rails.root.join('config/healthier.yml')) }
13
+ mattr_accessor :depends_on, default: {}
9
14
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: healthier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nima Yonten
@@ -38,6 +38,7 @@ files:
38
38
  - app/controllers/healthier/checks_controller.rb
39
39
  - app/services/basic_auth_service.rb
40
40
  - config/routes.rb
41
+ - lib/generators/healthier/config_generator.rb
41
42
  - lib/healthier.rb
42
43
  - lib/healthier/engine.rb
43
44
  - lib/healthier/version.rb