rsk_snitch 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
  SHA1:
3
- metadata.gz: 2d918e04f319d5c047cc07a4797c61474fe2faa1
4
- data.tar.gz: 99d066a75bd3a84b287e41bd03c180ad8301c1aa
3
+ metadata.gz: 235fc26d3ddf919364ec79aeb3aa27c05ce5b3fa
4
+ data.tar.gz: 4f3bf90d1a38a5eb73123594e9582b7068a12969
5
5
  SHA512:
6
- metadata.gz: a1796ebcf1c14e26e7e71433173b5caf586e6e29c00aff3c8613db6988935d266f8eee993caea419c94a65d1654bef0b596a0b2283085a37e6a0a9e08bf6a57f
7
- data.tar.gz: 1efd0208bce14e5bb10f148425bdd62fbd2b4749ea087cb08e01311e432fdaa2f9f8fb77497f192d518c97a8fbc04fb0aebeb7e76ddf989296bc72efda4b6fc3
6
+ metadata.gz: 6ad68481bfb50321e8e0584dbade2b6f7e63e6b942141df22abf555b08cc3e1c2b63388f13eb3e88e85ff0ca6def04fb56ff8dd9ea6e287fa138ae57bd1f1de4
7
+ data.tar.gz: c0a1efca73384213085985158652a84d47599edaf823a2e6dcc758a4c0f33c4f5914c407a14c2bf3fc34ff283c589c884655d69bcfe221627778114f1d0aa8e7
data/README.md CHANGED
@@ -1,12 +1,19 @@
1
1
  # RskSnitch
2
2
 
3
- Check if your rootstock node is running by looking it up in stats.rsk.co
3
+ Check if your rootstock node is running by looking it up by node id in
4
+ http://stats.rsk.co
4
5
 
5
- Can be used as a ruby library, but also provides a command line utility for your shell scripts.
6
+ Notice node ids are not always the same that show up in the stats page.
7
+
8
+ This is is the type of node id you should use: rskNode02SaEast1
9
+
10
+ This is what shows up on the stats page: rsk-node-02.sa-east-1
6
11
 
7
12
  ## Installation
8
13
 
9
- Add this line to your application's Gemfile:
14
+ $ gem install rsk_snitch
15
+
16
+ Or add this line to your application's Gemfile:
10
17
 
11
18
  ```ruby
12
19
  gem 'rsk_snitch'
@@ -16,17 +23,23 @@ And then execute:
16
23
 
17
24
  $ bundle
18
25
 
19
- Or install it yourself as:
20
-
21
- $ gem install rsk_snitch
22
26
 
23
27
  ## Usage
24
28
 
25
- In bash:
29
+ In Shell scripts:
30
+
26
31
  ```bash
27
- $ rsk_snitch rsk-node-04.eu-west-1
28
- Looking for a node with id rsk-node-04.eu-west-1, this may take a while.
32
+ $ rsk_snitch rskNode02SaEast1
33
+ Looking for a node with id rskNode02SaEast1, this may take a while.
29
34
  Found it
35
+ $ echo $?
36
+ 0
37
+ ```
38
+
39
+ As a ruby lib
40
+ ```ruby
41
+ > RskSnitch::Nodes.up?('rskNode02SaEast1')
42
+ true
30
43
  ```
31
44
 
32
45
  ## Development
@@ -1,3 +1,3 @@
1
1
  module RskSnitch
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/rsk_snitch.rb CHANGED
@@ -1,20 +1,19 @@
1
1
  require "rsk_snitch/version"
2
2
  require 'faye/websocket'
3
- require 'byebug'
4
3
 
5
4
  module RskSnitch
6
- # Checks the RSK public stats websocket to see if bitex is there
7
- # Emails admins otherwise
8
- class Nodes
9
- def self.url
10
- "ws://stats.rsk.co/primus/?_primuscb=#{Time.now.to_i}-0"
11
- end
5
+ # Checks the RSK public stats websocket to see if bitex is there
6
+ # Emails admins otherwise
7
+ class Nodes
8
+ def self.url
9
+ "ws://stats.rsk.co/primus/?_primuscb=#{Time.now.to_i}-0"
10
+ end
12
11
 
13
12
  def self.debug=(debug)
14
13
  @debug = true
15
14
  end
16
15
 
17
- def self.find(node, max_messages = 500)
16
+ def self.find(node, max_messages = 500)
18
17
  found = nil
19
18
  EM.run do
20
19
  ws = Faye::WebSocket::Client.new(url)
@@ -33,8 +32,8 @@ module RskSnitch
33
32
  end
34
33
  end
35
34
 
36
- found
37
- end
35
+ found
36
+ end
38
37
 
39
38
  def self.up?(node, retries = 10, wait = 10)
40
39
  retries.times do
@@ -43,5 +42,5 @@ module RskSnitch
43
42
  end
44
43
  false
45
44
  end
46
- end
45
+ end
47
46
  end
data/rsk_snitch.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["yo@nubis.im"]
11
11
 
12
12
  spec.summary = %q{Check if a node is reporting stats in stats.rsk.co}
13
- spec.description = %q{Check if a node is reporting stats in stats.rsk.co}
13
+ spec.description = %q{Check if a node is reporting stats in stats.rsk.co by id}
14
14
  spec.homepage = "https://github.com/bitex-la/rsk-snitch"
15
15
  spec.license = "MIT"
16
16
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsk_snitch
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
  - nubis
@@ -122,7 +122,7 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '1.0'
125
- description: Check if a node is reporting stats in stats.rsk.co
125
+ description: Check if a node is reporting stats in stats.rsk.co by id
126
126
  email:
127
127
  - yo@nubis.im
128
128
  executables: