Skip to content

Commit

Permalink
Small fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
daronco committed Jun 17, 2011
1 parent 4bac14a commit d060063
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
2 changes: 0 additions & 2 deletions attachment_fu.gemspec
@@ -1,4 +1,3 @@
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{attachment_fu}
s.version = "1.0.0"
Expand All @@ -8,7 +7,6 @@ Gem::Specification.new do |s|
s.date = %q{2011-06-09}
s.description = %q{Adds has_attachment (file store) properties to ActiveRecord. Supports local file, file-in-db, S3 and Cloudfiles backends.}
s.files = ["README", "init.rb", "CHANGELOG"] + Dir["lib/**/*.rb"] + Dir["vendor/**/*.rb"]
s.has_rdoc = false
s.homepage = %q{http://github.com/zendesk/attachment_fu}
s.require_paths = ["lib", "vendor"]
s.rubygems_version = %q{1.3.1}
Expand Down
21 changes: 10 additions & 11 deletions lib/attachment_fu.rb
@@ -1,22 +1,21 @@
require 'tempfile'
require 'active_record'
require 'active_support/dependencies'

Tempfile.class_eval do
# overwrite so tempfiles use the extension of the basename. important for rmagick and image science
def make_tmpname(basename, n)
ext = nil
sprintf("%s%d-%d%s", basename.to_s.gsub(/\.\w+$/) { |s| ext = s; '' }, $$, n, ext)
end
end

require 'geometry'

require 'technoweenie/attachment_fu'

#if RUBY_VERSION < '1.9'
Tempfile.class_eval do
# overwrite so tempfiles use the extension of the basename. important for rmagick and image science
def make_tmpname(basename, n)
ext = nil
sprintf("%s%d-%d%s", basename.to_s.gsub(/\.\w+$/) { |s| ext = s; '' }, $$, n.to_i, ext)
end
end
#end

ActiveSupport::Dependencies.autoload_paths << File.dirname(__FILE__)

ActiveRecord::Base.send(:extend, Technoweenie::AttachmentFu::ActMethods)
Technoweenie::AttachmentFu.tempfile_path = ATTACHMENT_FU_TEMPFILE_PATH if Object.const_defined?(:ATTACHMENT_FU_TEMPFILE_PATH)
FileUtils.mkdir_p Technoweenie::AttachmentFu.tempfile_path
FileUtils.mkdir_p Technoweenie::AttachmentFu.tempfile_path

0 comments on commit d060063

Please sign in to comment.