lib/softcover/commands/generator.rb in softcover-0.6.10 vs lib/softcover/commands/generator.rb in softcover-0.7.0

- old
+ new

@@ -7,11 +7,10 @@ # Generates the default book file tree. def generate_file_tree(name, options = {}) @name = name @markdown = !options[:polytex] - @simple = options[:simple] thor = Thor::Shell::Basic.new puts "Generating directory: #{name}" @@ -23,12 +22,10 @@ # Create the directories. # There was some trouble with MathJax where it was trying to copy a # file before the directory had been created, so we now create all # the directories first. directories.each do |path| - next if path =~ /\/simple_book/ && !@simple - next if path =~ /\/book/ && @simple (cp_path = path.dup).slice! template_dir + "/" unless File.exist?(cp_path) puts "Creating #{cp_path}" unless cp_path =~ /MathJax/ FileUtils.mkdir cp_path end @@ -85,30 +82,23 @@ def template_dir File.expand_path File.join File.dirname(__FILE__), "../template" end - # Returns true for a simple book (no frontmatter, etc.). - def simple? - @simple - end - # Returns a list of all the files and directories used to build the book. def all_files_and_directories - f = files_directories_maybe_markdown - simple? ? f.reject { |p| p =~ /\/book\.tex/ || p =~ /preface/ } - : f.reject { |p| p =~ /simple/ } + 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) if markdown? # Skip the PolyTeX chapter files, which will be generated later. fds.reject { |e| e =~ /\/chapters\/.*\.tex/ } else - # Skip the Markdown files & Book.txt. - fds.reject { |e| e =~ /(chapters\/.*\.md|Book\.txt)/ } + # Skip the Markdown files. + fds.reject { |e| e =~ /chapters\/.*\.md/ } end end # Returns just the directories used for building the book. def directories