lex-health 0.1.1 → 0.1.2

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: 4ce775857c216326a67307d19fbbdbd7b728b3f528041f60026310d3f1b57f59
4
- data.tar.gz: 89a62746f34936499b4d4a4fbfa4be4db00e3eba5f037cbe1356b48007854ab7
3
+ metadata.gz: de2f856755c6d39dace2d6f9f6bbc423beeb343eb67f740ff529f5331b5e83a5
4
+ data.tar.gz: c38df4676acaf03b95df03d825182588abfeda5d55dbe73c4b797daac96236db
5
5
  SHA512:
6
- metadata.gz: 418817d7bed99e8dd710600a98bdde35ee5d19d494ed7c77fa561f685b6d4f9bf5dbd4be77c3b5b5bc61b41bf6bb819a8e167dda3ee1efca741e2fcd330ee434
7
- data.tar.gz: de7d737ec53ca7ede4a0eb0530e23719fc029b32669a7d7c1d477f8ca8305ad4b79631c01d1e7c9c10635e035a1eec9fdba86dd5d346794849c89c48ceba7f5e
6
+ metadata.gz: 2e8377833cb61ba9cadaba696ffe53a78c901b589fd9d107e1d229d949add88b8829d44881e929a7210f5b4171f6bfe8d0091a093986e091f8422d9f09e2ccd2
7
+ data.tar.gz: cd7869647877e7ee40a03aa23ebd6a597d31bc7cfeb38c3c6582051f9288e506e6cf04fbc55d34f06269eb7442ac4853d728b1e43a7b45d4ef4e0e6bbf74ce48
@@ -6,6 +6,8 @@ Metrics/ClassLength:
6
6
  Max: 1500
7
7
  Metrics/BlockLength:
8
8
  Max: 50
9
+ Metrics/AbcSize:
10
+ Max: 25
9
11
  Layout/SpaceAroundEqualsInParameterDefault:
10
12
  EnforcedStyle: space
11
13
  Style/SymbolArray:
