hab_version_monitor 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +46 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/hab_version_monitor +4 -0
- data/bin/setup +8 -0
- data/example/config.yml +20 -0
- data/hab_version_monitor.gemspec +33 -0
- data/lib/hab_version_monitor.rb +5 -0
- data/lib/hab_version_monitor/server.rb +35 -0
- data/lib/hab_version_monitor/version.rb +3 -0
- data/lib/hab_version_monitor/views/_nav.erb +15 -0
- data/lib/hab_version_monitor/views/config.erb +5 -0
- data/lib/hab_version_monitor/views/index.erb +23 -0
- data/lib/hab_version_monitor/views/layout.erb +11 -0
- metadata +123 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 21bfccdda41d7b38b172dc99d6632de7d2426db908a3c62520c0125ade61948a
|
4
|
+
data.tar.gz: ec41f184b92942fbb36895d109dc0ab6162e88866efe6268f0fdb9c1fd6b6fc9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3c23ae34b4f093722bcb53a1c26901b52d3c649f653de98108c22d2aad63990b6524b3d5475e2a824bdcdb85bfc0129f35dbf5ed484d70ad314fc12987cf4d82
|
7
|
+
data.tar.gz: bf258eaa6378c22a2714c202349a77931e22671505a45704fe9f4910300b89f45254704c4ad8e5d8425f560443650f89b96eb6d05dc74f943ff31f40eb6074e0
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
hab_version_monitor (0.1.0)
|
5
|
+
sinatra
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
diff-lcs (1.3)
|
11
|
+
mustermann (1.0.3)
|
12
|
+
rack (2.0.7)
|
13
|
+
rack-protection (2.0.7)
|
14
|
+
rack
|
15
|
+
rake (10.5.0)
|
16
|
+
rspec (3.9.0)
|
17
|
+
rspec-core (~> 3.9.0)
|
18
|
+
rspec-expectations (~> 3.9.0)
|
19
|
+
rspec-mocks (~> 3.9.0)
|
20
|
+
rspec-core (3.9.0)
|
21
|
+
rspec-support (~> 3.9.0)
|
22
|
+
rspec-expectations (3.9.0)
|
23
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
24
|
+
rspec-support (~> 3.9.0)
|
25
|
+
rspec-mocks (3.9.0)
|
26
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
27
|
+
rspec-support (~> 3.9.0)
|
28
|
+
rspec-support (3.9.0)
|
29
|
+
sinatra (2.0.7)
|
30
|
+
mustermann (~> 1.0)
|
31
|
+
rack (~> 2.0)
|
32
|
+
rack-protection (= 2.0.7)
|
33
|
+
tilt (~> 2.0)
|
34
|
+
tilt (2.0.10)
|
35
|
+
|
36
|
+
PLATFORMS
|
37
|
+
ruby
|
38
|
+
|
39
|
+
DEPENDENCIES
|
40
|
+
bundler (~> 2.0)
|
41
|
+
hab_version_monitor!
|
42
|
+
rake (~> 10.0)
|
43
|
+
rspec (~> 3.0)
|
44
|
+
|
45
|
+
BUNDLED WITH
|
46
|
+
2.0.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 gscho
|
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,39 @@
|
|
1
|
+
# HabVersionMonitor
|
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/hab_version_monitor`. 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
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'hab_version_monitor'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install hab_version_monitor
|
22
|
+
|
23
|
+
## 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]/hab_version_monitor.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "hab_version_monitor"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/example/config.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
pkgs:
|
2
|
+
- origin: core
|
3
|
+
name: hab
|
4
|
+
channels:
|
5
|
+
- dev
|
6
|
+
- acceptance
|
7
|
+
- stable
|
8
|
+
targets:
|
9
|
+
- x86_64-windows
|
10
|
+
- x86_64-linux
|
11
|
+
- origin: core
|
12
|
+
name: hab-sup
|
13
|
+
channels:
|
14
|
+
- stable
|
15
|
+
targets:
|
16
|
+
- x86_64-windows
|
17
|
+
- x86_64-linux
|
18
|
+
bldr_url: https://bldr.habitat.sh
|
19
|
+
refresh_interval_seconds: 30
|
20
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "hab_version_monitor/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "hab_version_monitor"
|
7
|
+
spec.version = HabVersionMonitor::VERSION
|
8
|
+
spec.authors = ["gscho"]
|
9
|
+
spec.email = ["greg.c.schofield@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = %q{Write a short summary, because RubyGems requires one.}
|
12
|
+
spec.description = %q{Write a longer description or delete this line.}
|
13
|
+
spec.homepage = "https://github.com/gscho/hab_version_monitor"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
17
|
+
spec.metadata["source_code_uri"] = "https://github.com/gscho/hab_version_monitor"
|
18
|
+
spec.metadata["changelog_uri"] = "https://github.com/gscho/hab_version_monitor/CHANGELOG.md"
|
19
|
+
|
20
|
+
# Specify which files should be added to the gem when it is released.
|
21
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
22
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
23
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
24
|
+
end
|
25
|
+
spec.bindir = "exe"
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
30
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
32
|
+
spec.add_dependency "sinatra"
|
33
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'sinatra/base'
|
2
|
+
require 'net/http'
|
3
|
+
require 'uri'
|
4
|
+
require 'json'
|
5
|
+
require 'yaml'
|
6
|
+
require 'time'
|
7
|
+
|
8
|
+
module HabVersionMonitor
|
9
|
+
class Server < Sinatra::Base
|
10
|
+
get '/' do
|
11
|
+
@pkgs = {}
|
12
|
+
config = YAML.load_file('config.yml')
|
13
|
+
@bldr_url = config['bldr_url'] || 'https://bldr.habitat.sh'
|
14
|
+
@refresh_interval_seconds = config['refresh_interval_seconds'] || 30
|
15
|
+
config['pkgs'].each do |pkg|
|
16
|
+
@pkgs[pkg['name']] = []
|
17
|
+
pkg['targets'].each do |target|
|
18
|
+
pkg['channels'].each do |channel|
|
19
|
+
uri = URI.parse("#{@bldr_url}/v1/depot/channels/#{pkg['origin']}/#{channel}/pkgs/#{pkg['name']}/latest?target=#{target}")
|
20
|
+
response = Net::HTTP.get_response(uri)
|
21
|
+
json = JSON.parse(response.body)
|
22
|
+
json['channel'] = channel
|
23
|
+
@pkgs[pkg['name']] << json
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
erb :index
|
28
|
+
end
|
29
|
+
|
30
|
+
get '/config' do
|
31
|
+
@config = YAML.load_file('config.yml')
|
32
|
+
erb :config
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
3
|
+
<a class="navbar-brand" href="/">habitat_version_monitor</a>
|
4
|
+
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
5
|
+
<span class="navbar-toggler-icon"></span>
|
6
|
+
</button>
|
7
|
+
<div class="collapse navbar-collapse" id="navbarNav">
|
8
|
+
<ul class="navbar-nav">
|
9
|
+
<li class="nav-item active">
|
10
|
+
<a class="nav-link" href="/config">Config</a>
|
11
|
+
</li>
|
12
|
+
</ul>
|
13
|
+
</div>
|
14
|
+
<small class="pull-right">v<%= HabVersionMonitor::VERSION %></small>
|
15
|
+
</nav>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<% @pkgs.each do |k,v| %>
|
2
|
+
<h1><%= k %></h1>
|
3
|
+
<br/>
|
4
|
+
<div class="row">
|
5
|
+
<% v.each do |pkg| %>
|
6
|
+
<div class="col">
|
7
|
+
<div class="card">
|
8
|
+
<div class="card-body">
|
9
|
+
<h5 class="card-title">Origin: <%= pkg['origin'] %></h5>
|
10
|
+
<h6 class="card-subtitle"><span class="badge badge-info">Channel: <%= pkg['channel'] %></span></h6>
|
11
|
+
<p class="card-text">
|
12
|
+
Version: <%= [pkg['ident']['version'], pkg['ident']['release']].join('/') %>
|
13
|
+
Updated: <%= Time.parse(pkg['created_at']).strftime('%d/%m/%Y %I:%M %p') %>
|
14
|
+
Target: <%= pkg['target'] %>
|
15
|
+
</p>
|
16
|
+
<a href="https:/<%= @bldr_url %>/#/pkgs/<%= pkg['ident_array'].join('/') %>" class="card-link btn btn-dark">View</a>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
<% end %>
|
21
|
+
</div>
|
22
|
+
<% end %>
|
23
|
+
<meta http-equiv="refresh" content="<%= @refresh_interval_seconds %>" />
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
4
|
+
</head>
|
5
|
+
<body style="background: #f5f5f5">
|
6
|
+
<%= erb :_nav %>
|
7
|
+
<div class="container">
|
8
|
+
<%= yield %>
|
9
|
+
</div>
|
10
|
+
</body>
|
11
|
+
</html>
|
metadata
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hab_version_monitor
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- gscho
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-12-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: sinatra
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Write a longer description or delete this line.
|
70
|
+
email:
|
71
|
+
- greg.c.schofield@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- ".travis.yml"
|
79
|
+
- Gemfile
|
80
|
+
- Gemfile.lock
|
81
|
+
- LICENSE.txt
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- bin/console
|
85
|
+
- bin/hab_version_monitor
|
86
|
+
- bin/setup
|
87
|
+
- example/config.yml
|
88
|
+
- hab_version_monitor.gemspec
|
89
|
+
- lib/hab_version_monitor.rb
|
90
|
+
- lib/hab_version_monitor/server.rb
|
91
|
+
- lib/hab_version_monitor/version.rb
|
92
|
+
- lib/hab_version_monitor/views/_nav.erb
|
93
|
+
- lib/hab_version_monitor/views/config.erb
|
94
|
+
- lib/hab_version_monitor/views/index.erb
|
95
|
+
- lib/hab_version_monitor/views/layout.erb
|
96
|
+
homepage: https://github.com/gscho/hab_version_monitor
|
97
|
+
licenses:
|
98
|
+
- MIT
|
99
|
+
metadata:
|
100
|
+
homepage_uri: https://github.com/gscho/hab_version_monitor
|
101
|
+
source_code_uri: https://github.com/gscho/hab_version_monitor
|
102
|
+
changelog_uri: https://github.com/gscho/hab_version_monitor/CHANGELOG.md
|
103
|
+
post_install_message:
|
104
|
+
rdoc_options: []
|
105
|
+
require_paths:
|
106
|
+
- lib
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
requirements: []
|
118
|
+
rubyforge_project:
|
119
|
+
rubygems_version: 2.7.7
|
120
|
+
signing_key:
|
121
|
+
specification_version: 4
|
122
|
+
summary: Write a short summary, because RubyGems requires one.
|
123
|
+
test_files: []
|