Class: Rodolfo::Generator

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/rodolfo/cli.rb

Overview

Rodolfo recipe generator

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



15
16
17
# File 'lib/rodolfo/cli.rb', line 15

def self.source_root
  File.join __dir__, 'templates'
end

Instance Method Details

#fiveObject



36
37
38
39
40
41
# File 'lib/rodolfo/cli.rb', line 36

def five
  puts
  puts 'Recipe ready! Try it with:'
  puts "cat #{folder}/data.json | rodolfo render #{folder}" \
       " --save-to #{folder}.pdf"
end

#fourObject



32
33
34
# File 'lib/rodolfo/cli.rb', line 32

def four
  copy_file('data.tt', "#{folder}/data.json")
end

#oneObject



19
20
21
22
# File 'lib/rodolfo/cli.rb', line 19

def one
  puts Generator.source_root
  empty_directory(folder)
end

#threeObject



28
29
30
# File 'lib/rodolfo/cli.rb', line 28

def three
  template('template.tt', "#{folder}/template.rb")
end

#twoObject



24
25
26
# File 'lib/rodolfo/cli.rb', line 24

def two
  template('schema.tt', "#{folder}/schema.json")
end