Module: Pod::Downloader::API
- Defined in:
- lib/cocoapods-downloader/api.rb
Overview
The Downloader::Hooks module allows to adapt the Downloader to the UI of other gems.
Instance Method Summary collapse
-
#check_exit_code!(executable, command, output) ⇒ void
Checks if the just executed command completed successfully.
-
#execute_command(executable, command, raise_on_failure = false) ⇒ String
Executes.
-
#ui_action(message) { ... } ⇒ void
Indicates that an action will be performed.
-
#ui_message(message) ⇒ void
Prints an UI message.
-
#ui_sub_action(message) { ... } ⇒ void
Indicates that a minor action will be performed.
Instance Method Details
#check_exit_code!(executable, command, output) ⇒ void
This method returns an undefined value.
Checks if the just executed command completed successfully.
25 26 27 28 29 |
# File 'lib/cocoapods-downloader/api.rb', line 25 def check_exit_code!(executable, command, output) if $?.exitstatus != 0 raise DownloaderError, "Error on `#{executable} #{command}`.\n#{output}" end end |
#execute_command(executable, command, raise_on_failure = false) ⇒ String
Executes
10 11 12 13 14 15 16 17 |
# File 'lib/cocoapods-downloader/api.rb', line 10 def execute_command(executable, command, raise_on_failure = false) require 'shellwords' command = command.map(&:to_s).map(&:shellescape).join(' ') output = `\n#{executable} #{command} 2>&1` check_exit_code!(executable, command, output) if raise_on_failure puts output output end |
#ui_action(message) { ... } ⇒ void
This method returns an undefined value.
Indicates that an action will be performed. The action is passed as a block.
41 42 43 44 |
# File 'lib/cocoapods-downloader/api.rb', line 41 def ui_action() puts yield end |
#ui_message(message) ⇒ void
This method returns an undefined value.
Prints an UI message.
68 69 70 |
# File 'lib/cocoapods-downloader/api.rb', line 68 def () puts end |
#ui_sub_action(message) { ... } ⇒ void
This method returns an undefined value.
Indicates that a minor action will be performed. The action is passed as a block.
56 57 58 59 |
# File 'lib/cocoapods-downloader/api.rb', line 56 def ui_sub_action() puts yield end |