gsd-cli 0.1.6 → 0.1.7
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/bin/gsd-cli +1 -0
- data/lib/cli.rb +6 -4
- data/lib/game_template.rb +12 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f51a3f09492d1446b2686d71c78e5974d82629d81750a7d889c33168297382b
|
4
|
+
data.tar.gz: 6db2c60577a47d8496a1713b9fc4f692106830c9562dcf0dc69bebfb76034938
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3264339bf20ff93de39ee70832c9739f9085c0baaad522a18d6c797c0e72150320402a8a79642920cd7e649aaf2c0a60a23695a978be91ba2159d597b2dd55bb
|
7
|
+
data.tar.gz: cb7dfe47c96048b258937d0472612f33559e9d45ca3afd0a94084002b10cd4e3932f3caa4d7d2ef2292f3c364e958b36a0452e445ce4c9d34ce8320810c59249
|
data/bin/gsd-cli
CHANGED
data/lib/cli.rb
CHANGED
@@ -34,11 +34,13 @@ command :install do |c|
|
|
34
34
|
c.syntax = "gsd install [args] [options]"
|
35
35
|
c.summary = "Install and deploy a dedicated game server as a daemon."
|
36
36
|
c.description = "Installs and deploy a dedicated game server as a daemon (systemd unit)."
|
37
|
-
c.option "--path
|
38
|
-
c.option "--
|
39
|
-
c.option "--
|
37
|
+
c.option "--path OPTIONAL", String, "Path that the game server will be installed to."
|
38
|
+
c.option "--devmode OPTIONAL", String, "To run from source or as a Gem. ('y' to run from source)"
|
39
|
+
c.option "--steamuser OPTIONAL", String, "Steam user account required to install certain games."
|
40
|
+
c.option "--steampassword OPTIONAL", String, "Steam account password for installing certain games."
|
40
41
|
c.action do |args, options|
|
41
|
-
GameTemplate.new(@games[args.first()], options.path)
|
42
|
+
GameTemplate.new(@games[args.first()], options.path)
|
43
|
+
.install(options.steamuser, options.steampassword, options.devmode)
|
42
44
|
end
|
43
45
|
end
|
44
46
|
|
data/lib/game_template.rb
CHANGED
@@ -36,7 +36,7 @@ class GameTemplate
|
|
36
36
|
exec(@game.launch(@install_path))
|
37
37
|
end
|
38
38
|
|
39
|
-
def install(steamuser, steampassword)
|
39
|
+
def install(steamuser, steampassword, dev_mode)
|
40
40
|
puts "Beginning installation process. This may take a while..."
|
41
41
|
ensure_delete_unit_file()
|
42
42
|
if @game.app_id.nil?
|
@@ -44,13 +44,17 @@ class GameTemplate
|
|
44
44
|
else
|
45
45
|
install_steam_server(steamuser, steampassword)
|
46
46
|
end
|
47
|
-
|
47
|
+
binary_path = if dev_mode.nil?
|
48
|
+
"/usr/local/bin/gsd-cli"
|
49
|
+
else
|
50
|
+
puts "Dev mode enabled - running from source"
|
51
|
+
"#{Dir.pwd}/bin/gsd-cli"
|
52
|
+
end
|
53
|
+
create_unit_file(binary_path)
|
48
54
|
system("sudo -p 'sudo password: ' cp -f #{@file_path} /etc/systemd/system/#{@game.name}.service")
|
49
55
|
puts "Server installation & deployment complete!".green
|
50
56
|
end
|
51
57
|
|
52
|
-
# Generic cli-facing update function
|
53
|
-
# for updating installed dedicated game servers
|
54
58
|
def update
|
55
59
|
if @game.app_id.nil?
|
56
60
|
puts "Non-Steam games not supported."
|
@@ -87,13 +91,13 @@ class GameTemplate
|
|
87
91
|
File.delete(@file_path) if File.file?(@file_path)
|
88
92
|
end
|
89
93
|
|
90
|
-
def create_unit_file
|
94
|
+
def create_unit_file(binary_path)
|
91
95
|
out_file = File.new(@file_path, "w")
|
92
|
-
out_file.puts(unit_file_contents()) # TODO: Pass in map with config
|
96
|
+
out_file.puts(unit_file_contents(binary_path)) # TODO: Pass in map with config
|
93
97
|
out_file.close()
|
94
98
|
end
|
95
99
|
|
96
|
-
def unit_file_contents
|
100
|
+
def unit_file_contents(binary_path)
|
97
101
|
"[Unit]
|
98
102
|
After=network.target
|
99
103
|
Description=#{@desc}
|
@@ -104,6 +108,6 @@ class GameTemplate
|
|
104
108
|
WorkingDirectory=#{Dir.pwd}
|
105
109
|
Type=simple
|
106
110
|
User=#{`whoami`}
|
107
|
-
ExecStart=#{
|
111
|
+
ExecStart=#{binary_path} #{@game.name} --path #{@install_path}"
|
108
112
|
end
|
109
113
|
end
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Egee
|
@@ -41,7 +41,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
41
41
|
requirements:
|
42
42
|
- - ">="
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
version: '2.
|
44
|
+
version: '2.5'
|
45
45
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - ">="
|