gsd-cli 1.1.0 → 1.1.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.
- checksums.yaml +4 -4
- data/lib/cli.rb +1 -1
- data/lib/cli/install.rb +3 -3
- data/lib/cli/run.rb +1 -1
- data/lib/cli/update.rb +3 -6
- data/lib/game_template.rb +0 -33
- data/lib/helpers.rb +9 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1b23dcaeb9319d8486a627e393711dcbd08327e84518300b244480d3a0505da
|
4
|
+
data.tar.gz: bc864679d4d832bae30e22d05a5f5a60b78df8be00d49b22f96a7092b41cb350
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70a5cfad7c1720f5fc23d306f13c4d609125e1e9c4138a615892c0a94fd1adfe74f440567c17d57f757673fa46e40781e9f9f0cb962b450c38c111c3b1eba1c3
|
7
|
+
data.tar.gz: 326fc1cb2fba5a5852828a7d41d247eabd7e74a710e12fc82fe9183d51f1e96aa20a9358548b2a8cde6e76b146845fc18072fda424bf46f403deaec8bb64ab8f
|
data/lib/cli.rb
CHANGED
data/lib/cli/install.rb
CHANGED
@@ -13,13 +13,13 @@ command :install do |c|
|
|
13
13
|
c.option "--steamuser OPTIONAL", String, "Steam user account required to install certain games."
|
14
14
|
c.option "--steampassword OPTIONAL", String, "Steam account password for installing certain games."
|
15
15
|
c.action do |args, options|
|
16
|
-
abort("Install what? Provide a game name argument!") if
|
16
|
+
abort("Install what? Provide a game name argument!") if args.first().nil?
|
17
17
|
install(game_hash[args.first()], options.path, options.steamuser, options.steampassword)
|
18
|
-
|
18
|
+
end
|
19
19
|
end
|
20
20
|
|
21
21
|
def install(game, path, steam_user, steam_password)
|
22
|
-
puts "Beginning to install dedicated server for #{game.name}. This may take a while...".blue
|
22
|
+
puts "Beginning to install dedicated server for #{game.name}. This may take a while...".blue
|
23
23
|
system("rm -f #{"/tmp/#{game.name}.service"}")
|
24
24
|
system("rm -f /etc/systemd/system/#{game.name}.service")
|
25
25
|
GameTemplate.new(game)
|
data/lib/cli/run.rb
CHANGED
data/lib/cli/update.rb
CHANGED
@@ -14,20 +14,17 @@ command :update do |c|
|
|
14
14
|
c.option "--steampassword OPTIONAL", String, "Steam account password for installing certain games."
|
15
15
|
c.action do |args, options|
|
16
16
|
game = game_hash[args.first()]
|
17
|
-
abort("Non-Steam games not supported at this time 😞") if
|
17
|
+
abort("Non-Steam games not supported at this time 😞") if game.app_id.nil?
|
18
18
|
update(game, options.path, options.steamuser, options.steampassword)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
# Update is functionally the same as install at this point because
|
23
|
-
# Servers installed via steamcmd are simply "reinstalled" to update them
|
24
|
-
# Non-steamcmd servers are not supported at this point (thats a 0.3.0 thing)
|
25
22
|
def update(game, path, steam_user, steam_password)
|
26
23
|
puts "Beginning #{game.name} server update. This may take a while...".blue
|
27
24
|
system("rm -f #{"/tmp/#{game.name}.service"}")
|
28
25
|
system("rm -f /etc/systemd/system/#{game.name}.service")
|
29
26
|
GameTemplate.new(game)
|
30
27
|
.install(Helpers.get_install_path(path, game.name),
|
31
|
-
|
28
|
+
Helpers.get_steamcmd_login(steam_user, steam_password))
|
32
29
|
puts "#{game.name} server update complete. Check the output for messages or warnings.".green
|
33
|
-
end
|
30
|
+
end
|
data/lib/game_template.rb
CHANGED
@@ -3,44 +3,12 @@
|
|
3
3
|
require "colorize"
|
4
4
|
require "helpers"
|
5
5
|
|
6
|
-
# Create a Rust server
|
7
6
|
class GameTemplate
|
8
7
|
def initialize(game, remote = "")
|
9
8
|
@game = game
|
10
9
|
@remote = remote
|
11
10
|
end
|
12
11
|
|
13
|
-
def start
|
14
|
-
system("sudo -p 'sudo password: ' systemctl start #{@game.name}")
|
15
|
-
end
|
16
|
-
|
17
|
-
def restart
|
18
|
-
command = "systemctl restart #{@game.name}"
|
19
|
-
if @remote.nil?
|
20
|
-
system("sudo -p 'sudo password: ' #{command}")
|
21
|
-
else
|
22
|
-
puts @remote
|
23
|
-
puts command
|
24
|
-
Helpers.remote_cmd(@remote, command)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def status
|
29
|
-
system("sudo -p 'sudo password: ' systemctl status #{@game.name}")
|
30
|
-
end
|
31
|
-
|
32
|
-
def stop
|
33
|
-
system("sudo -p 'sudo password: ' systemctl stop #{@game.name}")
|
34
|
-
end
|
35
|
-
|
36
|
-
def enable
|
37
|
-
system("sudo -p 'sudo password: ' systemctl enable #{@game.name}")
|
38
|
-
end
|
39
|
-
|
40
|
-
def disable
|
41
|
-
system("sudo -p 'sudo password: ' systemctl disable #{@game.name}")
|
42
|
-
end
|
43
|
-
|
44
12
|
def run(install_path)
|
45
13
|
exec(@game.launch(install_path))
|
46
14
|
end
|
@@ -57,7 +25,6 @@ class GameTemplate
|
|
57
25
|
|
58
26
|
private
|
59
27
|
|
60
|
-
# Installs or Updates a dedicated game server via Steamcmd
|
61
28
|
def install_steam_server(install_path, steam_login)
|
62
29
|
abort("STEAMCMD does not appear to be installed! Aborting...".red) if `which steamcmd`.empty?
|
63
30
|
system("$(which steamcmd) #{steam_login} +quit")
|
data/lib/helpers.rb
CHANGED
@@ -17,20 +17,20 @@ module Helpers
|
|
17
17
|
|
18
18
|
def self.get_install_path(path, game)
|
19
19
|
install_path = if path.nil?
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
puts "Install path was not provided: defaulting to /opt/#{game}".yellow
|
21
|
+
"/opt/#{game}"
|
22
|
+
else
|
23
|
+
path
|
24
|
+
end
|
25
25
|
install_path
|
26
26
|
end
|
27
27
|
|
28
28
|
def self.get_steamcmd_login(steam_user, steam_password)
|
29
29
|
steam_login = if steam_user.nil?
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
"+login anonymous"
|
31
|
+
else
|
32
|
+
"+login #{steam_user} #{steam_password}"
|
33
|
+
end
|
34
34
|
steam_login
|
35
35
|
end
|
36
36
|
end
|