Commit b9d9fc44 by Jon Yurek

Automatic initialization for Rails 2 and Rails 3

parent aa93daec
...@@ -37,6 +37,7 @@ require 'paperclip/interpolations' ...@@ -37,6 +37,7 @@ require 'paperclip/interpolations'
require 'paperclip/style' require 'paperclip/style'
require 'paperclip/attachment' require 'paperclip/attachment'
require 'paperclip/callback_compatability' require 'paperclip/callback_compatability'
require 'paperclip/railtie'
if defined?(Rails.root) && Rails.root if defined?(Rails.root) && Rails.root
Dir.glob(File.join(File.expand_path(Rails.root), "lib", "paperclip_processors", "*.rb")).each do |processor| Dir.glob(File.join(File.expand_path(Rails.root), "lib", "paperclip_processors", "*.rb")).each do |processor|
require processor require processor
...@@ -47,7 +48,7 @@ end ...@@ -47,7 +48,7 @@ end
# documentation for Paperclip::ClassMethods for more useful information. # documentation for Paperclip::ClassMethods for more useful information.
module Paperclip module Paperclip
VERSION = "2.3.2" VERSION = "2.3.2.beta1"
class << self class << self
# Provides configurability to Paperclip. There are a number of options available, such as: # Provides configurability to Paperclip. There are a number of options available, such as:
...@@ -71,8 +72,6 @@ module Paperclip ...@@ -71,8 +72,6 @@ module Paperclip
end end
def configure def configure
ActiveRecord::Base.send(:include, Paperclip)
File.send(:include, Paperclip::Upfile)
yield(self) if block_given? yield(self) if block_given?
end end
......
require 'paperclip'
module Paperclip
if defined? Rails::Railtie
require 'rails'
class Railtie < Rails::Railtie
config.after_initialize do
Paperclip::Railtie.insert
end
end
end
class Railtie
def self.insert
ActiveRecord::Base.send(:include, Paperclip)
File.send(:include, Paperclip::Upfile)
end
end
end
$LOAD_PATH << File.join(File.dirname(__FILE__), 'lib') $LOAD_PATH << File.join(File.dirname(__FILE__), 'lib')
require 'paperclip' require 'paperclip'
include_files = ["README*", "LICENSE", "Rakefile", "init.rb", "{generators,lib,tasks,test,shoulda_macros}/**/*"].map do |glob| include_files = ["README*", "LICENSE", "Rakefile", "init.rb", "{lib,tasks,test,rails,generators,shoulda_macros}/**/*"].map do |glob|
Dir[glob] Dir[glob]
end.flatten end.flatten
exclude_files = ["test/s3.yml", "test/debug.log", "test/paperclip.db", "test/doc", "test/doc/*", "test/pkg", "test/pkg/*", "test/tmp", "test/tmp/*"].map do |glob| exclude_files = ["test/s3.yml", "test/debug.log", "test/paperclip.db", "test/doc", "test/doc/*", "test/pkg", "test/pkg/*", "test/tmp", "test/tmp/*"].map do |glob|
......
require 'paperclip/railtie'
Paperclip::Railtie.insert
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment