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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8051e4605204e9caa7cbf7f8465255047079d14d7e5f98a08279f244ccb67270
4
- data.tar.gz: a857383dce33ff386f0d65ec00d6a1d5c66b8ae676190fa6a7ac208b6e8729eb
3
+ metadata.gz: a1b23dcaeb9319d8486a627e393711dcbd08327e84518300b244480d3a0505da
4
+ data.tar.gz: bc864679d4d832bae30e22d05a5f5a60b78df8be00d49b22f96a7092b41cb350
5
5
  SHA512:
6
- metadata.gz: f782fa5d3e4bbf415714b5daddfe561126f90782a3213662feabef07664f7fa8f18f13fcc3bcd633bc583a3d3779152c319d6b17947ebe0a303ced3c72ab93a9
7
- data.tar.gz: f02e243452f7e41d329b3f3f31713130574ad2170a7461acad177c88efb2fa70f6e951cc43522432723931c47a04cb177dbfd7a7726640fb5272556f28a2a30d
6
+ metadata.gz: 70a5cfad7c1720f5fc23d306f13c4d609125e1e9c4138a615892c0a94fd1adfe74f440567c17d57f757673fa46e40781e9f9f0cb962b450c38c111c3b1eba1c3
7
+ data.tar.gz: 326fc1cb2fba5a5852828a7d41d247eabd7e74a710e12fc82fe9183d51f1e96aa20a9358548b2a8cde6e76b146845fc18072fda424bf46f403deaec8bb64ab8f
data/lib/cli.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  require "commander/import"
4
4
 
5
5
  program :name, "gsd-cli"
6
- program :version, "1.0.2"
6
+ program :version, "1.1.1"
7
7
  program :description, "A cli tool to deploy & manage dedicated game servers on Linux"
8
8
 
9
9
  require "cli/install"
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 (args.first().nil?)
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
- end
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 #TODO: Implement & use friendly name property
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
@@ -12,4 +12,4 @@ command :run do |c|
12
12
  c.action do |args, options|
13
13
  GameTemplate.new(game_hash[args.first()]).run(options.path)
14
14
  end
15
- end
15
+ end
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 (game.app_id.nil?)
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
- Helpers.get_steamcmd_login(steam_user, steam_password))
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
- puts "Install path was not provided: defaulting to /opt/#{game}".yellow
21
- "/opt/#{game}"
22
- else
23
- path
24
- end
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
- "+login anonymous"
31
- else
32
- "+login #{steam_user} #{steam_password}"
33
- end
30
+ "+login anonymous"
31
+ else
32
+ "+login #{steam_user} #{steam_password}"
33
+ end
34
34
  steam_login
35
35
  end
36
36
  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: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Egee