module MultiZip::Backend::Cli
If no suitable gems are found, this is the last-gasp fallback. We use whatever command-line zipping/unzipping tools we can find and that we know how to use.
This will likely be a huge work in progress since it involves a lot of detection. We'll need to detect the host OS and version, the tools available in the path (or specified by the user, optionally) and the command-line arguments to be used for those tools.
OS Unzip Zip
Constants
- STRATEGY_MODULES
Public Class Methods
detect_strategy()
click to toggle source
# File lib/multi_zip/backend/cli.rb, line 59 def self.detect_strategy STRATEGY_MODULES.detect{|strategy_module_file, strategy_module_constant| require "multi_zip/backend/cli/#{strategy_module_file}" strategy_module = strategy_module_constant.call if strategy_module.available? return strategy_module end } end
extended(mod)
click to toggle source
# File lib/multi_zip/backend/cli.rb, line 37 def self.extended(mod) if strategy_available? require "multi_zip/backend/cli/#{strategy.require_name}" extend strategy.extend_class.call warn([ "MultiZip is using the \"#{strategy.human_name}\" command-line program.", 'This feature is considered PRE-ALPHA, unstable and inefficient and', 'should not be used in production environments.' ].join("\n")) else raise MultiZip::NoSupportedBackendError, "MultiZip::Backend::Cli could find no suitable zipping/unzipping programs in path." end end
strategy()
click to toggle source
# File lib/multi_zip/backend/cli.rb, line 55 def self.strategy @strategy ||= detect_strategy end
strategy_available?()
click to toggle source
# File lib/multi_zip/backend/cli.rb, line 51 def self.strategy_available? !!strategy end