Class: Verku::Generator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



4
5
6
# File 'lib/verku/generator.rb', line 4

def self.source_root
  File.dirname(__FILE__) + "/../../templates"
end

Instance Method Details

#build_config_fileObject



7
8
9
10
11
12
13
14
15
# File 'lib/verku/generator.rb', line 7

def build_config_file
  # require "uuidtools"
  @title = File.basename(destination_root).gsub('-', ' ')
  @name = full_name
  @uuid = SecureRandom.uuid
  @year = Date.today.year
  template "config.erb", "_verku.yml"
  template "readme.erb", "README.md"
end

#copy_sample_textObject

copy_file “build.yml”, “_build.yml”



39
40
41
# File 'lib/verku/generator.rb', line 39

def copy_sample_text
  directory "text", "text"
end

#copy_templatesObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/verku/generator.rb', line 16

def copy_templates
  copy_file "pdf/layout.erb",         "_templates/pdf/layout.erb"
  copy_file "merovex-logo.png",       "_images/logo.png"
  
  copy_file "html/layout.erb",        "_templates/html/layout.erb"
  copy_file "html/thanks.erb",        "_templates/html/thanks.erb"
  copy_file "html/copyright.erb",     "_templates/html/copyright.erb"
  copy_file "html/user.css",          "_templates/html/user.css"
  copy_file "html/layout.css",        "_templates/html/layout.css"
  copy_file "html/syntax.css",        "_templates/html/syntax.css"

  copy_file "epub/back.erb",          "_templates/epub/back.html"
  copy_file "epub/copyright.erb",     "_templates/epub/copyright.erb"
  copy_file "epub/cover.erb",         "_templates/epub/cover.erb"
  copy_file "epub/cover.html",        "_templates/epub/cover.html"
  copy_file "epub/page.erb",          "_templates/epub/page.erb"
  copy_file "epub/user.css",          "_templates/epub/user.css"

  copy_file "cover.jpg",              "_images/cover.jpg"
  copy_file "rakefile.rb",            "Rakefile"
  copy_file "extras.tex",             "_extras/dedications.tex"
  # copy_file "build.yml",              "_build.yml"
end

#create_directoriesObject



42
43
44
45
46
47
# File 'lib/verku/generator.rb', line 42

def create_directories
  empty_directory "builds"
  empty_directory "docs"
  empty_directory "docs/characters"
  empty_directory "_images"
end