]> projects.mako.cc - selectricity/blob - vendor/plugins/attachment_fu/init.rb
merged in from code from the other master
[selectricity] / vendor / plugins / attachment_fu / init.rb
1 require 'tempfile'
2
3 Tempfile.class_eval do
4   # overwrite so tempfiles use the extension of the basename.  important for rmagick and image science
5   def make_tmpname(basename, n)
6     ext = nil
7     sprintf("%s%d-%d%s", basename.to_s.gsub(/\.\w+$/) { |s| ext = s; '' }, $$, n, ext)
8   end
9 end
10
11 require 'geometry'
12 ActiveRecord::Base.send(:extend, Technoweenie::AttachmentFu::ActMethods)
13 Technoweenie::AttachmentFu.tempfile_path = ATTACHMENT_FU_TEMPFILE_PATH if Object.const_defined?(:ATTACHMENT_FU_TEMPFILE_PATH)
14 FileUtils.mkdir_p Technoweenie::AttachmentFu.tempfile_path
15
16 $:.unshift(File.dirname(__FILE__) + '/vendor')

Benjamin Mako Hill || Want to submit a patch?