diff --git a/.gitignore b/.gitignore
index cf17e31..d3a31bb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,5 @@
.project
.DS_Store
coverage/
+minicomic-backend
+
diff --git a/Makefile b/Makefile
index 3d80368..9fda3b6 100644
--- a/Makefile
+++ b/Makefile
@@ -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#
| # | #' coverage/index.html > coverage/index.html.new
mv coverage/index.html.new coverage/index.html
diff --git a/classes/ConfigLoader.rb b/classes/ConfigLoader.rb
index f2f5140..77e378d 100644
--- a/classes/ConfigLoader.rb
+++ b/classes/ConfigLoader.rb
@@ -68,7 +68,7 @@ class ConfigLoader
if type != "Global"
if info['schedule']
info['publish_dates'] = scheduler.schedule(info['schedule'], files.length)
- end
+ end
end
end
diff --git a/classes/TempBitmapToWeb.rb b/classes/TempBitmapToWeb.rb
index 7df2b43..85e4c77 100644
--- a/classes/TempBitmapToWeb.rb
+++ b/classes/TempBitmapToWeb.rb
@@ -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
diff --git a/minicomic-backend.rb b/minicomic-backend.rb
index 37478c0..d0e68f9 100755
--- a/minicomic-backend.rb
+++ b/minicomic-backend.rb
@@ -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
diff --git a/tests/TestFileProcessor.rb b/tests/TestFileProcessor.rb
index 6fe1595..fdab3a0 100644
--- a/tests/TestFileProcessor.rb
+++ b/tests/TestFileProcessor.rb
@@ -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