Sha256: 1f07b37296b14f3f27a14d050982b919c1c257fc945820d527ac0ccb8d0a9adf
Contents?: true
Size: 951 Bytes
Versions: 12
Compression:
Stored size: 951 Bytes
Contents
require "pathname" require "yaml" require "uri" module Terminalwire::Client class Exec attr_reader :arguments, :path, :configuration, :url def initialize(path:, arguments:) @arguments = arguments @path = Pathname.new(path) @configuration = YAML.safe_load_file(@path) @url = URI(@configuration.fetch("url")) rescue Errno::ENOENT => e raise Terminalwire::Error, "File not found: #{@path}" rescue URI::InvalidURIError => e raise Terminalwire::Error, "Invalid URI: #{@url}" rescue KeyError => e raise Terminalwire::Error, "Missing key in configuration: #{e}" end def start Terminalwire::Client.websocket(url:, arguments:) end def self.start case ARGV in path, *arguments new(path:, arguments:).start end rescue NoMatchingPatternError => e raise Terminalwire::Error, "Launched with incorrect arguments: #{ARGV}" end end end
Version data entries
12 entries across 12 versions & 1 rubygems