sbcp 0.1.4 → 0.2.3

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.
@@ -1,22 +1,56 @@
1
+ # SBCP - Starbound Server Management Solution for Linux Servers
2
+ # Copyright (C) 2016 Kazyyk
3
+
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU Affero General Public License as
6
+ # published by the Free Software Foundation, either version 3 of the
7
+ # License, or (at your option) any later version.
8
+
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU Affero General Public License for more details.
13
+
14
+ # You should have received a copy of the GNU Affero General Public License
15
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ require 'yaml'
18
+ require 'logger'
19
+ require 'rufus-scheduler'
20
+ require 'celluloid/current'
21
+
22
+ require_relative 'parser'
23
+
1
24
  module SBCP
2
25
  class Starbound
26
+ include Celluloid
27
+
28
+ SESSION = {}
29
+
3
30
  def initialize
4
31
  @config = YAML.load_file(File.expand_path('../../../config.yml', __FILE__))
32
+ SESSION[:info] = {
33
+ :started => nil,
34
+ :uptime => nil,
35
+ :restart_in => nil,
36
+ }
37
+ SESSION[:players] = {}
38
+ SESSION[:info][:restart_in] = 'Never' if @config['restart_schedule'] == 'disabled'
5
39
  backup_schedule = @config['backup_schedule']
6
40
  restart_schedule = @config['restart_schedule']
7
41
  scheduler = Rufus::Scheduler.new
8
42
  unless ['restart', 'none'].include? backup_schedule # Only run backups if they're not set to run at restart or aren't disabled
9
43
  if backup_schedule == 'hourly'
10
44
  scheduler.cron "0 */1 * * *" do
11
- SBCP::Backup.create_backup
45
+ Backup.create_backup
12
46
  end
13
47
  elsif backup_schedule == 'daily'
14
48
  scheduler.cron "0 0 * * *" do
15
- SBCP::Backup.create_backup
49
+ Backup.create_backup
16
50
  end
17
51
  else
18
52
  scheduler.cron "0 */#{backup_schedule} * * *" do
19
- SBCP::Backup.create_backup
53
+ Backup.create_backup
20
54
  end
21
55
  end
22
56
  end
@@ -41,31 +75,21 @@ module SBCP
41
75
  end
42
76
 
43
77
  def start
44
- if @config['log_style'] == 'daily' then
45
- log = Logger.new("#{@config['log_directory']}/starbound.log", 'daily', @config['log_history'])
46
- elsif @config['log_style'] == 'restart' then
47
- stamp = "#{Time.now.strftime("%m-%d-%Y-%H-%M-%S")}-starbound"
48
- log = Logger.new("#{@config['log_directory']}/#{stamp}.log")
49
- else
50
- abort("Error: Invalid log style")
51
- end
52
- log.formatter = proc { |severity, datetime, progname, msg| date_format = datetime.strftime("%H:%M:%S.%N")[0...-6]; "[#{date_format}] #{msg}" }
53
- log.level = Logger::INFO
54
- log.info("---------- SBCP is starting a new Starbound instance ----------\n")
55
- #parser = SBCP::Parser.new
78
+ parser = Parser.new
79
+
80
+ SESSION[:info][:started] = Time.now
56
81
 
57
82
  IO.popen("#{@config['starbound_directory']}/linux64/starbound_server", :chdir=>"#{@config['starbound_directory']}/linux64", :err=>[:child, :out]) do |output|
58
83
  while line = output.gets
59
- log.info(line)
60
- #parser.async.parse(line)
84
+ parser.async.parse(line)
61
85
  end
62
86
  end
63
87
 
64
88
  ensure
65
- log.info("---------- Starbound has successfully shut down ----------\n")
66
- log.info("\n") # Adds a newline space at the end of the log. Helpful for separating restarts in daily logs.
67
- log.close
68
- #parser.terminate
89
+ parser.log("---------- Starbound has successfully shut down ----------\n")
90
+ parser.log("\n") # Adds a newline space at the end of the log. Helpful for separating restarts in daily logs.
91
+ parser.close
92
+ parser.terminate
69
93
  end
70
94
  end
71
95
  end
@@ -1,3 +1,19 @@
1
+ # SBCP - Starbound Server Management Solution for Linux Servers
2
+ # Copyright (C) 2016 Kazyyk
3
+
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU Affero General Public License as
6
+ # published by the Free Software Foundation, either version 3 of the
7
+ # License, or (at your option) any later version.
8
+
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU Affero General Public License for more details.
13
+
14
+ # You should have received a copy of the GNU Affero General Public License
15
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+
1
17
  module SBCP
