Class: Gemvault::CLI::Commands::New

Inherits:
Gemvault::CLI::Command show all
Defined in:
lib/gemvault/cli/commands/new.rb

Overview

Creates a new, empty vault file.

Instance Method Summary collapse

Instance Method Details

#run(name) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/gemvault/cli/commands/new.rb', line 16

def run(name)
  begin
    destination = build_destination(name)
    destination.refuse_existing
    destination.create_parents
    Vault.create(destination.path)
    puts "Created #{destination.path}"
  rescue VaultDestination::Error, Vault::Error, SystemCallError => e
    print_error(e.message)
    exit(1)
  end
end