Class: Bookmaker::Generator
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Bookmaker::Generator
- Includes:
- Thor::Actions
- Defined in:
- lib/bookmaker/generator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #build_config_file ⇒ Object
- #copy_sample_text ⇒ Object
- #copy_templates ⇒ Object
- #create_directories ⇒ Object
Class Method Details
.source_root ⇒ Object
4 5 6 |
# File 'lib/bookmaker/generator.rb', line 4 def self.source_root File.dirname(__FILE__) + "/../../templates" end |
Instance Method Details
#build_config_file ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/bookmaker/generator.rb', line 7 def build_config_file @title = File.basename(destination_root).gsub('-', ' ') @name = full_name @uid = Digest::MD5.hexdigest("#{Time.now}--#{rand}") @year = Date.today.year template "config.erb", "_bookmaker.yml" end |
#copy_sample_text ⇒ Object
28 29 30 |
# File 'lib/bookmaker/generator.rb', line 28 def copy_sample_text copy_file "sample.tex" , "text/01_First-Chapter/01-Welcome.tex" end |
#copy_templates ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/bookmaker/generator.rb', line 14 def copy_templates copy_file "latex.erb", "templates/pdf/layout.erb" copy_file "dp-logo.png", "images/dp-logo.png" copy_file "html.erb", "templates/html/layout.erb" copy_file "user.css", "templates/html/user.css" copy_file "layout.css", "templates/html/layout.css" copy_file "syntax.css", "templates/html/syntax.css" copy_file "cover.html", "templates/epub/cover.html" copy_file "epub.erb", "templates/epub/page.erb" copy_file "epub.css", "templates/epub/user.css" copy_file "cover.jpg", "images/cover.jpg" end |
#create_directories ⇒ Object
31 32 33 34 |
# File 'lib/bookmaker/generator.rb', line 31 def create_directories empty_directory "output" empty_directory "images" end |