Method: Bundler::GemBytes::ScriptExecutor#execute

Defined in:
lib/bundler/gem_bytes/script_executor.rb

#execute(path_or_uri) ⇒ void

This method returns an undefined value.

Executes a script from a given URI or file path

This method loads the script located at the specified path_or_uri and executes it within the context of this class which includes Thor::Actions and Bundler::GemBytes::ScriptExecutor. This allows the script to perform tasks such as modifying files, creating directories, and other common file system operations.

Examples:

Execute a script from a path

execute('path/to/script.rb')

Parameters:

  • path_or_uri (String)

    the URI or file path to the script

Raises:

  • (RuntimeError)

    if the script cannot be loaded



54
55
56
57
58
# File 'lib/bundler/gem_bytes/script_executor.rb', line 54

def execute(path_or_uri)
  apply(path_or_uri)
rescue StandardError => e
  raise "Failed to execute script from #{path_or_uri}: #{e.message}"
end