Module: Woody::Generator
- Defined in:
- lib/woody/generator.rb
Overview
Handles functions related to generating Woody sites and updating them and their data stores
Class Method Summary collapse
-
.new_site(name) ⇒ Object
Generates a blank skeleton Woody site Do not call Woody::init before this!.
-
.update_templates ⇒ Object
Replaces the templates in the Woody site with the gem’s current default ones.
Class Method Details
.new_site(name) ⇒ Object
Generates a blank skeleton Woody site Do not call Woody::init before this!
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/woody/generator.rb', line 7 def self.new_site(name) puts "Creating new site '#{name}'..." if File.directory?(name) puts "Error: directory '#{name}' already exists!" return false end cdir_p(name) cpy_t("woody-config.yml", "#{name}/woody-config.yml") cdir_p("#{name}/templates") cpy_t("layout.html", "#{name}/templates/layout.html") cpy_t("index.html", "#{name}/templates/index.html") cpy_t("episode.html", "#{name}/templates/episode.html") cdir_p("#{name}/templates/assets") cpy_t("stylesheet.css", "#{name}/templates/assets/stylesheet.css") cdir_p("#{name}/content") cpy_t("metadata.yml", "#{name}/content/metadata.yml") cpy_t("iTunes.png", "#{name}/content/iTunes.png") cdir_p("#{name}/output") cdir_p("#{name}/output/assets") cdir_p("#{name}/output/assets/mp3") cdir_p("#{name}/output/episode") puts "Done!" puts "Now, do `cd #{name}` then edit the config file, woody-config.yml." end |
.update_templates ⇒ Object
Replaces the templates in the Woody site with the gem’s current default ones
39 40 41 42 43 44 45 46 |
# File 'lib/woody/generator.rb', line 39 def self.update_templates puts "Updating templates..." cpy_t("layout.html", "templates/layout.html") cpy_t("index.html", "templates/index.html") cpy_t("episode.html", "templates/episode.html") cpy_t("stylesheet.css", "templates/assets/stylesheet.css") puts "Done! Thanks for updating :)" end |