lib/softcover/commands/generator.rb in softcover-1.0.5 vs lib/softcover/commands/generator.rb in softcover-1.1.beta1

- old
+ new

@@ -7,10 +7,12 @@ # Generates the default book file tree. def generate_file_tree(name, options = {}) @name = name @markdown = !options[:polytex] + @article = options[:article] + template_dir = Softcover::Utils.template_dir(article: @article) thor = Thor::Shell::Basic.new puts "Generating directory: #{name}" @@ -79,22 +81,20 @@ Dir.chdir "../.." book_yml = File.join(Softcover::Directories::CONFIG, 'book.yml') puts "Done. Please update #{book_yml}" end - - def template_dir - File.expand_path File.join File.dirname(__FILE__), "..", "template" - end - + # Returns a list of all the files and directories used to build the book. def all_files_and_directories files_directories_maybe_markdown end # Returns the files and directories based on the input format. def files_directories_maybe_markdown - fds = Dir.glob(File.join(template_dir, "**/*"), File::FNM_DOTMATCH) + fds = Dir.glob( + File.join(Softcover::Utils.template_dir(article: @article), + "**/*"), File::FNM_DOTMATCH) if markdown? # Skip the PolyTeX chapter files, which will be generated later. fds.reject { |e| e =~ /\/chapters\/.*\.tex/ } else # Skip the Markdown files.