repsheet_visualizer 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +12 -10
- data/bin/repsheet_visualizer +4 -2
- data/lib/repsheet_visualizer/application/app.rb +20 -0
- data/lib/repsheet_visualizer/application/views/activity.erb +1 -0
- data/lib/repsheet_visualizer/application/views/actors.erb +1 -0
- data/lib/repsheet_visualizer/application/views/breakdown.erb +1 -0
- data/lib/repsheet_visualizer/application/views/worldview.erb +84 -0
- data/lib/repsheet_visualizer/version.rb +1 -1
- data/repsheet_visualizer.gemspec +3 -2
- metadata +27 -4
data/Gemfile.lock
CHANGED
@@ -1,23 +1,25 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
repsheet_visualizer (0.0.
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
repsheet_visualizer (0.0.7)
|
5
|
+
geoip
|
6
|
+
json
|
7
|
+
redis
|
8
|
+
sinatra
|
8
9
|
|
9
10
|
GEM
|
10
11
|
remote: https://rubygems.org/
|
11
12
|
specs:
|
12
|
-
|
13
|
+
geoip (1.2.1)
|
14
|
+
json (1.8.0)
|
13
15
|
kgio (2.8.0)
|
14
16
|
rack (1.5.2)
|
15
17
|
rack-protection (1.5.0)
|
16
18
|
rack
|
17
19
|
raindrops (0.11.0)
|
18
20
|
rake (10.0.4)
|
19
|
-
redis (3.0.
|
20
|
-
sinatra (1.4.
|
21
|
+
redis (3.0.4)
|
22
|
+
sinatra (1.4.2)
|
21
23
|
rack (~> 1.5, >= 1.5.2)
|
22
24
|
rack-protection (~> 1.4)
|
23
25
|
tilt (~> 1.3, >= 1.3.4)
|
@@ -31,7 +33,7 @@ PLATFORMS
|
|
31
33
|
ruby
|
32
34
|
|
33
35
|
DEPENDENCIES
|
34
|
-
bundler
|
35
|
-
rake
|
36
|
+
bundler
|
37
|
+
rake
|
36
38
|
repsheet_visualizer!
|
37
|
-
unicorn
|
39
|
+
unicorn
|
data/bin/repsheet_visualizer
CHANGED
@@ -2,9 +2,10 @@
|
|
2
2
|
|
3
3
|
begin
|
4
4
|
require 'repsheet_visualizer/application/app.rb'
|
5
|
-
if ARGV.count ==
|
5
|
+
if ARGV.count == 3
|
6
6
|
RepsheetVisualizer.set :redis_host, ARGV[0]
|
7
7
|
RepsheetVisualizer.set :redis_port, ARGV[1]
|
8
|
+
RepsheetVisualizer.set :geoip_database, ARGV[2]
|
8
9
|
end
|
9
10
|
RepsheetVisualizer.run!
|
10
11
|
rescue LoadError => e
|
@@ -12,9 +13,10 @@ rescue LoadError => e
|
|
12
13
|
path = File.expand_path '../../lib', __FILE__
|
13
14
|
$:.unshift(path) if File.directory?(path) && !$:.include?(path)
|
14
15
|
require 'repsheet_visualizer/application/app.rb'
|
15
|
-
if ARGV.count ==
|
16
|
+
if ARGV.count == 3
|
16
17
|
RepsheetVisualizer.set :redis_host, ARGV[0]
|
17
18
|
RepsheetVisualizer.set :redis_port, ARGV[1]
|
19
|
+
RepsheetVisualizer.set :geoip_database, ARGV[2]
|
18
20
|
end
|
19
21
|
RepsheetVisualizer.run!
|
20
22
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'geoip'
|
1
2
|
require 'sinatra'
|
2
3
|
require 'redis'
|
3
4
|
require 'json'
|
@@ -20,6 +21,13 @@ class RepsheetVisualizer < Sinatra::Base
|
|
20
21
|
Redis.new(:host => host, :port => port)
|
21
22
|
end
|
22
23
|
|
24
|
+
def geoip_database
|
25
|
+
geoip_database = defined?(settings.geoip_database) ? settings.geoip_database : nil
|
26
|
+
raise "Missing GeoIP database settings" if geoip_database.nil?
|
27
|
+
raise "Could not locate GeoIP database" unless File.exist?(geoip_database)
|
28
|
+
GeoIP.new(settings.geoip_database)
|
29
|
+
end
|
30
|
+
|
23
31
|
def mount
|
24
32
|
defined?(settings.mount) ? (settings.mount + "/") : "/"
|
25
33
|
end
|
@@ -72,4 +80,16 @@ class RepsheetVisualizer < Sinatra::Base
|
|
72
80
|
@mount = mount
|
73
81
|
erb :breakdown
|
74
82
|
end
|
83
|
+
|
84
|
+
get '/worldview' do
|
85
|
+
db = geoip_database
|
86
|
+
redis = redis_connection
|
87
|
+
@data = {}
|
88
|
+
offenders = redis.keys("*:repsheet*").map {|o| o.split(":").first}
|
89
|
+
offenders.each do |address|
|
90
|
+
details = db.country(address)
|
91
|
+
@data[address] = [details.latitude, details.longitude]
|
92
|
+
end
|
93
|
+
erb :worldview
|
94
|
+
end
|
75
95
|
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>Repsheet::Visualizer</title>
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7
|
+
<meta name="description" content="">
|
8
|
+
<meta name="author" content="Aaron Bedra">
|
9
|
+
|
10
|
+
<link href="<%= @mount %>css/bootstrap.css" rel="stylesheet">
|
11
|
+
<link href="<%= @mount %>css/bootstrap-responsive.css" rel="stylesheet">
|
12
|
+
<link href="<%= @mount %>css/blue/style.css" rel="stylesheet">
|
13
|
+
<style>
|
14
|
+
body {
|
15
|
+
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
|
16
|
+
}
|
17
|
+
|
18
|
+
.actors {
|
19
|
+
border-color: #FFF;
|
20
|
+
}
|
21
|
+
</style>
|
22
|
+
|
23
|
+
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
|
24
|
+
<!--[if lt IE 9]>
|
25
|
+
<script src="<%= @mount %>javascripts/html5shiv.js"></script>
|
26
|
+
<![endif]-->
|
27
|
+
|
28
|
+
<link rel="shortcut icon" href="<%= @mount %>images/favicon.ico">
|
29
|
+
|
30
|
+
<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
|
31
|
+
</head>
|
32
|
+
|
33
|
+
<body>
|
34
|
+
<div class="navbar navbar-inverse navbar-fixed-top">
|
35
|
+
<div class="navbar-inner">
|
36
|
+
<div class="container">
|
37
|
+
<a class="brand" href="<%= @mount %>">Repsheet</a>
|
38
|
+
<div class="nav-collapse collapse">
|
39
|
+
<ul class="nav">
|
40
|
+
<li><a href="<%= @mount %>">Actors</a></li>
|
41
|
+
<li><a href="<%= @mount %>breakdown">Breakdown</a></li>
|
42
|
+
<li class="active"><a href="<%= @mount %>worldview">Worldview</a></li>
|
43
|
+
</ul>
|
44
|
+
</div>
|
45
|
+
</div>
|
46
|
+
</div>
|
47
|
+
</div>
|
48
|
+
|
49
|
+
<div class="container">
|
50
|
+
<div id="map" style="width: 1024px; height: 768px;"></div>
|
51
|
+
|
52
|
+
<script type="text/javascript">
|
53
|
+
var locations = [
|
54
|
+
<% @data.each do |address, geodetails| %>
|
55
|
+
['<%= address %>', <%= geodetails[0] %>, <%= geodetails[1] %>],
|
56
|
+
<% end %>
|
57
|
+
];
|
58
|
+
|
59
|
+
var map = new google.maps.Map(document.getElementById('map'), {
|
60
|
+
zoom: 2,
|
61
|
+
center: new google.maps.LatLng(41.833, -87.731),
|
62
|
+
mapTypeId: google.maps.MapTypeId.ROADMAP
|
63
|
+
});
|
64
|
+
|
65
|
+
var infowindow = new google.maps.InfoWindow();
|
66
|
+
var marker, i;
|
67
|
+
|
68
|
+
for (i = 0; i < locations.length; i++) {
|
69
|
+
marker = new google.maps.Marker({
|
70
|
+
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
|
71
|
+
map: map
|
72
|
+
});
|
73
|
+
|
74
|
+
google.maps.event.addListener(marker, 'click', (function(marker, i) {
|
75
|
+
return function() {
|
76
|
+
infowindow.setContent(locations[i][0]);
|
77
|
+
infowindow.open(map, marker);
|
78
|
+
}
|
79
|
+
})(marker, i));
|
80
|
+
}
|
81
|
+
</script>
|
82
|
+
</div>
|
83
|
+
</body>
|
84
|
+
</html>
|
data/repsheet_visualizer.gemspec
CHANGED
@@ -18,10 +18,11 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "
|
21
|
+
spec.add_dependency "geoip"
|
22
22
|
spec.add_dependency "json"
|
23
|
+
spec.add_dependency "redis"
|
23
24
|
spec.add_dependency "sinatra"
|
24
|
-
|
25
|
+
|
25
26
|
spec.add_development_dependency "bundler"
|
26
27
|
spec.add_development_dependency "rake"
|
27
28
|
spec.add_development_dependency "unicorn"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: repsheet_visualizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,10 +9,10 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: geoip
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
@@ -43,6 +43,22 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: redis
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
46
62
|
- !ruby/object:Gem::Dependency
|
47
63
|
name: sinatra
|
48
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,6 +158,7 @@ files:
|
|
142
158
|
- lib/repsheet_visualizer/application/views/activity.erb
|
143
159
|
- lib/repsheet_visualizer/application/views/actors.erb
|
144
160
|
- lib/repsheet_visualizer/application/views/breakdown.erb
|
161
|
+
- lib/repsheet_visualizer/application/views/worldview.erb
|
145
162
|
- lib/repsheet_visualizer/version.rb
|
146
163
|
- repsheet_visualizer.gemspec
|
147
164
|
homepage: https://github.com/Repsheet/visualizer
|
@@ -157,15 +174,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
157
174
|
- - ! '>='
|
158
175
|
- !ruby/object:Gem::Version
|
159
176
|
version: '0'
|
177
|
+
segments:
|
178
|
+
- 0
|
179
|
+
hash: -1556641184775599076
|
160
180
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
181
|
none: false
|
162
182
|
requirements:
|
163
183
|
- - ! '>='
|
164
184
|
- !ruby/object:Gem::Version
|
165
185
|
version: '0'
|
186
|
+
segments:
|
187
|
+
- 0
|
188
|
+
hash: -1556641184775599076
|
166
189
|
requirements: []
|
167
190
|
rubyforge_project:
|
168
|
-
rubygems_version: 1.8.
|
191
|
+
rubygems_version: 1.8.25
|
169
192
|
signing_key:
|
170
193
|
specification_version: 3
|
171
194
|
summary: A visualization package for Repsheet
|