Class: UtilityCommands

Inherits:
Thor
  • Object
show all
Defined in:
lib/commands/utility_commands.rb

Instance Method Summary collapse

Instance Method Details

#browser(default_browser = nil) ⇒ Object



32
33
34
35
36
# File 'lib/commands/utility_commands.rb', line 32

def browser(default_browser = nil)
  Utilities.browser = default_browser if default_browser
  selected_options = options[:opts]
  browser_options(selected_options) if selected_options || options[:delete]
end

#browser_options(*opts) ⇒ Object



42
43
44
45
# File 'lib/commands/utility_commands.rb', line 42

def browser_options(*opts)
  Utilities.browser_options = opts unless opts.empty?
  Utilities.delete_browser_options if options[:delete]
end

#debug(toggle) ⇒ Object



88
89
90
91
92
93
# File 'lib/commands/utility_commands.rb', line 88

def debug(toggle)
  enabled = %w[on true 1 yes].include?(toggle.downcase)
  Utilities.debug = enabled
  state = enabled ? 'enabled' : 'disabled'
  say "Debug mode #{state}", :green
end

#desktopObject



104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/commands/utility_commands.rb', line 104

def desktop
  require_relative '../utilities/desktop_downloader'
  version = DesktopDownloader.latest_version
  unless version
    say 'Could not reach GitHub releases. Check your internet connection.', :red
    return
  end

  say "Raider Desktop v#{version} available for #{DesktopDownloader.platform_display_name}"
  DesktopDownloader.download(options[:path])
  say 'Raider Desktop downloaded successfully!', :green
end

#llm(provider = nil) ⇒ Object



123
124
125
126
127
128
129
# File 'lib/commands/utility_commands.rb', line 123

def llm(provider = nil)
  if options[:status] || provider.nil?
    show_llm_status
    return
  end
  configure_llm(provider)
end

#path(default_path) ⇒ Object



15
16
17
18
# File 'lib/commands/utility_commands.rb', line 15

def path(default_path)
  type = options.empty? ? 'page' : options.keys.first
  Utilities.send("#{type}_path=", default_path)
end

#platform(platform) ⇒ Object



82
83
84
# File 'lib/commands/utility_commands.rb', line 82

def platform(platform)
  Utilities.platform = platform
end

#raidObject



53
54
55
56
57
58
59
60
# File 'lib/commands/utility_commands.rb', line 53

def raid
  selected_options = options[:opts]
  if options[:parallel]
    Utilities.parallel_run(selected_options)
  else
    Utilities.run(selected_options)
  end
end

#start_appiumObject



96
97
98
# File 'lib/commands/utility_commands.rb', line 96

def start_appium
  system 'appium  --base-path /wd/hub'
end

#timeout(seconds) ⇒ Object



70
71
72
# File 'lib/commands/utility_commands.rb', line 70

def timeout(seconds)
  Utilities.timeout = seconds
end

#url(default_url) ⇒ Object



22
23
24
# File 'lib/commands/utility_commands.rb', line 22

def url(default_url)
  Utilities.url = default_url
end

#viewport(dimensions) ⇒ Object



76
77
78
# File 'lib/commands/utility_commands.rb', line 76

def viewport(dimensions)
  Utilities.viewport = dimensions
end