Class: Omnizip::Commands::ArchiveCreateCommand
- Inherits:
-
Object
- Object
- Omnizip::Commands::ArchiveCreateCommand
- Defined in:
- lib/omnizip/commands/archive_create_command.rb
Overview
Command to create .7z archives from files and directories.
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ ArchiveCreateCommand
constructor
Initialize archive create command with options.
-
#run(output_file, *inputs) ⇒ void
Execute the archive create command.
Constructor Details
#initialize(options = {}) ⇒ ArchiveCreateCommand
Initialize archive create command with options.
28 29 30 |
# File 'lib/omnizip/commands/archive_create_command.rb', line 28 def initialize( = {}) @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
23 24 25 |
# File 'lib/omnizip/commands/archive_create_command.rb', line 23 def @options end |
Instance Method Details
#run(output_file, *inputs) ⇒ void
This method returns an undefined value.
Execute the archive create command.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/omnizip/commands/archive_create_command.rb', line 37 def run(output_file, *inputs) validate_inputs(output_file, inputs) # Apply profile settings if specified opts = .dup if opts[:profile] first_file = find_first_file(inputs) opts = apply_profile(first_file, opts) end # Determine format from extension or --format option format = opts[:format] || detect_format(output_file) if format == "rar" create_rar_archive(output_file, inputs, opts) else create_7z_archive(output_file, inputs, opts) end end |