Class: UtilityCommands
- Inherits:
-
Thor
- Object
- Thor
- UtilityCommands
- Defined in:
- lib/commands/utility_commands.rb
Instance Method Summary collapse
- #browser(default_browser = nil) ⇒ Object
- #browser_options(*opts) ⇒ Object
- #debug(toggle) ⇒ Object
- #desktop ⇒ Object
- #llm(provider = nil) ⇒ Object
- #path(default_path) ⇒ Object
- #platform(platform) ⇒ Object
- #raid ⇒ Object
- #start_appium ⇒ Object
- #timeout(seconds) ⇒ Object
- #url(default_url) ⇒ Object
- #viewport(dimensions) ⇒ Object
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 = [:opts] () if || [:delete] end |
#browser_options(*opts) ⇒ Object
42 43 44 45 |
# File 'lib/commands/utility_commands.rb', line 42 def (*opts) Utilities. = opts unless opts.empty? Utilities. if [: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 |
#desktop ⇒ Object
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([: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 [: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 = .empty? ? 'page' : .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 |
#raid ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'lib/commands/utility_commands.rb', line 53 def raid = [:opts] if [:parallel] Utilities.parallel_run() else Utilities.run() end end |
#start_appium ⇒ Object
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 (dimensions) Utilities. = dimensions end |