gsd-cli 0.1.13 → 0.1.14
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 +7 -4
- data/lib/game_template.rb +14 -4
- data/lib/helpers.rb +7 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 180005bcfea09309b5ef539282bb63634e3e8e5f51f4097ab897106732f71683
|
4
|
+
data.tar.gz: c1488aab97f08b0474f720af85f1ee613e8df1bc64fc9094e6f777423451f0bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: beb67e9455bc06afaeaf3dbcf668045b5de61ef31a6fc20537826c308bad7ade4ac4dfca1a08ddb000d788e616271ba890dec3a68546604178ecd2acc0876b42
|
7
|
+
data.tar.gz: 2b042fb9335aed22bb71abc7aa4f65fa5e988ebace7bf34d166fa09b3215e840902f88cb04fafdbb2c976cda3fe6beda3bab231aa4276e756f18a8da60578ee4
|
data/lib/cli.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "yaml"
|
2
4
|
require "colorize"
|
3
5
|
require "commander/import"
|
@@ -29,7 +31,7 @@ end
|
|
29
31
|
@games = userdata
|
30
32
|
|
31
33
|
program :name, "gsd-cli"
|
32
|
-
program :version, "0.1.
|
34
|
+
program :version, "0.1.14"
|
33
35
|
program :description, "A cli tool to deploy & manage dedicated game servers on Linux"
|
34
36
|
|
35
37
|
command :install do |c|
|
@@ -79,8 +81,9 @@ command :restart do |c|
|
|
79
81
|
c.syntax = "gsd restart [args]"
|
80
82
|
c.summary = "Restart a installed dedicated game server."
|
81
83
|
c.description = "Restarts a dedicated game server daemon that has already been installed to the system."
|
82
|
-
c.
|
83
|
-
|
84
|
+
c.option "--remote OPTIONAL", String, "Connection string to a remote host server."
|
85
|
+
c.action do |args, options|
|
86
|
+
GameTemplate.new(@games[args.first()], options.remote).restart()
|
84
87
|
end
|
85
88
|
end
|
86
89
|
|
@@ -138,7 +141,7 @@ command :uninstall do |c|
|
|
138
141
|
c.summary = "Uninstall a dedicated game server."
|
139
142
|
c.description = "Uninstalls and removes all files associated with a dedicated game server."
|
140
143
|
c.option "--name STRING", String, "Name of the dedicated game server."
|
141
|
-
c.action do |
|
144
|
+
c.action do |_args, _options|
|
142
145
|
puts "Not Implemented"
|
143
146
|
end
|
144
147
|
end
|
data/lib/game_template.rb
CHANGED
@@ -1,11 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "colorize"
|
4
|
+
require "helpers"
|
2
5
|
|
3
6
|
# Create a Rust server
|
4
7
|
class GameTemplate
|
5
|
-
def initialize(game, path = nil)
|
8
|
+
def initialize(game, remote, path = nil)
|
6
9
|
@game = game
|
7
10
|
@install_path = get_install_path(path)
|
8
11
|
@file_path = "/tmp/#{@game.name}.service"
|
12
|
+
@remote = remote
|
9
13
|
end
|
10
14
|
|
11
15
|
def start
|
@@ -13,7 +17,14 @@ class GameTemplate
|
|
13
17
|
end
|
14
18
|
|
15
19
|
def restart
|
16
|
-
|
20
|
+
command = "systemctl restart #{@game.name}"
|
21
|
+
if @remote.nil?
|
22
|
+
system("sudo -p 'sudo password: ' #{command}")
|
23
|
+
else
|
24
|
+
puts @remote
|
25
|
+
puts command
|
26
|
+
Helpers.remote_cmd(@remote, command)
|
27
|
+
end
|
17
28
|
end
|
18
29
|
|
19
30
|
def status
|
@@ -80,7 +91,7 @@ class GameTemplate
|
|
80
91
|
|
81
92
|
def get_install_path(path)
|
82
93
|
install_path = if path.nil?
|
83
|
-
|
94
|
+
# puts "Install path not defined: installing to /tmp/#{@game.name}".yellow
|
84
95
|
"/tmp/#{@game.name}"
|
85
96
|
else
|
86
97
|
path
|
@@ -107,7 +118,6 @@ class GameTemplate
|
|
107
118
|
WantedBy=default.target
|
108
119
|
[Service]
|
109
120
|
LimitNPROC=infinity
|
110
|
-
WorkingDirectory=#{@install_path}
|
111
121
|
Type=simple
|
112
122
|
User=#{`whoami`}
|
113
123
|
ExecStart=#{binary_path} run #{@game.name} --path #{@install_path}"
|
data/lib/helpers.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gsd-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Egee
|
@@ -29,6 +29,7 @@ files:
|
|
29
29
|
- lib/game_servers/team_fortress.rb
|
30
30
|
- lib/game_servers/terraria.rb
|
31
31
|
- lib/game_template.rb
|
32
|
+
- lib/helpers.rb
|
32
33
|
homepage: https://github.com/Egeeio/gsd-cli
|
33
34
|
licenses:
|
34
35
|
- MIT
|