sbpanel 0.0.1 → 0.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d6aa349cdc46eac903917d25d70bc30186cf84e9
4
- data.tar.gz: d440ea7da4b1d4feb43e34813bbf764b6943e997
3
+ metadata.gz: a4c82849beeed3147b81c1552109eb5cc1777293
4
+ data.tar.gz: bea13ff6078706e0b8aeafa62a62e63901d7478e
5
5
  SHA512:
6
- metadata.gz: 94c61c7a29f421db9bd6143c683b49b8f438891d3e4bed8d8dd9e3b55209bd430a8b7e23e73ed0f2eef1f570d37ed0256f7a89892249b77cdd26f5a4d5d7d98e
7
- data.tar.gz: ae8032b2258624a959448fc151ddb6e41e23dc0068e8e4e08093f4a1ccfa863472eedc481392f466e128ab10ff46b7bc0c0807a092396c4428d02f5c5e956e2a
6
+ metadata.gz: 9fd101d9c148f0c0e2fa25c12e4a702bb4d6d1b5e8883c433ed07c800921aeec5c9a32a7ad9fff8b2572196f0ec20b650f34e05f76a6bdbf53fda291257cef10
7
+ data.tar.gz: 658532dcc552b67da91869d827dbb7cd8157676e8b978aea7d2c4fc3cd4e17b9816797350d76781d1c2146f0b8b77ce27756278a760aa7253ee8e537eb7dcaa1
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ pkg
data/README.md CHANGED
@@ -1,3 +1,21 @@
1
- # sbpanel
1
+ # sbpanel 0.0.2
2
2
 
3
- WIP Starbound web panel! Parses the server debug log to show server status, connected players and active worlds.
3
+ Starbound web status panel! Parses the server debug log to show connected players, active worlds and chat history. Can be observed here: [starbound.mispy.me](http://starbound.mispy.me/)
4
+
5
+ ## Installation
6
+
7
+ Requires [Ruby 1.9.3+](https://www.ruby-lang.org/en/). Since it relies on [fuser](https://en.wikipedia.org/wiki/Fuser_\(Unix\)) to find the Starbound process, probably UNIX systems only for the moment.
8
+
9
+ ```bash
10
+ gem install sbpanel
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```
16
+ Usage: sbpanel [options] STARBOUND_LOG_PATH
17
+ -b, --bind ADDR Address to bind [0.0.0.0]
18
+ -p, --port PORT Port to bind [8000]
19
+ -a, --address ADDR Server address to display [hostname]
20
+ -h, --help Display this screen
21
+ ```
data/bin/sbpanel CHANGED
@@ -1,31 +1,61 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'sbpanel'
4
- require 'sinatra'
5
4
  require 'optparse'
5
+ require 'socket'
6
6
 
7
7
  options = {
8
8
  bind: "0.0.0.0",
9
9
  port: 8000,
10
+ address: Socket.gethostname
10
11
  }
11
12
 
12
-
13
- OptionParser.new do |opts|
13
+ optparse = OptionParser.new do |opts|
14
14
  opts.banner = "Usage: sbpanel [options] STARBOUND_LOG_PATH"
15
15
 
16
- opts.on("-v"
16
+ opts.on("-b", "--bind ADDR", "Address to bind [#{options[:bind]}]") do |bind|
17
+ options[:bind] = bind
18
+ end
19
+
20
+ opts.on("-p", "--port PORT", "Port to bind [#{options[:port]}]") do |port|
21
+ options[:port] = port
22
+ end
23
+
24
+ opts.on("-a", "--address ADDR", "Server address to display [#{options[:address]}]") do |address|
25
+ options[:address] = address
26
+ end
27
+
28
+ opts.on('-h', '--help', 'Display this screen') do
29
+ puts opts
30
+ exit
31
+ end
32
+ end
33
+
34
+ optparse.parse!
35
+
36
+ if ARGV.empty?
37
+ puts optparse
38
+ exit 1
17
39
  end
18
40
 
41
+ if !File.exists?(ARGV[-1])
42
+ puts "Error: Couldn't find log file: #{ARGV[-1]}"
43
+ puts optparse
44
+ exit 1
45
+ end
46
+
47
+ require 'sinatra'
19
48
 
20
- set :port, 8000
21
- set :bind, "0.0.0.0"
49
+ set :port, options[:port]
50
+ set :bind, options[:bind]
22
51
  set :root, File.join(File.dirname(__FILE__), '..')
23
52
 
24
- panel = SBPanel::Game.load(ARGV[0])
53
+ game = SBPanel::Game.load(ARGV[0])
54
+ game.address = options[:address]
25
55
 
26
56
  Thread.new do
27
57
  begin
28
- panel.read_logs
58
+ game.read_logs
29
59
  rescue Exception => e
30
60
  puts e.message
31
61
  puts e.backtrace.join("\n")
@@ -35,9 +65,9 @@ end
35
65
  helpers ActionView::Helpers::DateHelper
36
66
 
37
67
  get '/' do
38
- panel.update_status
39
- panel.instance_variables.each do |var|
40
- instance_variable_set var, panel.instance_variable_get(var)
68
+ game.update_status
69
+ game.instance_variables.each do |var|
70
+ instance_variable_set var, game.instance_variable_get(var)
41
71
  end
42
72
  erb :index
43
73
  end
data/lib/sbpanel/game.rb CHANGED
@@ -5,7 +5,7 @@ require 'action_view'
5
5
 
6
6
  module SBPanel
7
7
  class Game
8
- attr_accessor :log_path, :state_path
8
+ attr_accessor :log_path, :state_path, :address
9
9
 
10
10
  def self.load(log_path)
11
11
  state_path = File.join(File.dirname(log_path), ".sbpanel")
@@ -1,3 +1,3 @@
1
1
  module SBPanel
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sbpanel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaiden Mispy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-25 00:00:00.000000000 Z
11
+ date: 2013-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -74,6 +74,7 @@ executables:
74
74
  extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
+ - .gitignore
77
78
  - Gemfile
78
79
  - LICENSE
79
80
  - README.md