Sha256: c57fad0b74ce5f0cc3591b729600cc5d2bb898c1ac7f1b4cb18d516fc518fe99
Contents?: true
Size: 1.36 KB
Versions: 3
Compression:
Stored size: 1.36 KB
Contents
require 'pry' module CourseGen class Templates < Thor::Group include Thor::Actions def generate_all copy_template_dir("layouts", "layouts") copy_template_dir("content/bootstrap", "content/bootstrap") copy_template_dir("content/content", "content/content") delete_target_file("lib/default.rb") copy_template_dir("lib", "lib") delete_target_file("Rules") copy_template_file("Rules", "Rules") copy_template_file("cg_config.rb", "cg_config.rb") copy_template_file("cg_config.rb_sample", "cg_config.rb_sample") delete_target_file("content/stylesheet.css") delete_target_file("content/index.html") end def valid_cg_directory? valid = true list = ["Rules", "nanoc.yaml", "content", "lib"] list.each do |filename| if !File.exists?(filename) valid = false say("Required file not found: #{filename}") end end valid end def self.source_root Pathname.new(File.dirname(__FILE__)).parent.parent.to_s end def initialize super destination_root = Dir.getwd end def copy_template_dir from, to directory("templates/#{from}", "#{to}") end def copy_template_file from, to template("templates/#{from}", "#{to}") end def delete_target_file(to) remove_file(to) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
coursegen-0.0.4 | lib/coursegen/templates.rb |
coursegen-0.0.3 | lib/coursegen/templates.rb |
coursegen-0.0.2 | lib/coursegen/templates.rb |