Class: Fixi::Command::Init

Inherits:
Object
  • Object
show all
Defined in:
lib/fixi/command/init.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.arghelpObject



9
10
11
# File 'lib/fixi/command/init.rb', line 9

def self.arghelp
  "[path]"
end

.detailsObject



13
14
15
16
# File 'lib/fixi/command/init.rb', line 13

def self.details
  "This command is scoped to the current directory or the given path,
    if specified.".pack
end

.synopsisObject



5
6
7
# File 'lib/fixi/command/init.rb', line 5

def self.synopsis
  "Create a new, empty index"
end

Instance Method Details

#execute(args) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/fixi/command/init.rb', line 18

def execute args
  opts = Trollop::options args do
    banner Fixi::Command::banner "init"
    opt :algorithms, "Checksum algorithm(s) to use for the index. This is
      a comma-separated list, which may include md5, sha1, sha256, sha384, and
      sha512.".pack, :default => "sha256", :short => 'l'
  end
  index = Fixi::Index.new(args[0], true, opts[:algorithms])
  puts "Initialized empty index at #{index.dotpath}"
end