19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/jeny/command.rb', line 19
def call(argv)
args = parse_argv!(argv, load_config!)
case command = args.first
when "g", "generate"
_, from, to = args
from, to = Path(from), Path(to)
raise Error, "No such template `#{from}`" unless from.directory?
to.mkdir_p
Generate.new(@config, jeny_data, from, to).call
when "s", "snippets"
_, asset, *source = args
raise Error, "Asset must be specified" if asset.nil? or Path(asset).exist?
source = [Path.pwd] if source.empty?
from = source.map{|t| Path(t) }
Snippets.new(@config, jeny_data, asset, from).call
else
raise Error, "Unknown command `#{command}`"
end
end
|