visage-app 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/AUTHORS +5 -0
- data/README.md +1 -1
- data/Rakefile +9 -0
- data/VERSION +1 -1
- data/features/site.feature +8 -1
- data/features/step_definitions/site_steps.rb +16 -0
- data/features/support/env.rb +6 -1
- data/lib/visage-app.rb +1 -1
- data/lib/visage/config.rb +1 -28
- data/lib/visage/profile.rb +4 -2
- data/lib/visage/public/stylesheets/screen.css +6 -0
- data/lib/visage/views/profiles.haml +5 -0
- metadata +3 -4
- data/lib/visage/config/profiles.yaml.sample +0 -33
data/.gitignore
CHANGED
data/AUTHORS
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -46,6 +46,7 @@ task :push => :lintian do
|
|
46
46
|
system(command)
|
47
47
|
end
|
48
48
|
|
49
|
+
desc "perform lintian checks on the JavaScript about to be shipped"
|
49
50
|
task :lintian do
|
50
51
|
require 'pathname'
|
51
52
|
@root = Pathname.new(File.dirname(__FILE__)).expand_path
|
@@ -54,3 +55,11 @@ task :lintian do
|
|
54
55
|
count = `grep -c 'console.log' #{javascripts_path.join('graph.js')}`.strip.to_i
|
55
56
|
abort("#{count} instances of console.log found in graph.js!") if count > 0
|
56
57
|
end
|
58
|
+
|
59
|
+
desc "clean up various generated files"
|
60
|
+
task :clean do
|
61
|
+
[ "webrat.log", "pkg/", "visage-app-*.spec", "_site/"].each do |filename|
|
62
|
+
puts "Removing #{filename}"
|
63
|
+
FileUtils.rm_rf(filename)
|
64
|
+
end
|
65
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.6
|
data/features/site.feature
CHANGED
@@ -3,9 +3,16 @@ Feature: Visit site
|
|
3
3
|
A user
|
4
4
|
Must be able to visualise the data
|
5
5
|
|
6
|
-
Scenario: Show
|
6
|
+
Scenario: Show graphs
|
7
7
|
When I go to /profiles
|
8
8
|
And I visit the first profile
|
9
9
|
Then I should see a list of graphs
|
10
10
|
|
11
|
+
Scenario: List profiles
|
12
|
+
When I go to /profiles
|
13
|
+
Then I should see a list of profiles
|
14
|
+
When I follow "created"
|
15
|
+
Then I should see a list of profiles
|
16
|
+
When I follow "name"
|
17
|
+
Then I should see a list of profiles sorted alphabetically
|
11
18
|
|
@@ -9,3 +9,19 @@ Then /^I should see a list of graphs$/ do
|
|
9
9
|
doc = Nokogiri::HTML(response_body)
|
10
10
|
doc.search('div#profile div.graph').size.should > 1
|
11
11
|
end
|
12
|
+
|
13
|
+
Then /^I should see a list of profiles$/ do
|
14
|
+
doc = Nokogiri::HTML(response_body)
|
15
|
+
doc.search('div#profiles ul li').size.should > 1
|
16
|
+
end
|
17
|
+
|
18
|
+
Then /^I should see a list of profiles sorted alphabetically$/ do
|
19
|
+
doc = Nokogiri::HTML(response_body)
|
20
|
+
profiles = doc.search('div#profiles ul li')
|
21
|
+
profiles.size.should > 1
|
22
|
+
|
23
|
+
unsorted = profiles.map { |p| p.text.strip }
|
24
|
+
sorted = profiles.map { |p| p.text.strip }.sort
|
25
|
+
|
26
|
+
unsorted.should == sorted
|
27
|
+
end
|
data/features/support/env.rb
CHANGED
@@ -26,7 +26,12 @@ class SinatraWorld
|
|
26
26
|
Webrat::Methods.delegate_to_session :response_code, :response_body, :response_headers, :response
|
27
27
|
|
28
28
|
def app
|
29
|
-
|
29
|
+
Rack::Builder.new do
|
30
|
+
use Visage::Profiles
|
31
|
+
use Visage::Builder
|
32
|
+
use Visage::JSON
|
33
|
+
run Sinatra::Application
|
34
|
+
end
|
30
35
|
end
|
31
36
|
end
|
32
37
|
|
data/lib/visage-app.rb
CHANGED
data/lib/visage/config.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Visage
|
2
|
-
class Config
|
2
|
+
class Config
|
3
3
|
|
4
4
|
class << self
|
5
5
|
def use
|
@@ -20,32 +20,5 @@ module Visage
|
|
20
20
|
@configuration
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
24
|
-
class Profiles
|
25
|
-
class << self
|
26
|
-
require 'ostruct'
|
27
|
-
|
28
|
-
attr_accessor :profiles
|
29
|
-
|
30
|
-
def get(id)
|
31
|
-
id.gsub!(/\s+/, '+')
|
32
|
-
if found = @profiles.find {|p| p[1]["splat"] == id }
|
33
|
-
OpenStruct.new(found[1])
|
34
|
-
else
|
35
|
-
nil
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def all
|
40
|
-
# here be ugliness
|
41
|
-
profiles = @profiles.to_a.sort_by { |profile|
|
42
|
-
profile[1]["order"]
|
43
|
-
}.map { |profile|
|
44
|
-
OpenStruct.new(profile[1].merge({'name' => profile[0]}))
|
45
|
-
}
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
23
|
end
|
51
24
|
end
|
data/lib/visage/profile.rb
CHANGED
@@ -20,9 +20,11 @@ module Visage
|
|
20
20
|
profiles[url] ? self.new(profiles[url]) : nil
|
21
21
|
end
|
22
22
|
|
23
|
-
def self.all
|
23
|
+
def self.all(opts={})
|
24
|
+
sort = opts[:sort]
|
24
25
|
profiles = YAML::load_file(@@profiles_filename) || {}
|
25
|
-
profiles.
|
26
|
+
profiles = sort == "name" ? profiles.sort.map {|i| i.last } : profiles.values
|
27
|
+
profiles.map { |prof| self.new(prof) }
|
26
28
|
end
|
27
29
|
|
28
30
|
def initialize(opts={})
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 6
|
9
|
+
version: 0.2.6
|
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-
|
17
|
+
date: 2010-09-26 00:00:00 +10:00
|
18
18
|
default_executable: visage
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -120,7 +120,6 @@ files:
|
|
120
120
|
- lib/visage/config/fallback-colors.yaml
|
121
121
|
- lib/visage/config/init.rb
|
122
122
|
- lib/visage/config/plugin-colors.yaml
|
123
|
-
- lib/visage/config/profiles.yaml.sample
|
124
123
|
- lib/visage/graph.rb
|
125
124
|
- lib/visage/helpers.rb
|
126
125
|
- lib/visage/patches.rb
|
@@ -1,33 +0,0 @@
|
|
1
|
-
---
|
2
|
-
profiles:
|
3
|
-
cpu+load:
|
4
|
-
plugins:
|
5
|
-
- cpu-0
|
6
|
-
- cpu-1
|
7
|
-
- load/load
|
8
|
-
- battery-0
|
9
|
-
name: CPU + Load
|
10
|
-
order: 1
|
11
|
-
memory:
|
12
|
-
plugins:
|
13
|
-
- memory
|
14
|
-
- swap
|
15
|
-
name: Memory
|
16
|
-
order: 2
|
17
|
-
disk+usage:
|
18
|
-
plugins:
|
19
|
-
- df/df-root
|
20
|
-
- disk-sda
|
21
|
-
name: Disk Usage
|
22
|
-
order: 3
|
23
|
-
network:
|
24
|
-
plugins:
|
25
|
-
- tcpconns-9393-local
|
26
|
-
- tcpconns-80-local
|
27
|
-
name: Networking
|
28
|
-
order: 4
|
29
|
-
processes:
|
30
|
-
plugins:
|
31
|
-
- processes
|
32
|
-
name: Processes
|
33
|
-
order: 5
|