oxidized-web 0.0.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of oxidized-web might be problematic. Click here for more details.

checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9432a750c5845ae7ca7f16c2befa4a66e28944e2
4
+ data.tar.gz: 9b2b2f27da6047b0a16cddd055e49693e5c20f74
5
+ SHA512:
6
+ metadata.gz: 4919234de5e447d6811f1413a3bcd1cded9731663563c19fe55268c4552d76bd91ddd51aad39aae20813986ca602a6e8885fdc0388c934282d077fbf82ebdc9e
7
+ data.tar.gz: e3612d188d480ea5a95ffc0bd4446f23182607934de63226b16881c4e6e54b115e25a68da424fcb41da4e3ffbf3b18cae43c8cb7e4454378cffefccc7a4931d6
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ Gemfile.lock
2
+ gems
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ # Oxidized Web
2
+ Web userinterface and RESTful API for Oxidized.
3
+
4
+ This is not useful independently, see https://github.com/ytti/oxidized for install instructions
data/Rakefile ADDED
@@ -0,0 +1,47 @@
1
+ begin
2
+ require 'rake/testtask'
3
+ require 'bundler'
4
+ Bundler.setup
5
+ rescue LoadError
6
+ warn 'bunler missing'
7
+ exit 42
8
+ end
9
+
10
+ gemspec = eval(File.read(Dir['*.gemspec'].first))
11
+ file = [gemspec.name, gemspec.version].join('-') + '.gem'
12
+
13
+ desc 'Validate gemspec'
14
+ task :gemspec do
15
+ gemspec.validate
16
+ end
17
+
18
+ desc 'Run minitest'
19
+ task :test do
20
+ Rake::TestTask.new do |t|
21
+ t.libs.push "lib"
22
+ t.test_files = FileList['spec/*_spec.rb']
23
+ t.verbose = true
24
+ end
25
+ end
26
+
27
+ desc 'Build gem'
28
+ task :build do
29
+ system "gem build #{gemspec.name}.gemspec"
30
+ FileUtils.mkdir_p 'gems'
31
+ FileUtils.mv file, 'gems'
32
+ end
33
+
34
+ desc 'Install gem'
35
+ task :install => :build do
36
+ system "sudo -E sh -c \'umask 022; gem install gems/#{file}\'"
37
+ end
38
+
39
+ desc 'Remove gems'
40
+ task :clean do
41
+ FileUtils.rm_rf 'gems'
42
+ end
43
+
44
+ desc 'Push to rubygems'
45
+ task :push do
46
+ system "gem push gems/#{file}"
47
+ end
@@ -0,0 +1,19 @@
1
+ module Oxidized
2
+ module API
3
+ class Web
4
+ attr_reader :thread
5
+ def initialize nodes, listen
6
+ require 'oxidized/web/webapp'
7
+ addr, port = listen.to_s.split ':'
8
+ port, addr = addr, nil if not port
9
+ WebApp.set :server, %w(puma)
10
+ WebApp.set :bind, addr if addr
11
+ WebApp.set :port, port
12
+ WebApp.set :nodes, nodes
13
+ end
14
+ def run
15
+ @thread = Thread.new { WebApp.run! }
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,4 @@
1
+ %html
2
+ !=haml :head
3
+ %body
4
+ =@data
@@ -0,0 +1,5 @@
1
+ %head
2
+ %title oxidized
3
+ %script{:src=>'//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js'}
4
+ %script{:src=>'//cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.13.3/jquery.tablesorter.min.js'}
5
+ %link{:rel=>'stylesheet', :href=>'/stylesheets/oxidized.css'}
@@ -0,0 +1,6 @@
1
+ %html
2
+ !=haml :head
3
+ %body
4
+ -out='';PP.pp(@data,out)
5
+ %pre
6
+ =out
@@ -0,0 +1,34 @@
1
+ %html
2
+ !=haml :head
3
+ %body
4
+ %table{:id=>'nodesTable', :class=>'center tablesorter'}
5
+ %thead
6
+ %tr
7
+ %th Name
8
+ %th IP
9
+ %th Group
10
+ %th Last Status
11
+ %th Last Time
12
+ %th Config
13
+ %th Update
14
+ %tbody
15
+ -trclass = %w(even odd)
16
+ -@data.sort_by{|e|e[:name]}.each do |node|
17
+ -klass = trclass.rotate!.first
18
+ %tr{:class=>klass}
19
+ %td
20
+ %a(href="/node/show/#{node[:name]}") #{node[:name]}
21
+ %td= node[:ip]
22
+ %td= node[:group]
23
+ %td= node[:status]
24
+ %td= node[:time]
25
+ %td
26
+ %a(href="/node/fetch/#{node[:full_name]}") config
27
+ %td
28
+ %a(href="/node/next/#{node[:full_name]}") update
29
+ %p{:class=>'center'}
30
+ %a(href="/reload") reload list of nodes
31
+ :javascript
32
+ $(function(){
33
+ $("#nodesTable").tablesorter();
34
+ });
@@ -0,0 +1,51 @@
1
+ $font-stack: Helvetica, sans-serif
2
+ $base03: #002b36
3
+ $base02: #073642
4
+ $base01: #586e75
5
+ $base00: #657b83
6
+ $base0: #839496
7
+ $base1: #93a1a1
8
+ $base2: #eee8d5
9
+ $base3: #fdf6e3
10
+ $yellow: #b58900
11
+ $orange: #cb4b16
12
+ $red: #dc322f
13
+ $magenta: #d33682
14
+ $violet: #6c71c4
15
+ $blue: #268bd2
16
+ $cyan: #2aa198
17
+ $green: #859900
18
+
19
+ body
20
+ font: 100% $font-stack
21
+ color: $base03
22
+ background: $base3
23
+
24
+ a:link
25
+ color: $red
26
+ text-decoration: none
27
+
28
+ // a:visited
29
+ // a:active
30
+
31
+ a:hover
32
+ color: $magenta
33
+ text-decoration: underline
34
+
35
+ .center
36
+ margin-left: auto
37
+ margin-right: auto
38
+ text-align: center
39
+
40
+ th
41
+ color: $cyan
42
+
43
+ tr.odd
44
+ background: $base2
45
+
46
+ tr.even
47
+ background: $base3
48
+
49
+ tr:hover
50
+ background: $base01
51
+ color: $base3
@@ -0,0 +1,104 @@
1
+ require 'sinatra/base'
2
+ require 'sinatra/json'
3
+ require 'haml'
4
+ require 'sass'
5
+ require 'pp'
6
+ module Oxidized
7
+ module API
8
+ class WebApp < Sinatra::Base
9
+
10
+ get '/' do
11
+ redirect '/nodes'
12
+ end
13
+
14
+ get '/nodes.?:format?' do
15
+ @data = nodes.list.map do |node|
16
+ node[:status] = 'never'
17
+ node[:time] = 'never'
18
+ node[:group] = 'default' unless node[:group]
19
+ if node[:last]
20
+ node[:status] = node[:last][:status]
21
+ node[:time] = node[:last][:end]
22
+ end
23
+ node
24
+ end
25
+ out :nodes
26
+ end
27
+
28
+ get '/reload.?:format?' do
29
+ nodes.load
30
+ @data = 'reloaded list of nodes'
31
+ out
32
+ end
33
+
34
+
35
+ get '/node/fetch/:node' do
36
+ node, @json = route_parse :node
37
+ @data = nodes.fetch node, nil
38
+ out :text
39
+ end
40
+
41
+ get '/node/fetch/:group/:node' do
42
+ node, @json = route_parse :node
43
+ @data = nodes.fetch node, params[:group]
44
+ out :text
45
+ end
46
+
47
+
48
+ get '/node/next/:node' do
49
+ node, @json = route_parse :node
50
+ nodes.next node
51
+ redirect '/nodes' unless @json
52
+ @data = 'ok'
53
+ out
54
+ end
55
+
56
+ # use this to attach author/email/message to commit
57
+ put '/node/next/:node' do
58
+ node, @json = route_parse :node
59
+ opt = JSON.load request.body.read
60
+ nodes.next node, opt
61
+ redirect '/nodes' unless @json
62
+ @data = 'ok'
63
+ out
64
+ end
65
+
66
+ get '/node/show/:node' do
67
+ node, @json = route_parse :node
68
+ @data = nodes.show node
69
+ out :node
70
+ end
71
+
72
+ get '/stylesheets/*.css' do
73
+ sass params[:splat].first.to_sym
74
+ end
75
+
76
+ private
77
+
78
+ def out template=:default
79
+ if @json or params[:format] == 'json'
80
+ json @data
81
+ elsif template == :text
82
+ content_type :text
83
+ @data
84
+ else
85
+ haml template
86
+ end
87
+ end
88
+
89
+ def nodes
90
+ settings.nodes
91
+ end
92
+
93
+ def route_parse param
94
+ json = false
95
+ e = params[param].split '.'
96
+ if e.last == 'json'
97
+ e.pop
98
+ json = true
99
+ end
100
+ [e.join('.'), json]
101
+ end
102
+ end
103
+ end
104
+ end
@@ -0,0 +1,21 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'oxidized-web'
3
+ s.version = '0.0.1'
4
+ s.platform = Gem::Platform::RUBY
5
+ s.authors = [ 'Saku Ytti' ]
6
+ s.email = %w( saku@ytti.fi )
7
+ s.homepage = 'http://github.com/ytti/oxidized-web'
8
+ s.summary = 'sinatra API + webUI for oxidized'
9
+ s.description = 'puma+sinatra+haml webUI + REST API for oxidized'
10
+ s.rubyforge_project = s.name
11
+ s.files = `git ls-files`.split("\n")
12
+ s.executables = %w( )
13
+ s.require_path = 'lib'
14
+
15
+ s.add_dependency 'oxidized', '>= 0.0.53'
16
+ s.add_dependency 'puma'
17
+ s.add_dependency 'sinatra'
18
+ s.add_dependency 'sinatra-contrib'
19
+ s.add_dependency 'haml'
20
+ s.add_dependency 'sass'
21
+ end
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: oxidized-web
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Saku Ytti
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: oxidized
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.0.53
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.0.53
27
+ - !ruby/object:Gem::Dependency
28
+ name: puma
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sinatra
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: sinatra-contrib
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
+ - !ruby/object:Gem::Dependency
70
+ name: haml
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: sass
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: puma+sinatra+haml webUI + REST API for oxidized
98
+ email:
99
+ - saku@ytti.fi
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - .gitignore
105
+ - Gemfile
106
+ - README.md
107
+ - Rakefile
108
+ - lib/oxidized/web.rb
109
+ - lib/oxidized/web/views/default.haml
110
+ - lib/oxidized/web/views/head.haml
111
+ - lib/oxidized/web/views/node.haml
112
+ - lib/oxidized/web/views/nodes.haml
113
+ - lib/oxidized/web/views/oxidized.sass
114
+ - lib/oxidized/web/webapp.rb
115
+ - oxidized-web.gemspec
116
+ homepage: http://github.com/ytti/oxidized-web
117
+ licenses: []
118
+ metadata: {}
119
+ post_install_message:
120
+ rdoc_options: []
121
+ require_paths:
122
+ - lib
123
+ required_ruby_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - '>='
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - '>='
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ requirements: []
134
+ rubyforge_project: oxidized-web
135
+ rubygems_version: 2.0.3
136
+ signing_key:
137
+ specification_version: 4
138
+ summary: sinatra API + webUI for oxidized
139
+ test_files: []