@@ -1,17 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lex-health (0.1.0)
4
+ lex-health (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
9
  ast (2.4.1)
10
- codecov (0.2.2)
11
- colorize
10
+ codecov (0.2.8)
12
11
  json
13
12
  simplecov
14
- colorize (0.8.1)
15
13
  diff-lcs (1.4.4)
16
14
  docile (1.3.2)
17
15
  json (2.3.1)
@@ -35,25 +33,25 @@ GEM
35
33
  diff-lcs (>= 1.2.0, < 2.0)
36
34
  rspec-support (~> 3.9.0)
37
35
  rspec-support (3.9.3)
38
- rubocop (0.88.0)
36
+ rubocop (0.89.1)
39
37
  parallel (~> 1.10)
40
38
  parser (>= 2.7.1.1)
41
39
  rainbow (>= 2.2.2, < 4.0)
42
40
  regexp_parser (>= 1.7)
43
41
  rexml
44
- rubocop-ast (>= 0.1.0, < 1.0)
42
+ rubocop-ast (>= 0.3.0, < 1.0)
45
43
  ruby-progressbar (~> 1.7)
46
44
  unicode-display_width (>= 1.4.0, < 2.0)
47
- rubocop-ast (0.2.0)
48
- parser (>= 2.7.0.1)
45
+ rubocop-ast (0.3.0)
46
+ parser (>= 2.7.1.4)
49
47
  rubocop-md (0.4.0)
50
48
  rubocop (~> 0.60)
51
49
  rubocop-performance (1.7.1)
52
50
  rubocop (>= 0.82.0)
53
- rubocop-rspec (1.42.0)
54
- rubocop (>= 0.87.0)
51
+ rubocop-rspec (1.43.1)
52
+ rubocop (~> 0.87)
55
53
  ruby-progressbar (1.10.1)
56
- simplecov (0.18.5)
54
+ simplecov (0.19.0)
57
55
  docile (~> 1.1)
58
56
  simplecov-html (~> 0.11)
59
57
  simplecov-html (0.12.2)
data/README.md CHANGED
@@ -1,38 +1,25 @@
1
1
  # Legion::Extensions::Health
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/legion/extensions/health`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ A Legion extension that subscribes to `Exchange: nodes` and then updates the database with node status messages
6
4
 
7
5
  ## Installation
8
6
 
9
7
  Add this line to your application's Gemfile:
10
8
 
11
9
  ```ruby
12
- gem 'legion-extensions-health'
10
+ gem 'lex-health'
13
11
  ```
14
12
 
15
13
  And then execute:
16
14
 
17
- $ bundle
15
+ $ bundle install
18
16
 
19
17
  Or install it yourself as:
20
18
 
21
- $ gem install legion-extensions-health
19
+ $ gem install lex-health
22
20
 
23
21
  ## Usage
24
-
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
-
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
-
33
- ## Contributing
34
-
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/legion-extensions-health.
22
+ *To be added*
36
23
 
37
24
  ## License
38
25
 
@@ -12,10 +12,11 @@ Gem::Specification.new do |spec|
12
12
  spec.description = 'Used to read heartbeats and update the db'
13
13
  spec.homepage = 'https://bitbucket.org/legion-io/lex-health'
14
14
  spec.license = 'MIT'
15
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
15
16
 
16
17
  spec.metadata['homepage_uri'] = spec.homepage
17
- spec.metadata['source_code_uri'] = 'https://bitbucket.org/legion-io/lex-heartbeat'
18
- spec.metadata['changelog_uri'] = 'https://bitbucket.org/legion-io/lex-heartbeat/CHANGELOG.md'
18
+ spec.metadata['source_code_uri'] = 'https://bitbucket.org/legion-io/lex-health'
19
+ spec.metadata['changelog_uri'] = 'https://bitbucket.org/legion-io/lex-health/CHANGELOG.md'
19
20
 
20
21
  # Specify which files should be added to the gem when it is released.
21
22
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -3,7 +3,7 @@ module Legion::Extensions::Health
3
3
  module Health
4
4
  include Legion::Extensions::Helpers::Lex
5
5
 
6
- def self.update(hostname:, **opts)
6
+ def update(hostname:, **opts)
7
7
  item = Legion::Data::Model::Node.where(name: hostname).first
8
8
 
9
9
  return { success: insert(hostname: hostname, **opts), hostname: hostname, **opts } if item.nil?
@@ -19,7 +19,7 @@ module Legion::Extensions::Health
19
19
  { success: item.update(active: 1, status: opts[:status], name: hostname), hostname: hostname, **opts }
20
20
  end
21
21
 
22
- def self.insert(hostname:, status: 'unknown', **opts)
22
+ def insert(hostname:, status: 'unknown', **opts)
23
23
  insert = { active: 1, status: status, name: hostname }
24
24
  insert[:datacenter_id] = opts[:datacenter_id] if opts.key? :datacenter_id
25
25
  insert[:environment_id] = opts[:environment_id] if opts.key? :environment_id
@@ -28,8 +28,7 @@ module Legion::Extensions::Health
28
28
  { success: true, hostname: hostname, node_id: Legion::Data::Model::Node.insert(insert), **insert }
29
29
  end
30
30
 
31
- def self.delete(node_id:, **_opts)
32
- # Legion::Data::Model::Node.where(payload[:key].to_sym == payload[:value]).delete
31
+ def delete(node_id:, **_opts)
33
32
  Legion::Data::Model::Node[node_id].delete
34
33
  { success: true, node_id: node_id }
35
34
  end
@@ -8,12 +8,6 @@ module Legion::Extensions::Health::Transport::Messages
8
8
  5000
9
9
  end
10
10
 
11
- # def message
12
- # hash = { hostname: Socket.gethostname, pid: Process.pid, timestamp: Time.now }
13
- # hash[:status] = @options[:status].nil? ? 'healthy' : @options[:status]
14
- # hash
15
- # end
16
-
17
11
  def validate
18
12
  raise 'status should be a string' unless @options[:status].is_a?(String) || @options[:status].nil?
19
13
 
@@ -1,7 +1,7 @@
1
1
  module Legion
2
2
  module Extensions
3
3
  module Health
4
- VERSION = '0.1.1'.freeze
4
+ VERSION = '0.1.2'.freeze
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lex-health
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miverson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-21 00:00:00.000000000 Z
11
+ date: 2020-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -155,8 +155,8 @@ licenses:
155
155
  - MIT
156
156
  metadata:
157
157
  homepage_uri: https://bitbucket.org/legion-io/lex-health
158
- source_code_uri: https://bitbucket.org/legion-io/lex-heartbeat
159
- changelog_uri: https://bitbucket.org/legion-io/lex-heartbeat/CHANGELOG.md
158
+ source_code_uri: https://bitbucket.org/legion-io/lex-health
159
+ changelog_uri: https://bitbucket.org/legion-io/lex-health/CHANGELOG.md
160
160
  post_install_message:
161
161
  rdoc_options: []
162
162
  require_paths:
@@ -165,7 +165,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
165
165
  requirements:
166
166
  - - ">="
167
167
  - !ruby/object:Gem::Version
168
- version: '0'
168
+ version: 2.5.0
169
169
  required_rubygems_version: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - ">="