class Routemaster::CLI::Helper
Public Class Methods
new(config)
click to toggle source
# File routemaster/cli/helper.rb, line 9 def initialize(config) @config = config end
Public Instance Methods
client()
click to toggle source
# File routemaster/cli/helper.rb, line 13 def client _configure_client Routemaster::Client end
Private Instance Methods
_bus_token()
click to toggle source
# File routemaster/cli/helper.rb, line 31 def _bus_token case @config.bus when /^@(.*)/ then @config.token || _rc_file_data.dig($1, :token) else @config.token end end
_bus_url()
click to toggle source
# File routemaster/cli/helper.rb, line 20 def _bus_url case @config.bus when /^@(.*)/ then domain = _rc_file_data.dig($1, :bus) raise "No configuration for bus '#{$1}' found in .rtmrc" if domain.nil? "https://#{domain}" else "https://#{@config.bus}" end end
_configure_client()
click to toggle source
# File routemaster/cli/helper.rb, line 40 def _configure_client Routemaster::Client.configure do |c| c.url = _bus_url c.uuid = _bus_token end end
_rc_file_data()
click to toggle source
# File routemaster/cli/helper.rb, line 47 def _rc_file_data data = if File.exist?('.rtmrc') YAML.load_file('.rtmrc') elsif File.exist?(File.expand_path '~/.rtmrc') YAML.load_file(File.expand_path '~/.rtmrc') else {} end Hashie::Mash.new(data) end