Module: Woody::Generator
- Included in:
- Woody
- 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(site) ⇒ 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 37 |
# 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("post.html", "#{name}/templates/post.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}/content/posts") cdir_p("#{name}/output") cdir_p("#{name}/output/assets") cdir_p("#{name}/output/assets/mp3") cdir_p("#{name}/output/post") puts "Done!" puts "Now, do `cd #{name}` then edit the config file, woody-config.yml." end |
.update_templates(site) ⇒ Object
Replaces the templates in the Woody site with the gem’s current default ones
40 41 42 43 44 45 46 47 |
# File 'lib/woody/generator.rb', line 40 def self.update_templates(site) puts "Updating templates..." cpy_t("layout.html", site.dir("templates/layout.html")) cpy_t("index.html", site.dir("templates/index.html")) cpy_t("post.html", site.dir("templates/post.html")) cpy_t("stylesheet.css", site.dir("templates/assets/stylesheet.css")) puts "Done! Thanks for updating :)" end |