diff --git a/classes/ConfigLoader.rb b/classes/ConfigLoader.rb index afc8938..2c951c5 100644 --- a/classes/ConfigLoader.rb +++ b/classes/ConfigLoader.rb @@ -50,7 +50,7 @@ class ConfigLoader if global['match'] re = Regexp.new(global['match']) - files = Dir[global['path']].sort.collect do |filename| + files = Dir[global['path'] + '/*'].sort.collect do |filename| if matches = re.match(filename) filename end diff --git a/classes/FileProcessor.rb b/classes/FileProcessor.rb index 8491038..d11eeb6 100644 --- a/classes/FileProcessor.rb +++ b/classes/FileProcessor.rb @@ -7,11 +7,8 @@ class FileProcessor @paginated_source_files = {} end - def process - rsync_files_by_target = {} - - files.each do |filename| + @config['Global']['files'].each do |filename| ok, fileinfo, filename = verify_filename(filename) if ok @@ -23,7 +20,7 @@ class FileProcessor if type != "Global" fileinfo_key = (filename.instance_of? Array) ? filename.join(",") : filename - file_fileinfo = (fileinfo_by_file[fileinfo_key]) ? fileinfo_by_file[fileinfo_key] : {} + file_fileinfo = (@config['Global']['fileinfo_by_file'][fileinfo_key]) ? @config['Global']['fileinfo_by_file'][fileinfo_key] : {} file_fileinfo = info.dup.merge(fileinfo).merge(file_fileinfo) @@ -36,11 +33,11 @@ class FileProcessor puts " Using #{filename} as a source" puts " and writing to #{targets.inspect}" - do_build(targets, filename) + do_build(targets, filename, input_obj, output_obj) end if info['is_paginated'] - if !paginated_source_files[type]; paginated_source_files[type] = []; end - paginated_source_files[type] << targets + if !@paginated_source_files[type]; @paginated_source_files[type] = []; end + @paginated_source_files[type] << targets end end end @@ -58,10 +55,6 @@ class FileProcessor output_obj.paginate(paginated_source_files[type].flatten) end - - if info['rsync'] - system("echo '#{rsync_files_by_target[info['rsync']].join("\n")}' | rsync -vru --files-from=- . #{info['rsync']}") - end end end diff --git a/classes/SVGToTempBitmap.rb b/classes/SVGToTempBitmap.rb index 71f7fc8..da2432f 100644 --- a/classes/SVGToTempBitmap.rb +++ b/classes/SVGToTempBitmap.rb @@ -1,8 +1,9 @@ require File.dirname(__FILE__) + '/../modules/PrintHandling.rb' +require File.dirname(__FILE__) + '/../modules/ImageProcessing.rb' require File.dirname(__FILE__) + '/InputFilter.rb' class SVGToTempBitmap < InputFilter - include PrintHandling + include PrintHandling, ImageProcessing # # select which build method to use based on the number of provided images. @@ -16,7 +17,7 @@ class SVGToTempBitmap < InputFilter # def single(input) filename = Dir.pwd + '/' + @output_filename - inkscape(input, filename) + inkscape(Dir.pwd + '/' + input, filename) @cleanup << filename if @config['spread'] diff --git a/classes/TempBitmapToWeb.rb b/classes/TempBitmapToWeb.rb index 23be090..dc2dc84 100644 --- a/classes/TempBitmapToWeb.rb +++ b/classes/TempBitmapToWeb.rb @@ -4,17 +4,6 @@ require File.dirname(__FILE__) + '/OutputFilter.rb' # Process an input file for the Web # class TempBitmapToWeb < OutputFilter - attr_accessor :schedule - - def initialize - super - @schedule = nil - end - - def requires_schedule(schedule) - @schedule = schedule - end - def build(input, output) quality = @config['quality'] ? @config['quality'] : 80 convert("\"#{input}\" -quality #{quality} \"#{output}\"") @@ -22,7 +11,8 @@ class TempBitmapToWeb < OutputFilter def filename(info) index = info['index'].to_i - info['date'] = @schedule[index].strftime(@config['date_format']) + + info['date'] = @config['publish_dates'][index].strftime(@config['date_format']) super(info) end end diff --git a/minicomic-backend.rb b/minicomic-backend.rb index f11fc3c..37478c0 100755 --- a/minicomic-backend.rb +++ b/minicomic-backend.rb @@ -3,12 +3,14 @@ require 'yaml' require 'time' -Dir[File.dirname(__FILE__) + "/classes/*.rb"].each do |file| - require file -end +THIS_FILE = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__ -any_rebuilt = false -any_rsync = false +%w(classes modules).each do |which| + p File.dirname(THIS_FILE) + "/#{which}/*.rb" + Dir[File.dirname(THIS_FILE) + "/#{which}/*.rb"].each do |file| + require file + end +end if !ARGV[0] puts "Usage: #{File.basename(__FILE__)} " @@ -20,7 +22,8 @@ if !File.exists?(ARGV[0]) exit 1 end -if global['use_git'] - system("git add .") - system("git commit -a") -end +config_loader = ConfigLoader.new +config = config_loader.load(ARGV[0]) + +file_processor = FileProcessor.new(config) +file_processor.process