opswatch 0.1.0
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 +7 -0
- data/.circleci/config.yml +55 -0
- data/.gitignore +9 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/CREDITS.md +1 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +648 -0
- data/LICENSE.txt +21 -0
- data/README.md +60 -0
- data/Rakefile +10 -0
- data/bin/console +7 -0
- data/bin/opswatch +7 -0
- data/bin/setup +6 -0
- data/fonts/arial.ttf +0 -0
- data/icons/hold.png +0 -0
- data/icons/hold.svg +23 -0
- data/icons/negative.png +0 -0
- data/icons/negative.svg +14 -0
- data/icons/off.png +0 -0
- data/icons/off.svg +14 -0
- data/icons/positive.png +0 -0
- data/icons/positive.svg +11 -0
- data/lib/aws_poller.rb +28 -0
- data/lib/configuration.rb +45 -0
- data/lib/icon.rb +40 -0
- data/lib/icon_pack.rb +23 -0
- data/lib/ops_tray.rb +43 -0
- data/lib/opswatch.rb +37 -0
- data/lib/opswatch/version.rb +3 -0
- data/opswatch.gemspec +32 -0
- metadata +174 -0
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Gianluca Rizzo
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# Opswatch [](https://circleci.com/gh/gianlucarizzo/opswatch)
|
2
|
+
|
3
|
+
Version 0.1.0 (first release)
|
4
|
+
|
5
|
+
OpsWatch lets you track your AWS OpsWorks stacks status in real time on your traybar with a single glance.
|
6
|
+
Easy to configure and to use. This first version has no fancy features, but new features and ideas are welcome!
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
To install simply use
|
11
|
+
```
|
12
|
+
gem install opswatch
|
13
|
+
```
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
First rum will ask you to input Amazon AWS stack information:
|
18
|
+
```
|
19
|
+
opswatch
|
20
|
+
Let's set things up
|
21
|
+
Stack Name (can be anything):
|
22
|
+
Production
|
23
|
+
Region (e.g. eu-central-1):
|
24
|
+
eu-central-1
|
25
|
+
IAM User key:
|
26
|
+
XXXXXXXXX
|
27
|
+
IAM User secret:
|
28
|
+
XXXXXXXXX
|
29
|
+
OpsWorks Stack ID:
|
30
|
+
id1234567
|
31
|
+
Insert other Stack? (Y/n)
|
32
|
+
n
|
33
|
+
```
|
34
|
+
a file `.opswatch.yml` in your $HOME path will be created to store your configuration, and the traybar will be shown on your UI.
|
35
|
+
|
36
|
+
After this, you need to simply run
|
37
|
+
``
|
38
|
+
opswatch
|
39
|
+
``
|
40
|
+
again to use the last settings.
|
41
|
+
|
42
|
+
If you want to start from scratch you can just delete the `.opswatch.yml` file.
|
43
|
+
|
44
|
+
## Development
|
45
|
+
|
46
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
47
|
+
|
48
|
+
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).
|
49
|
+
|
50
|
+
## Contributing
|
51
|
+
|
52
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/gianlucarizzo/opswatch. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
53
|
+
|
54
|
+
## License
|
55
|
+
|
56
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
57
|
+
|
58
|
+
## Code of Conduct
|
59
|
+
|
60
|
+
Everyone interacting in the Opswatch project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/opswatch/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
data/bin/opswatch
ADDED
data/bin/setup
ADDED
data/fonts/arial.ttf
ADDED
Binary file
|
data/icons/hold.png
ADDED
Binary file
|
data/icons/hold.svg
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!-- Generator: Adobe Illustrator 17.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
3
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
4
|
+
<svg version="1.1" id="Livello_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
5
|
+
width="566.93px" height="566.93px" viewBox="0 0 566.93 566.93" enable-background="new 0 0 566.93 566.93" xml:space="preserve">
|
6
|
+
<rect x="340.33" y="291.464" fill="#E8CB51" width="212.598" height="212.598"/>
|
7
|
+
<path fill="#E8CB51" d="M46.79,243.211l-33.732-13.238c-4.846,16.065-7.845,32.93-8.745,50.351h35.946
|
8
|
+
C41.124,267.532,43.352,255.115,46.79,243.211z"/>
|
9
|
+
<path fill="#E8CB51" d="M47.639,162.468c-10.862,14.211-19.979,29.828-27.017,46.537l33.702,13.226
|
10
|
+
c5.882-13.608,13.438-26.319,22.38-37.905L47.639,162.468z"/>
|
11
|
+
<path fill="#E8CB51" d="M113.333,105.613c-19.074,10.626-36.345,24.099-51.231,39.852l29.322,22.052
|
12
|
+
c11.716-11.777,25.082-21.907,39.714-30.033L113.333,105.613z"/>
|
13
|
+
<path fill="#E8CB51" d="M199.473,79.566c-23.294,1.86-45.526,7.474-66.096,16.238l17.93,32.095
|
14
|
+
c15.138-6.05,31.304-10.071,48.166-11.729V79.566z"/>
|
15
|
+
<g>
|
16
|
+
<path fill="#E8CB51" d="M46.743,341.536c-3.587-12.468-5.849-25.497-6.607-38.93H4.312c0.842,16.305,3.533,32.12,7.846,47.251
|
17
|
+
L46.743,341.536z"/>
|
18
|
+
<path fill="#E8CB51" d="M227.896,79.166v36.477c92.77,5.63,166.27,82.636,166.27,176.822c0,97.846-79.32,177.165-177.165,177.165
|
19
|
+
c-72.915,0-135.522-44.056-162.698-106.995l-34.877,8.392c31.494,77.995,107.894,133.037,197.174,133.037
|
20
|
+
c117.415,0,212.598-95.184,212.598-212.598C429.197,177.84,340.058,85.039,227.896,79.166z"/>
|
21
|
+
</g>
|
22
|
+
<polygon fill="#E7CA50" points="248,162.468 213.52,296.477 102,375 255,326.231 "/>
|
23
|
+
</svg>
|
data/icons/negative.png
ADDED
Binary file
|
data/icons/negative.svg
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!-- Generator: Adobe Illustrator 17.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
3
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
4
|
+
<svg version="1.1" id="Livello_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
5
|
+
width="566.93px" height="566.93px" viewBox="0 0 566.93 566.93" enable-background="new 0 0 566.93 566.93" xml:space="preserve">
|
6
|
+
<path fill="#E94F36" d="M216.598,78.867C99.184,78.867,4,174.05,4,291.465s95.184,212.598,212.598,212.598
|
7
|
+
s212.598-95.184,212.598-212.598S334.013,78.867,216.598,78.867z M217,469.63c-97.846,0-177.165-79.32-177.165-177.165
|
8
|
+
S119.154,115.3,217,115.3s177.165,79.32,177.165,177.165S314.846,469.63,217,469.63z"/>
|
9
|
+
<rect x="340.33" y="291.464" fill="#E94F36" width="212.598" height="212.598"/>
|
10
|
+
<polygon fill="#E94F36" points="123.5,375.465 197.5,275.465 230.5,314.465 "/>
|
11
|
+
<polygon fill="#E94F36" points="304.5,214.465 230.5,314.465 197.5,275.465 "/>
|
12
|
+
<polygon fill="#E94F36" points="293,384.465 193,310.465 232,277.465 "/>
|
13
|
+
<polygon fill="#E94F36" points="132,203.465 232,277.465 193,310.465 "/>
|
14
|
+
</svg>
|
data/icons/off.png
ADDED
Binary file
|
data/icons/off.svg
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!-- Generator: Adobe Illustrator 17.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
3
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
4
|
+
<svg version="1.1" id="Livello_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
5
|
+
width="566.93px" height="566.93px" viewBox="0 0 566.93 566.93" enable-background="new 0 0 566.93 566.93" xml:space="preserve">
|
6
|
+
<path fill="#BBBBBB" d="M216.598,78.867C99.184,78.867,4,174.05,4,291.465s95.184,212.598,212.598,212.598
|
7
|
+
s212.598-95.184,212.598-212.598S334.013,78.867,216.598,78.867z M217,469.63c-97.846,0-177.165-79.32-177.165-177.165
|
8
|
+
S119.154,115.3,217,115.3s177.165,79.32,177.165,177.165S314.846,469.63,217,469.63z"/>
|
9
|
+
<rect x="340.33" y="291.464" fill="#BCBCBB" width="212.598" height="212.598"/>
|
10
|
+
<path fill="#BBBBBB" d="M218.598,221.599c-39.138,0-70.866,31.728-70.866,70.866c0,39.138,31.728,70.866,70.866,70.866
|
11
|
+
c39.138,0,70.866-31.728,70.866-70.866C289.465,253.327,257.737,221.599,218.598,221.599z M218.598,336.52
|
12
|
+
c-23.483,0-42.52-19.037-42.52-42.52s19.037-42.52,42.52-42.52c23.483,0,42.52,19.037,42.52,42.52S242.081,336.52,218.598,336.52z"
|
13
|
+
/>
|
14
|
+
</svg>
|
data/icons/positive.png
ADDED
Binary file
|
data/icons/positive.svg
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!-- Generator: Adobe Illustrator 17.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
3
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
4
|
+
<svg version="1.1" id="Livello_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
5
|
+
width="566.93px" height="566.93px" viewBox="0 0 566.93 566.93" enable-background="new 0 0 566.93 566.93" xml:space="preserve">
|
6
|
+
<path fill="#57B35F" d="M216.598,78.867C99.184,78.867,4,174.05,4,291.465s95.184,212.598,212.598,212.598
|
7
|
+
s212.598-95.184,212.598-212.598S334.013,78.867,216.598,78.867z M217,469.63c-97.846,0-177.165-79.32-177.165-177.165
|
8
|
+
S119.154,115.3,217,115.3s177.165,79.32,177.165,177.165S314.846,469.63,217,469.63z"/>
|
9
|
+
<polygon fill="#57B35F" points="91,275 197,388 343,212 195,306 "/>
|
10
|
+
<rect x="340.332" y="291.465" fill="#57B35F" width="212.598" height="212.598"/>
|
11
|
+
</svg>
|
data/lib/aws_poller.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'aws-sdk'
|
2
|
+
|
3
|
+
module Opswatch
|
4
|
+
class AwsPoller
|
5
|
+
def initialize(params)
|
6
|
+
credentials = Aws::Credentials.new(params['iam_user'], params['iam_secret'])
|
7
|
+
@client = Aws::OpsWorks::Client.new(region: params['region'], credentials: credentials)
|
8
|
+
@stack_id = params['stack_id']
|
9
|
+
end
|
10
|
+
|
11
|
+
def poll
|
12
|
+
ret = {}
|
13
|
+
begin
|
14
|
+
stack_resp = @client.describe_stack_summary(stack_id: @stack_id)
|
15
|
+
deploy_resp = @client.describe_deployments(stack_id: @stack_id).deployments.first
|
16
|
+
ret[:online] = stack_resp.stack_summary.instances_count.online
|
17
|
+
ret[:running_setup] = stack_resp.stack_summary.instances_count.running_setup
|
18
|
+
ret[:setup_failed] = stack_resp.stack_summary.instances_count.setup_failed
|
19
|
+
ret[:start_failed] = stack_resp.stack_summary.instances_count.start_failed
|
20
|
+
ret[:deploy_state] = deploy_resp.status
|
21
|
+
ret
|
22
|
+
rescue StandardError
|
23
|
+
ret[:exception] = true
|
24
|
+
ret
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Opswatch
|
2
|
+
class Configuration
|
3
|
+
def self.load_file(filename)
|
4
|
+
local_path = "#{GEM_ROOT}/#{filename}"
|
5
|
+
global_path = File.join(ENV['HOME'], filename)
|
6
|
+
if File.exist?(local_path)
|
7
|
+
YAML.load_file(local_path)
|
8
|
+
elsif File.exist?(global_path)
|
9
|
+
YAML.load_file(global_path)
|
10
|
+
else
|
11
|
+
create_configuration
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.create_configuration
|
16
|
+
settings = {}
|
17
|
+
continue = true
|
18
|
+
puts "Let's set things up"
|
19
|
+
|
20
|
+
while continue
|
21
|
+
puts 'Stack Name (can be anything):'
|
22
|
+
name = gets.chomp
|
23
|
+
puts 'Region (e.g. eu-central-1):'
|
24
|
+
region = gets.chomp
|
25
|
+
puts 'IAM User key:'
|
26
|
+
iam_user = gets.chomp
|
27
|
+
puts 'IAM User secret:'
|
28
|
+
iam_secret = gets.chomp
|
29
|
+
puts 'OpsWorks Stack ID:'
|
30
|
+
stack_id = gets.chomp
|
31
|
+
|
32
|
+
settings[name] = { 'region' => region,
|
33
|
+
'iam_user' => iam_user,
|
34
|
+
'iam_secret' => iam_secret,
|
35
|
+
'stack_id' => stack_id }
|
36
|
+
|
37
|
+
puts 'Insert other Stack? (Y/n)'
|
38
|
+
continue = gets.chomp != 'n'
|
39
|
+
end
|
40
|
+
|
41
|
+
File.write(File.join(ENV['HOME'], '.opswatch.yml'), settings.to_yaml)
|
42
|
+
settings
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/lib/icon.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'rmagick'
|
2
|
+
require 'tempfile'
|
3
|
+
|
4
|
+
class Icon
|
5
|
+
include Magick
|
6
|
+
|
7
|
+
attr_reader :stack_name
|
8
|
+
|
9
|
+
def initialize(stack_name, source_path)
|
10
|
+
@stack_name = stack_name
|
11
|
+
@source_path = source_path
|
12
|
+
@temp_file = Tempfile.new(stack_name)
|
13
|
+
draw_initial
|
14
|
+
end
|
15
|
+
|
16
|
+
def path
|
17
|
+
@temp_file.path
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def stack_initial
|
23
|
+
@stack_name[0].upcase
|
24
|
+
end
|
25
|
+
|
26
|
+
def draw_initial
|
27
|
+
img = ImageList.new(@source_path)
|
28
|
+
drawer = Magick::Draw.new
|
29
|
+
drawer.annotate(img, 0, 0, 60, 10, stack_initial) do
|
30
|
+
self.font = "#{GEM_ROOT}/fonts/arial.ttf"
|
31
|
+
self.pointsize = 512
|
32
|
+
self.font_weight = Magick::BoldWeight
|
33
|
+
self.fill = 'white'
|
34
|
+
self.gravity = Magick::SouthEastGravity
|
35
|
+
self.stroke = 'black'
|
36
|
+
self.stroke_width = 4
|
37
|
+
end
|
38
|
+
img.write(path)
|
39
|
+
end
|
40
|
+
end
|
data/lib/icon_pack.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rmagick'
|
2
|
+
require 'tempfile'
|
3
|
+
require_relative 'icon'
|
4
|
+
|
5
|
+
module Opswatch
|
6
|
+
class IconPack
|
7
|
+
def initialize(stack_name, icon_paths = nil)
|
8
|
+
icon_paths = icon_paths || %w[hold negative off positive].map { |base_icon| [base_icon, "#{GEM_ROOT}/icons/#{base_icon}.png"] }.to_h
|
9
|
+
@stack_name = stack_name
|
10
|
+
@file_paths = generate_icons(icon_paths)
|
11
|
+
end
|
12
|
+
|
13
|
+
def fetch(key)
|
14
|
+
@file_paths[key].path
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def generate_icons(icon_paths)
|
20
|
+
icon_paths.map { |name, path| [name, Icon.new(@stack_name, path)] }.to_h
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/ops_tray.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'ruby-libappindicator'
|
2
|
+
|
3
|
+
module Opswatch
|
4
|
+
class OpsTray < AppIndicator::AppIndicator
|
5
|
+
def initialize(name, icon_pack)
|
6
|
+
super(name, "dialog-question", AppIndicator::Category::APPLICATION_STATUS)
|
7
|
+
set_menu(Gtk::Menu.new)
|
8
|
+
set_status(AppIndicator::Status::ACTIVE)
|
9
|
+
@icon_pack = icon_pack
|
10
|
+
end
|
11
|
+
|
12
|
+
def update_status(resp)
|
13
|
+
set_icon_status(compute_status(resp))
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def compute_status(resp)
|
19
|
+
ret = 'UNKNOWN_STATE'
|
20
|
+
ret = 'ONLINE' if resp[:online] && resp[:deploy_state] == 'successful'
|
21
|
+
ret = 'FAILED' if resp[:setup_failed] || resp[:start_failed] || resp[:deploy_state] == 'failed'
|
22
|
+
ret = 'OFFLINE' if resp[:online].nil? && resp[:setup_failed].nil? && resp[:start_failed].nil?
|
23
|
+
ret = 'DEPLOYING' if resp[:running_setup] || resp[:deploy_state] == 'running'
|
24
|
+
ret = 'INVALID_STATE' if resp[:exception]
|
25
|
+
ret
|
26
|
+
end
|
27
|
+
|
28
|
+
def set_icon_status(status)
|
29
|
+
case status
|
30
|
+
when 'ONLINE'
|
31
|
+
set_icon @icon_pack.fetch('positive')
|
32
|
+
when 'OFFLINE'
|
33
|
+
set_icon @icon_pack.fetch('off')
|
34
|
+
when 'DEPLOYING'
|
35
|
+
set_icon @icon_pack.fetch('hold')
|
36
|
+
when 'FAILED'
|
37
|
+
set_icon @icon_pack.fetch('negative')
|
38
|
+
when 'INVALID_STATE'
|
39
|
+
set_icon 'dialog-question'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/lib/opswatch.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
require "opswatch/version"
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
require 'ops_tray'
|
5
|
+
require 'aws_poller'
|
6
|
+
require 'icon_pack'
|
7
|
+
require 'configuration'
|
8
|
+
|
9
|
+
module Opswatch
|
10
|
+
class Main
|
11
|
+
def initialize
|
12
|
+
settings = Configuration.load_file(".opswatch.yml")
|
13
|
+
@groups = {}
|
14
|
+
settings.each do |k, v|
|
15
|
+
@groups[k] = { tray: OpsTray.new(k, IconPack.new(k)), poller: AwsPoller.new(v) }
|
16
|
+
end
|
17
|
+
|
18
|
+
Gtk.timeout_add(5000) { poll }
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.start(_argv = nil)
|
22
|
+
@instance = new
|
23
|
+
|
24
|
+
Gtk.main
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def poll
|
30
|
+
@groups.each do |_k, g|
|
31
|
+
res = g[:poller].poll
|
32
|
+
g[:tray].update_status(res)
|
33
|
+
end
|
34
|
+
true
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/opswatch.gemspec
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "opswatch/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "opswatch"
|
7
|
+
spec.version = Opswatch::VERSION
|
8
|
+
spec.authors = ["Gianluca Rizzo"]
|
9
|
+
spec.email = ["ing.rizzo.gianluca@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = 'Simple tray application that notifies the status of your Opswork stacks.'
|
12
|
+
spec.description = 'Simple tool that helps an AWS OpsWorks user to be constantly informed about the status of multiple stacks.
|
13
|
+
Uses the appindicator library to show status icon on the OS traybar.'
|
14
|
+
spec.homepage = 'https://github.com/gianlucarizzo/opswatch'
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = 'bin'
|
21
|
+
spec.executable = 'opswatch'
|
22
|
+
spec.require_paths = ['lib']
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
27
|
+
|
28
|
+
spec.add_runtime_dependency('aws-sdk', "~> 3.0.1")
|
29
|
+
spec.add_runtime_dependency('rmagick', "~> 2.16.0")
|
30
|
+
spec.add_runtime_dependency('ruby-libappindicator', "~> 0.1.5")
|
31
|
+
spec.add_runtime_dependency('app_configuration', "~> 0.0.3")
|
32
|
+
end
|