2
- VERSION = "0.1.4"
18
+ VERSION = "0.2.3"
3
19
  end
@@ -7,11 +7,11 @@ Gem::Specification.new do |spec|
7
7
  spec.name = 'sbcp'
8
8
  spec.version = SBCP::VERSION
9
9
  spec.authors = ['Kazyyk']
10
- spec.email = ['contact@kazyyk.com']
10
+ spec.email = ['kazyyk@gmail.com']
11
11
 
12
12
  spec.summary = %q{SBCP is a Starbound server management solution for Linux.}
13
13
  spec.homepage = 'https://www.kazyyk.com/sbcp'
14
- spec.license = 'AGPLv3'
14
+ spec.license = 'GNU AGPL v3'
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
17
  spec.bindir = 'bin'
@@ -28,10 +28,11 @@ Gem::Specification.new do |spec|
28
28
  #spec.add_runtime_dependency 'dm-sqlite-adapter', '~> 1.2'
29
29
  spec.add_runtime_dependency 'celluloid', '~> 0.17.3'
30
30
  spec.add_runtime_dependency 'rufus-scheduler', '~> 3.2'
31
- #spec.add_runtime_dependency 'steam-condenser', '~> 1.3', '>= 1.3.11'
31
+ spec.add_runtime_dependency 'steam-condenser', '~> 1.3', '>= 1.3.11'
32
32
  spec.add_runtime_dependency 'rsync', '~> 1.0', '>= 1.0.9'
33
33
  spec.add_runtime_dependency 'rbzip2', '~> 0.2.0' # seven_zip_ruby would not compile, using this instead
34
34
  spec.add_runtime_dependency 'highline', '~> 1.7', '>= 1.7.8'
35
+ spec.add_runtime_dependency 'time_diff', '~> 0.3.0'
35
36
 
36
37
 
37
38
  spec.add_development_dependency 'bundler', '~> 1.11'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sbcp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazyyk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-28 00:00:00.000000000 Z
11
+ date: 2016-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: celluloid
@@ -38,6 +38,26 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: steam-condenser
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 1.3.11
51
+ type: :runtime
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '1.3'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 1.3.11
41
61
  - !ruby/object:Gem::Dependency
42
62
  name: rsync
43
63
  requirement: !ruby/object:Gem::Requirement
@@ -92,6 +112,20 @@ dependencies:
92
112
  - - ">="
93
113
  - !ruby/object:Gem::Version
94
114
  version: 1.7.8
115
+ - !ruby/object:Gem::Dependency
116
+ name: time_diff
117
+ requirement: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - "~>"
120
+ - !ruby/object:Gem::Version
121
+ version: 0.3.0
122
+ type: :runtime
123
+ prerelease: false
124
+ version_requirements: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - "~>"
127
+ - !ruby/object:Gem::Version
128
+ version: 0.3.0
95
129
  - !ruby/object:Gem::Dependency
96
130
  name: bundler
97
131
  requirement: !ruby/object:Gem::Requirement
@@ -150,7 +184,7 @@ dependencies:
150
184
  version: 0.6.3
151
185
  description:
152
186
  email:
153
- - contact@kazyyk.com
187
+ - kazyyk@gmail.com
154
188
  executables:
155
189
  - sbcp
156
190
  extensions: []
@@ -168,15 +202,20 @@ files:
168
202
  - config.yml
169
203
  - lib/sbcp.rb
170
204
  - lib/sbcp/backup.rb
205
+ - lib/sbcp/config.rb
171
206
  - lib/sbcp/daemon.rb
207
+ - lib/sbcp/help.rb
172
208
  - lib/sbcp/logs.rb
209
+ - lib/sbcp/panel.rb
173
210
  - lib/sbcp/parser.rb
211
+ - lib/sbcp/rcon.rb
212
+ - lib/sbcp/setup.rb
174
213
  - lib/sbcp/starbound.rb
175
214
  - lib/sbcp/version.rb
176
215
  - sbcp.gemspec
177
216
  homepage: https://www.kazyyk.com/sbcp
178
217
  licenses:
179
- - AGPLv3
218
+ - GNU AGPL v3
180
219
  metadata: {}
181
220
  post_install_message:
182
221
  rdoc_options: []