working on making this actually work
This commit is contained in:
parent
d256b50516
commit
846920e7c2
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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']
|
||||
|
@ -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
|
||||
|
@ -3,12 +3,14 @@
|
||||
require 'yaml'
|
||||
require 'time'
|
||||
|
||||
Dir[File.dirname(__FILE__) + "/classes/*.rb"].each do |file|
|
||||
THIS_FILE = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
|
||||
|
||||
%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
|
||||
|
||||
any_rebuilt = false
|
||||
any_rsync = false
|
||||
end
|
||||
|
||||
if !ARGV[0]
|
||||
puts "Usage: #{File.basename(__FILE__)} <path to YAML 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
|
||||
|
Loading…
Reference in New Issue
Block a user