pigman 0.1.0
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 +7 -0
- data/bin/pigman +8 -0
- data/lib/pigman.rb +79 -0
- data/lib/pigman/version.rb +3 -0
- metadata +48 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 38bcdf006e1523c95fc9976fa57e6da026a0d336
|
|
4
|
+
data.tar.gz: ea4a80ce53d5b30850c4adffb6660c4d1dbcaded
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 78fad237f87534fd91ae24acfbf773c8bf2e03c15f86fe8f791f3977e89ff062b8641c925eea702bd3776f323b05c3231b71ab5b1b22796fbd7ccdff094320eb
|
|
7
|
+
data.tar.gz: a4293b09720cfc67f7b4f720b9fe6b6564624d5f3a339e3688ccc7ddad0b8f8e249eab7113906c03b369ce5632b2466fa6892d1e8216090d6cb8718b4724f1ed
|
data/bin/pigman
ADDED
data/lib/pigman.rb
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
require "yaml"
|
|
2
|
+
require_relative "pigman/version"
|
|
3
|
+
|
|
4
|
+
module Pigman
|
|
5
|
+
|
|
6
|
+
class Server
|
|
7
|
+
|
|
8
|
+
def initialize
|
|
9
|
+
@config = nil
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def start
|
|
13
|
+
puts 'Loading config...'
|
|
14
|
+
# Load config from pigman.yml
|
|
15
|
+
@config = YAML.load_file 'pigman.yml'
|
|
16
|
+
if @config == false
|
|
17
|
+
@config = {}
|
|
18
|
+
end
|
|
19
|
+
# Apply server settings from config
|
|
20
|
+
memory = @config['memory']
|
|
21
|
+
if memory != nil
|
|
22
|
+
@memory_max = memory['max']
|
|
23
|
+
@memory_min = memory['min']
|
|
24
|
+
end
|
|
25
|
+
address = @config['address']
|
|
26
|
+
if address != nil
|
|
27
|
+
@host = address['host']
|
|
28
|
+
@port = address['port']
|
|
29
|
+
end
|
|
30
|
+
@eula = @config['eula'] == true
|
|
31
|
+
@level_name = @config['level-name']
|
|
32
|
+
@bonus_chest = @config['bonus-chest']
|
|
33
|
+
# Run system commands required to start server with the given
|
|
34
|
+
# settings, i.e. auto-update, start_ram, max_ram, etc.
|
|
35
|
+
command = ['java']
|
|
36
|
+
# Memory settings
|
|
37
|
+
if @memory_max.is_a?(String) || @memory_max.is_a?(Numeric)
|
|
38
|
+
command << "-Xmx#{@memory_max}"
|
|
39
|
+
end
|
|
40
|
+
if @memory_min.is_a?(String) || @memory_min.is_a?(Numeric)
|
|
41
|
+
command << "-Xms#{@memory_min}"
|
|
42
|
+
end
|
|
43
|
+
# Eula
|
|
44
|
+
if @eula == true
|
|
45
|
+
command << "-Dcom.mojang.eula.agree=#{@eula}"
|
|
46
|
+
end
|
|
47
|
+
# Jar
|
|
48
|
+
command << '-jar'
|
|
49
|
+
command << 'spigot-1.14.4.jar'
|
|
50
|
+
# Universe and world
|
|
51
|
+
if @universe.is_a? String
|
|
52
|
+
command << '--universe'
|
|
53
|
+
command << @universe
|
|
54
|
+
end
|
|
55
|
+
if @world.is_a? String
|
|
56
|
+
command << '--world'
|
|
57
|
+
command << @world
|
|
58
|
+
end
|
|
59
|
+
# Network settings
|
|
60
|
+
if @host.is_a? String
|
|
61
|
+
command << '--serverId'
|
|
62
|
+
command << @host
|
|
63
|
+
end
|
|
64
|
+
if @port.is_a?(String) || @port.is_a?(Numeric)
|
|
65
|
+
command << '--port'
|
|
66
|
+
command << "#{@port}"
|
|
67
|
+
end
|
|
68
|
+
# Misc. options
|
|
69
|
+
if @bonus_chest
|
|
70
|
+
command << '--bonusChest'
|
|
71
|
+
end
|
|
72
|
+
# Start the server
|
|
73
|
+
puts "Starting server..."
|
|
74
|
+
system(*command)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: pigman
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Joseph Caruso
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2019-07-28 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Improves SpigotMC by adding auto-magical updates, a config to simplify
|
|
14
|
+
start commands, and more.
|
|
15
|
+
email: jcaru@jcaru.com
|
|
16
|
+
executables:
|
|
17
|
+
- pigman
|
|
18
|
+
extensions: []
|
|
19
|
+
extra_rdoc_files: []
|
|
20
|
+
files:
|
|
21
|
+
- bin/pigman
|
|
22
|
+
- lib/pigman.rb
|
|
23
|
+
- lib/pigman/version.rb
|
|
24
|
+
homepage: https://github.com/jcaru/pigman
|
|
25
|
+
licenses:
|
|
26
|
+
- MIT
|
|
27
|
+
metadata: {}
|
|
28
|
+
post_install_message:
|
|
29
|
+
rdoc_options: []
|
|
30
|
+
require_paths:
|
|
31
|
+
- lib
|
|
32
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
33
|
+
requirements:
|
|
34
|
+
- - ">="
|
|
35
|
+
- !ruby/object:Gem::Version
|
|
36
|
+
version: '0'
|
|
37
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
38
|
+
requirements:
|
|
39
|
+
- - ">="
|
|
40
|
+
- !ruby/object:Gem::Version
|
|
41
|
+
version: '0'
|
|
42
|
+
requirements: []
|
|
43
|
+
rubyforge_project:
|
|
44
|
+
rubygems_version: 2.5.2.3
|
|
45
|
+
signing_key:
|
|
46
|
+
specification_version: 4
|
|
47
|
+
summary: Better SpigotMC server hosting.
|
|
48
|
+
test_files: []
|