Class: Snipcheat::Task

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/snipcheat/task.rb

Instance Method Summary collapse

Instance Method Details

#generateObject



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/snipcheat/task.rb', line 12

def generate
  vsay "Looking for snippets in #{options[:dir]}"
  snippet_dir = SnippetDir.new(options[:dir])
  if snippet_dir.empty?
    say "No snippets found in #{options[:dir]}"
    return
  else
    vsay "Found: #{snippet_dir.filenames.join(', ')}"
    out = options[:out] || 'cheatsheet.html'
    vsay "Writing to #{out}..."
    Output.new(snippet_dir.snippets, out).write
  end
end