soa_doctor 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,25 +1,61 @@
1
1
  # Healthcheck
2
2
 
3
- In software oriented architecture happens that you have a lot of services.
3
+ In service oriented architecture happens that you have a lot of services.
4
4
  They can crash sometimes on Heroku or else where you host them. This gem will help to quickly check their heart beat.
5
5
 
6
6
  ## Installation
7
7
 
8
- Add this line to your application's Gemfile:
8
+ $ gem install soa_doctor
9
9
 
10
- gem 'soa_doctor'
10
+ ## Usage
11
+ If you install the gem it'll give the executable:
12
+ $ healthcheck --help
11
13
 
12
- And then execute:
14
+ For example you have YAML file with your services listed:
15
+
16
+ services:
17
+ google: "http://google.com"
18
+ yahoo: "http://yahoo.com"
19
+ yandex: "http://yandex.com"
20
+
21
+ So you do
22
+ $ healthcheck -f you_yaml_file.yaml
13
23
 
14
- $ bundle
24
+ The output would be a table or services and their statuses.
15
25
 
16
- Or install it yourself as:
26
+ P.S: One more note, since soa_doctor uses escort it stores a ~/.healthcheck file at your home dir. It looks like this:
17
27
 
18
- $ gem install soa_doctor
28
+ ```json
29
+ {
30
+ "global": {
31
+ "options": {
32
+ "file": null,
33
+ "config": null,
34
+ "verbosity": "WARN",
35
+ "error_output_format": "basic"
36
+ },
37
+ "commands": {
38
+ "escort": {
39
+ "options": {
40
+ "create_config": null,
41
+ "create_default_config": null,
42
+ "update_config": null,
43
+ "update_default_config": null
44
+ },
45
+ "commands": {
46
+ }
47
+ }
48
+ }
49
+ },
50
+ "user": {
51
+ }
52
+ }
19
53
 
20
- ## Usage
54
+ ```
21
55
 
22
- healthcheck --help
56
+ You can modify the file dir so it'll pick it up as default. So you can run simply:
57
+ $ healthcheck
58
+ And get the desired output.
23
59
 
24
60
  ## Contributing
25
61
 
@@ -7,19 +7,26 @@ module SoaDoctor
7
7
  rows = []
8
8
  file = ::YAML.load_file(command_options[:file])
9
9
  file["services"].each_pair do |k, v|
10
- begin
11
- req = Thread.new(v) { |page|
12
- ::Net::HTTP.get_response(URI(page))
13
- }
14
- req = ::Net::HTTP.get_response(URI(v))
15
- rows << [k, req.code, req.message]
10
+ Thread.new(v) { |page|
11
+ begin
12
+ req = ::Net::HTTP.get_response(URI(page))
13
+ rows << [k, req.code, req.message]
14
+ rescue Exception => e
15
+ rows << [k, { :value => e.inspect, :colspan => 2 }]
16
+ end
16
17
 
17
- rescue Exception => e
18
- rows << [k, { :value => e.inspect, :colspan => 2 }]
19
- end
18
+ clear!
19
+ puts ::Terminal::Table.new(:headings => ['Service', 'Status', 'Message'], :rows => rows)
20
+ }.join
20
21
  end
21
22
 
22
- ::Terminal::Table.new :headings => ['Service', 'Status', 'Message'], :rows => rows
23
+ clear!
24
+ ::Terminal::Table.new(:headings => ['Service', 'Status', 'Message'], :rows => rows)
25
+ end
26
+
27
+ def clear!
28
+ # Clear screen, OMG! Any other way to do it?
29
+ puts "\e[H\e[2J"
23
30
  end
24
31
  end
25
32
  end
@@ -1,3 +1,3 @@
1
1
  module SoaDoctor
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soa_doctor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-21 00:00:00.000000000 Z
12
+ date: 2013-05-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: escort
@@ -158,3 +158,4 @@ summary: Imagine you have a tons of services running somewhere on heroku or else
158
158
  test_files:
159
159
  - spec/commands/status_check_spec.rb
160
160
  - spec/spec_helper.rb
161
+ has_rdoc: