visage-app 0.1.6 → 0.1.7

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.
data/README.md CHANGED
@@ -14,7 +14,13 @@ Features
14
14
  * drop-down or mouse selection of timeframes (also rendered asynchronously)
15
15
  * JSON interface onto `collectd` RRDs
16
16
 
17
- Check out [a demo](http://visage.unstated.net/nadia/cpu+load).
17
+ Here, have a graph:
18
+
19
+
20
+ ![Something I prepared earlier.](http://farm2.static.flickr.com/1020/4730994504_c8c6fc9c18_z.jpg)
21
+
22
+
23
+ Or check out [a live demo](http://visage.unstated.net/nadia/cpu+load).
18
24
 
19
25
  Installing
20
26
  ----------
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.6
1
+ 0.1.7
data/bin/visage CHANGED
@@ -14,7 +14,7 @@ when "start"
14
14
  when "genapache"
15
15
  require 'socket'
16
16
  fqdn = Socket.gethostbyname(Socket.gethostname).first
17
- public_dir = @root.join('lib/visage-app/public')
17
+ public_dir = @root.join('lib/visage/public')
18
18
 
19
19
  puts <<-CONFIG
20
20
  <VirtualHost *>
@@ -24,11 +24,11 @@ when "genapache"
24
24
  DocumentRoot #{public_dir}
25
25
 
26
26
  <Directory "#{public_dir}">
27
- Options FollowSymLinks Indexes
28
- AllowOverride None
29
- Order allow,deny
30
- Allow from all
31
- </Directory>
27
+ Options FollowSymLinks Indexes
28
+ AllowOverride None
29
+ Order allow,deny
30
+ Allow from all
31
+ </Directory>
32
32
 
33
33
  </VirtualHost>
34
34
  CONFIG
@@ -2,6 +2,7 @@
2
2
 
3
3
  __DIR__ = File.expand_path(File.dirname(__FILE__))
4
4
  require File.join(__DIR__, '..', 'config')
5
+ require 'yaml'
5
6
 
6
7
  Visage::Config.use do |c|
7
8
  c['fallback_colors'] = YAML::load(File.read(File.join(__DIR__, 'fallback-colors.yaml')))
data/lib/visage/config.ru CHANGED
@@ -1,5 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ @root = Pathname.new(File.dirname(__FILE__)).parent.parent.expand_path
4
+ $: << @root.to_s
5
+
3
6
  $0 = "visage"
4
7
 
5
8
  require 'lib/visage-app'
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'sinatra/base'
4
+
5
+ module Sinatra
6
+ module LinkToHelper
7
+ # from http://gist.github.com/98310
8
+ def link_to(url_fragment, mode=:path_only)
9
+ case mode
10
+ when :path_only
11
+ base = request.script_name
12
+ when :full_url
13
+ if (request.scheme == 'http' && request.port == 80 ||
14
+ request.scheme == 'https' && request.port == 443)
15
+ port = ""
16
+ else
17
+ port = ":#{request.port}"
18
+ end
19
+ base = "#{request.scheme}://#{request.host}#{port}#{request.script_name}"
20
+ else
21
+ raise "Unknown script_url mode #{mode}"
22
+ end
23
+ "#{base}#{url_fragment}"
24
+ end
25
+ end
26
+
27
+ helpers LinkToHelper
28
+ end
@@ -11,8 +11,8 @@
11
11
  - else
12
12
  - @hosts.each do |host|
13
13
  %li
14
- %a{:href => "/#{host}"}= host
15
-
14
+ %a{:href => link_to("/#{host}")}= host
15
+
16
16
  - if host = params[:host]
17
17
  %div#profiles.nav
18
18
  %h2 Profiles
@@ -20,7 +20,7 @@
20
20
  %ul
21
21
  - @profiles.each do |profile|
22
22
  %li
23
- %a{:href => "/#{host}/#{profile.splat}"}= profile.name
23
+ %a{:href => link_to("/#{host}/#{profile.splat}")}= profile.name
24
24
 
25
25
  %div#graphs
26
26
  - if @profile && @profile.plugins
@@ -41,8 +41,8 @@
41
41
  name: '#{plugin} on #{host}'
42
42
  });
43
43
  });
44
-
44
+
45
45
  - else
46
46
  %div#nothing
47
47
  Sorry, nothing to display!
48
-
48
+
data/lib/visage-app.rb CHANGED
@@ -1,22 +1,22 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'pathname'
4
- @root = Pathname.new(File.dirname(__FILE__)).expand_path
4
+ @root = Pathname.new(File.dirname(__FILE__)).parent.expand_path
5
5
  $: << @root.to_s
6
6
 
7
7
  require 'sinatra'
8
8
  require 'errand'
9
9
  require 'yajl'
10
10
  require 'haml'
11
- require 'visage/collectd/json'
12
- require 'visage/config'
11
+ require 'lib/visage/config'
12
+ require 'lib/visage/helpers'
13
+ require 'lib/visage/config/init'
14
+ require 'lib/visage/collectd/json'
13
15
 
14
- set :public, @root.join('visage/public')
15
- set :views, @root.join('visage/views')
16
+ set :public, @root.join('lib/visage/public')
17
+ set :views, @root.join('lib/visage/views')
16
18
 
17
19
  configure do
18
- require 'visage/config/init'
19
-
20
20
  CollectdJSON.rrddir = Visage::Config.rrddir
21
21
  Visage::Config::Profiles.profiles = Visage::Config.profiles
22
22
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 6
9
- version: 0.1.6
8
+ - 7
9
+ version: 0.1.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Lindsay Holmwood
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-24 00:00:00 -07:00
17
+ date: 2010-06-25 00:00:00 -07:00
18
18
  default_executable: visage
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -120,6 +120,7 @@ files:
120
120
  - lib/visage/config/plugin-colors.yaml
121
121
  - lib/visage/config/profiles.yaml
122
122
  - lib/visage/config/profiles.yaml.sample
123
+ - lib/visage/helpers.rb
123
124
  - lib/visage/patches.rb
124
125
  - lib/visage/public/favicon.gif
125
126
  - lib/visage/public/javascripts/application.js
@@ -133,7 +134,6 @@ files:
133
134
  - lib/visage/public/stylesheets/screen.css
134
135
  - lib/visage/views/index.haml
135
136
  - lib/visage/views/layout.haml
136
- - lib/visage/views/single.haml
137
137
  has_rdoc: true
138
138
  homepage: http://auxesis.github.com/visage
139
139
  licenses: []
@@ -1,43 +0,0 @@
1
- %div#header
2
- %h1 Visage
3
-
4
- %div#single
5
- %h3 Graph
6
- %div.labels.container
7
- %div#graph.holder
8
- :javascript
9
- window.addEvent('domready', function() {
10
- var graph = new visageGraph('graph', 'theodor', 'cpu-0', {
11
- width: 900,
12
- height: 220,
13
- gridWidth: 800,
14
- gridHeight: 200
15
- });
16
- });
17
-
18
- %h3 Load
19
- %div.labels.container
20
- %div#graph-load.holder
21
- :javascript
22
- window.addEvent('domready', function() {
23
- var graph = new visageGraph('graph-load', 'theodor', 'load', {
24
- width: 900,
25
- height: 220,
26
- gridWidth: 800,
27
- gridHeight: 200
28
- });
29
- });
30
-
31
- %h3 Memory
32
- %div.labels.container
33
- %div#graph-memory.holder
34
- :javascript
35
- window.addEvent('domready', function() {
36
- var graph = new visageGraph('graph-memory', 'theodor', 'memory', {
37
- width: 900,
38
- height: 220,
39
- gridWidth: 800,
40
- gridHeight: 200
41
- });
42
- });
43
-