add support for subdirectory deneration

This commit is contained in:
John Bintz 2010-03-23 21:24:27 -04:00
parent e69c9dcd9a
commit ef5fba806f
6 changed files with 18 additions and 5 deletions

2
.gitignore vendored
View File

@ -3,3 +3,5 @@
.project
.DS_Store
coverage/
minicomic-backend

View File

@ -4,6 +4,6 @@ test :
testrb `find tests -name '*.rb'`
test-coverage :
rcov -x '\/jruby\/lib\/' -x '\/tests\/data\/' `find tests -name '*.rb'`
rcov -x '\/.rvm\/' -x '\/tests\/data\/' `find tests -name '*.rb'`
sed 's#<td class="left_align"><a href="<script>.html"><script></a></td>#<td></td>#' coverage/index.html > coverage/index.html.new
mv coverage/index.html.new coverage/index.html

View File

@ -1,5 +1,6 @@
require File.dirname(__FILE__) + '/OutputFilter.rb'
require File.dirname(__FILE__) + '/../modules/ImageProcessing.rb'
require 'fileutils'
#
# Process an input file for the Web
@ -8,12 +9,23 @@ class TempBitmapToWeb < OutputFilter
include ImageProcessing
def build(input, output)
FileUtils.mkdir_p(File.split(output).first)
quality = @config['quality'] ? @config['quality'] : 80
convert("\"#{input}\" -quality #{quality} \"#{output}\"")
end
def filename(info)
info['date'] = @config['publish_dates'][info['index'].to_i - 1].strftime(@config['date_format'])
info['subdir'] = ''
if @config['subdirs']
@config['subdirs'].each do |dir, subdir_info|
if Range.new(subdir_info['from'].to_i, subdir_info['to'].to_i).include? info['index'].to_i
info['subdir'] = dir + File::SEPARATOR
break
end
end
end
super(info)
end
end

View File

@ -3,10 +3,9 @@
require 'yaml'
require 'time'
THIS_FILE = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
THIS_FILE = File.symlink?(__FILE__) ? File.expand_path(File.readlink(__FILE__)) : File.expand_path(__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

View File

@ -1,7 +1,7 @@
require 'rubygems'
require 'test/unit'
require 'fakefs/safe'
Dir[File.dirname(__FILE__) + '/../classes/*'].each do |f|
Dir[File.dirname(__FILE__) + '/../classes/*.rb'].each do |f|
require f
end