sbpanel 0.0.1

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/sbpanel.gemspec ADDED
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/sbpanel/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Jaiden Mispy"]
6
+ gem.email = ["^_^@mispy.me"]
7
+ gem.description = %q{Web status panel for Starbound servers}
8
+ gem.summary = %q{Web status panel for Starbound servers}
9
+ gem.homepage = "http://starbound.mispy.me"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "sbpanel"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = SBPanel::VERSION
17
+
18
+ # Sinatra and associated webserver
19
+ gem.add_runtime_dependency 'sinatra'
20
+ gem.add_runtime_dependency 'webrick'
21
+
22
+ # FileTail gem for reading logs
23
+ gem.add_runtime_dependency 'file-tail'
24
+
25
+ # For time display helpers from Rails
26
+ gem.add_runtime_dependency 'actionpack'
27
+ end
data/views/index.erb ADDED
@@ -0,0 +1,195 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <script src="/js/jquery-1.10.2.min.js"></script>
5
+ <script src="/js/jquery.tablesorter.js"></script>
6
+ <script src="/js/jquery.tablesorter.widgets.js"></script>
7
+ <script>
8
+ $(document).ready(function() {
9
+
10
+ $.extend($.tablesorter.themes.bootstrap, {
11
+ // these classes are added to the table. To see other table classes available,
12
+ // look here: http://twitter.github.com/bootstrap/base-css.html#tables
13
+ table : 'table table-bordered',
14
+ caption : 'caption',
15
+ header : 'bootstrap-header', // give the header a gradient background
16
+ sortNone : 'bootstrap-icon-unsorted',
17
+ sortAsc : 'icon-chevron-up glyphicon glyphicon-chevron-up', // includes classes for Bootstrap v2 & v3
18
+ sortDesc : 'icon-chevron-down glyphicon glyphicon-chevron-down', // includes classes for Bootstrap v2 & v3
19
+ });
20
+
21
+ $('.tablesorter').tablesorter({
22
+ theme: 'bootstrap',
23
+ widthFixed: true,
24
+ headerTemplate : '{content} {icon}', // new in v2.7. Needed to add the bootstrap icon!
25
+ // widget code contained in the jquery.tablesorter.widgets.js file
26
+ // use the zebra stripe widget if you plan on hiding any rows (filter widget)
27
+ widgets : [ "uitheme" ],
28
+
29
+ sortList: [[1,0]],
30
+
31
+ widgetOptions : {
32
+ // using the default zebra striping class name, so it actually isn't included in the theme variable above
33
+ // this is ONLY needed for bootstrap theming if you are using the filter widget, because rows are hidden
34
+ zebra : ["even", "odd"],
35
+
36
+ // reset filters button
37
+ filter_reset : ".reset"
38
+
39
+ // set the uitheme widget to use the bootstrap theme class names
40
+ // this is no longer required, if theme is set
41
+ // ,uitheme : "bootstrap"
42
+
43
+ },
44
+
45
+ textExtraction: function(node) {
46
+ var attr = $(node).attr('data-sort-value');
47
+ if (typeof attr !== 'undefined' && attr !== false) {
48
+ return attr;
49
+ }
50
+ return $(node).text();
51
+ }
52
+ });
53
+ });
54
+ </script>
55
+ <link rel="stylesheet" href="/css/bootstrap.min.css">
56
+ <link rel="stylesheet" href="/css/tablesorter.bootstrap.css">
57
+ <style>
58
+ .status td {
59
+ width: 20%;
60
+ }
61
+
62
+ .status td:last-child, th:last-child {
63
+ text-align: right;
64
+ }
65
+
66
+ .chat td:first-child {
67
+ max-width: 100px;
68
+ }
69
+
70
+ .chat table {
71
+ margin-top: 63px;
72
+ }
73
+ </style>
74
+ </head>
75
+ <body>
76
+ <div class="container">
77
+ <div class="status col-md-8">
78
+ <h2>Starbound server is <strong><%= @status %></strong></h2>
79
+ <table class="table">
80
+ <thead>
81
+ <tr>
82
+ <th>Address</th>
83
+ <th>Port</th>
84
+ <th>Version</th>
85
+ <th><%= @status.capitalize %> For</th>
86
+ </tr>
87
+ </thead>
88
+ <tbody>
89
+ <tr>
90
+ <td><%= @address %></td>
91
+ <td><%= @port %></td>
92
+ <td><%= @version %></td>
93
+ <td>
94
+ <% if @last_status_change %>
95
+ <%= time_ago_in_words(@last_status_change) %>
96
+ <% end %>
97
+ </td>
98
+ </tr>
99
+ </tbody>
100
+ </table>
101
+
102
+ <% if @online_players.length > 0 %>
103
+ <h2>Online Players</h2>
104
+ <table class="table table-striped tablesorter">
105
+ <thead>
106
+ <tr>
107
+ <th>Name</th>
108
+ <th>Online For</th>
109
+ </tr>
110
+ </thead>
111
+ <tbody>
112
+ <% @online_players.each do |player| %>
113
+ <tr>
114
+ <td><%= player[:name] %></td>
115
+ <td data-sort-value="<%= -player[:last_connect].to_i %>">
116
+ <% if player[:last_connect] %>
117
+ <%= time_ago_in_words(player[:last_connect]) %>
118
+ <% end %>
119
+ </td>
120
+ </tr>
121
+ <% end %>
122
+ </tbody>
123
+ </table>
124
+ <% end %>
125
+
126
+ <% if @active_worlds.length > 0 %>
127
+ <h2>Active Worlds</h2>
128
+ <table class="table table-striped tablesorter">
129
+ <thead>
130
+ <tr>
131
+ <th>Coordinates</th>
132
+ <th>Loaded For</th>
133
+ </tr>
134
+ </thead>
135
+ <tbody>
136
+ <% @active_worlds.each do |world| %>
137
+ <tr>
138
+ <td><%= world[:coords] %></td>
139
+ <td data-sort-value="<%= -world[:last_load].to_i %>">
140
+ <% if world[:last_load] %>
141
+ <%= time_ago_in_words(world[:last_load]) %>
142
+ <% end %>
143
+ </td>
144
+ </tr>
145
+ <% end %>
146
+ </tbody>
147
+ </table>
148
+ <% end %>
149
+
150
+ <% if @offline_players.length > 0 %>
151
+ <h2>Offline Players</h2>
152
+ <table id="waffles" class="table table-striped tablesorter">
153
+ <thead>
154
+ <tr>
155
+ <th>Name</th>
156
+ <th>Last Seen</th>
157
+ </tr>
158
+ </thead>
159
+ <tbody>
160
+ <% @offline_players.each do |player| %>
161
+ <tr>
162
+ <td><%= player[:name] %></td>
163
+ <td data-sort-value="<%= -player[:last_disconnect].to_i %>">
164
+ <% if player[:last_disconnect] %>
165
+ <%= time_ago_in_words(player[:last_disconnect]) %> ago
166
+ <% end %>
167
+ </td>
168
+ </tr>
169
+ <% end %>
170
+ </tbody>
171
+ </table>
172
+ <% end %>
173
+ </div>
174
+
175
+ <div class="chat col-md-4">
176
+ <table class="table table-striped">
177
+ <thead>
178
+ <tr>
179
+ <th>Chat</th>
180
+ <th></th>
181
+ </tr>
182
+ </thead>
183
+ <tbody>
184
+ <% @chat.last(50).reverse.each do |chat| %>
185
+ <tr>
186
+ <td><%= chat[:name] %></td>
187
+ <td><%= chat[:text] %></td>
188
+ </tr>
189
+ <% end %>
190
+ </tbody>
191
+ </table>
192
+ </div>
193
+ </div>
194
+ </body>
195
+ </html>
metadata ADDED
@@ -0,0 +1,119 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sbpanel
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jaiden Mispy
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-12-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sinatra
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: webrick
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: file-tail
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: actionpack
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: Web status panel for Starbound servers
70
+ email:
71
+ - ^_^@mispy.me
72
+ executables:
73
+ - sbpanel
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - Gemfile
78
+ - LICENSE
79
+ - README.md
80
+ - Rakefile
81
+ - bin/sbpanel
82
+ - lib/sbpanel.rb
83
+ - lib/sbpanel/game.rb
84
+ - lib/sbpanel/version.rb
85
+ - public/css/bootstrap.min.css
86
+ - public/css/tablesorter.bootstrap.css
87
+ - public/fonts/glyphicons-halflings-regular.eot
88
+ - public/fonts/glyphicons-halflings-regular.svg
89
+ - public/fonts/glyphicons-halflings-regular.ttf
90
+ - public/fonts/glyphicons-halflings-regular.woff
91
+ - public/js/jquery-1.10.2.min.js
92
+ - public/js/jquery.tablesorter.js
93
+ - public/js/jquery.tablesorter.widgets.js
94
+ - sbpanel.gemspec
95
+ - views/index.erb
96
+ homepage: http://starbound.mispy.me
97
+ licenses: []
98
+ metadata: {}
99
+ post_install_message:
100
+ rdoc_options: []
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - '>='
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ requirements: []
114
+ rubyforge_project:
115
+ rubygems_version: 2.0.3
116
+ signing_key:
117
+ specification_version: 4
118
+ summary: Web status panel for Starbound servers
119
+ test_files: []