Class: Factorix::CLI::Commands::Download
- Defined in:
- lib/factorix/cli/commands/download.rb
Overview
Download Factorio game files from the official download API
Instance Method Summary collapse
-
#call(version: "latest", build: "alpha", platform: nil, channel: "stable", directory: ".", output: nil) ⇒ void
Execute the download command.
Methods inherited from Base
backup_support!, confirmable!, inherited, require_game_stopped!
Instance Method Details
#call(version: "latest", build: "alpha", platform: nil, channel: "stable", directory: ".", output: nil) ⇒ void
This method returns an undefined value.
Execute the download command
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/factorix/cli/commands/download.rb', line 54 def call(version: "latest", build: "alpha", platform: nil, channel: "stable", directory: ".", output: nil, **) platform ||= detect_platform resolved_version = resolve_version(version, channel, build) download_dir = Pathname(directory). raise DirectoryNotFoundError, "Download directory does not exist: #{download_dir}" unless download_dir.exist? filename = output || resolve_filename(resolved_version, build, platform) output_path = download_dir / filename say "Downloading Factorio #{resolved_version} (#{build}/#{platform})...", prefix: :info download_game(resolved_version, build, platform, output_path) say "Downloaded to #{output_path}", prefix: :success end |