Class: Gemvault::CLI::Destination

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/gemvault/cli/destination.rb

Overview

A VaultDestination as the CLI presents it: the same operations, with the directories they grow narrated on stdout so nothing appears on disk unannounced. What the destination refuses still surfaces as VaultDestination::Error for the command to report.

Instance Method Summary collapse

Constructor Details

#initialize(destination, stdout:) ⇒ Destination

Returns a new instance of Destination.



15
16
17
18
# File 'lib/gemvault/cli/destination.rb', line 15

def initialize(destination, stdout:)
  @destination = destination
  @stdout = stdout
end

Instance Method Details

#create_parentsObject

Creates the destination's missing parent directories, reporting the shallowest one created so the user learns where the tree grew.



22
23
24
25
26
# File 'lib/gemvault/cli/destination.rb', line 22

def create_parents
  missing = @destination.missing_directory
  @destination.create_parents
  @stdout.puts "Created directory #{missing}" if missing
end