Permalink
Browse files

Merge branch 'master' of git://github.com/thoughtbot/paperclip

  • Loading branch information...
tilsammans committed Jan 14, 2011
2 parents 289d9cf + e23d7f5 commit 1b8bb3c3d223f2f3c332cf0fb5f8c30acc5ca1b8
Showing with 450 additions and 166 deletions.
  1. +3 −0 .gitignore
  2. +8 −0 Appraisals
  3. +8 −0 Gemfile
  4. +37 −0 Gemfile.lock
  5. +7 −1 README.rdoc
  6. +6 −2 Rakefile
  7. +11 −0 gemfiles/rails2.gemfile
  8. +56 −0 gemfiles/rails2.gemfile.lock
  9. +11 −0 gemfiles/rails3.gemfile
  10. +97 −0 gemfiles/rails3.gemfile.lock
  11. +18 −9 lib/paperclip.rb
  12. +15 −9 lib/paperclip/attachment.rb
  13. +1 −1 lib/paperclip/command_line.rb
  14. +2 −1 lib/paperclip/interpolations.rb
  15. +10 −24 lib/paperclip/iostream.rb
  16. +13 −4 lib/paperclip/processor.rb
  17. +1 −1 lib/paperclip/railtie.rb
  18. +2 −0 lib/paperclip/storage.rb
  19. +1 −0 lib/paperclip/storage/filesystem.rb
  20. +12 −1 lib/paperclip/storage/s3.rb
  21. +1 −1 lib/paperclip/thumbnail.rb
  22. +0 −5 lib/paperclip/upfile.rb
  23. +1 −1 lib/paperclip/version.rb
  24. +36 −43 lib/tasks/paperclip.rake
  25. +1 −0 paperclip.gemspec
  26. +8 −8 test/attachment_test.rb
  27. +16 −11 test/command_line_test.rb
  28. +1 −1 test/geometry_test.rb
  29. +5 −17 test/helper.rb
  30. +1 −1 test/integration_test.rb
  31. +1 −1 test/interpolations_test.rb
  32. +6 −13 test/iostream_test.rb
  33. +1 −1 test/matchers/have_attached_file_matcher_test.rb
  34. +1 −1 test/matchers/validate_attachment_content_type_matcher_test.rb
  35. +1 −1 test/matchers/validate_attachment_presence_matcher_test.rb
  36. +1 −1 test/matchers/validate_attachment_size_matcher_test.rb
  37. +24 −1 test/paperclip_test.rb
  38. +1 −1 test/processor_test.rb
  39. +21 −1 test/storage_test.rb
  40. +1 −1 test/style_test.rb
  41. +2 −2 test/thumbnail_test.rb
  42. +1 −1 test/upfile_test.rb
View
@@ -5,3 +5,6 @@ test/s3.yml
public
paperclip*.gem
capybara*.html
+*.rbc
+.bundle
+*SPIKE*
View
@@ -0,0 +1,8 @@
+appraise "rails2" do
+ gem "rails", "~>2.3.0"
+end
+
+appraise "rails3" do
+ gem "rails", "~>3.0.0"
+end
+
View
@@ -0,0 +1,8 @@
+source "http://rubygems.org"
+gem "shoulda"
+gem "mocha"
+gem "rake"
+gem "ruby-debug"
+gem "aws-s3", :require => "aws/s3"
+gem "sqlite3-ruby", "~>1.3.0"
+gem "appraisal"
View
@@ -0,0 +1,37 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ appraisal (0.1)
+ bundler
+ rake
+ aws-s3 (0.6.2)
+ builder
+ mime-types
+ xml-simple
+ builder (3.0.0)
+ columnize (0.3.2)
+ linecache (0.43)
+ mime-types (1.16)
+ mocha (0.9.9)
+ rake
+ rake (0.8.7)
+ ruby-debug (0.10.4)
+ columnize (>= 0.1)
+ ruby-debug-base (~> 0.10.4.0)
+ ruby-debug-base (0.10.4)
+ linecache (>= 0.3)
+ shoulda (2.11.3)
+ sqlite3-ruby (1.3.2)
+ xml-simple (1.0.12)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ appraisal
+ aws-s3
+ mocha
+ rake
+ ruby-debug
+ shoulda
+ sqlite3-ruby (~> 1.3.0)
View
@@ -15,7 +15,13 @@ useful defaults.
See the documentation for +has_attached_file+ in Paperclip::ClassMethods for
more detailed options.
-The complete RDoc[http://rdoc.info/projects/thoughtbot/paperclip] is online.
+The complete RDoc[http://rdoc.info/gems/paperclip] is online.
+
+==Installation
+
+Include the gem in your Gemfile:
+
+ gem "paperclip", "~> 2.3"
==Installation
View
@@ -1,3 +1,7 @@
+require 'rubygems'
+require 'appraisal'
+require 'bundler/setup'
+
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
@@ -6,11 +10,11 @@ $LOAD_PATH << File.join(File.dirname(__FILE__), 'lib')
require 'paperclip'
desc 'Default: run unit tests.'
-task :default => [:clean, :test]
+task :default => [:clean, :all]
desc 'Test the paperclip plugin under all supported Rails versions.'
task :all do |t|
- exec('rake RAILS_VERSION=2.1 && rake RAILS_VERSION=2.3 && rake RAILS_VERSION=3.0')
+ exec('rake appraisal test')
end
desc 'Test the paperclip plugin.'
View
@@ -0,0 +1,11 @@
+# This file was generated by Appraisal
+
+source "http://rubygems.org"
+gem "ruby-debug"
+gem "rails", "~>2.3.0"
+gem "rake"
+gem "sqlite3-ruby", "~>1.3.0"
+gem "shoulda"
+gem "mocha"
+gem "aws-s3", {:require=>"aws/s3"}
+gem "appraisal"
@@ -0,0 +1,56 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ actionmailer (2.3.10)
+ actionpack (= 2.3.10)
+ actionpack (2.3.10)
+ activesupport (= 2.3.10)
+ rack (~> 1.1.0)
+ activerecord (2.3.10)
+ activesupport (= 2.3.10)
+ activeresource (2.3.10)
+ activesupport (= 2.3.10)
+ activesupport (2.3.10)
+ appraisal (0.1)
+ bundler
+ rake
+ aws-s3 (0.6.2)
+ builder
+ mime-types
+ xml-simple
+ builder (3.0.0)
+ columnize (0.3.2)
+ linecache (0.43)
+ mime-types (1.16)
+ mocha (0.9.9)
+ rake
+ rack (1.1.0)
+ rails (2.3.10)
+ actionmailer (= 2.3.10)
+ actionpack (= 2.3.10)
+ activerecord (= 2.3.10)
+ activeresource (= 2.3.10)
+ activesupport (= 2.3.10)
+ rake (>= 0.8.3)
+ rake (0.8.7)
+ ruby-debug (0.10.4)
+ columnize (>= 0.1)
+ ruby-debug-base (~> 0.10.4.0)
+ ruby-debug-base (0.10.4)
+ linecache (>= 0.3)
+ shoulda (2.11.3)
+ sqlite3-ruby (1.3.2)
+ xml-simple (1.0.12)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ appraisal
+ aws-s3
+ mocha
+ rails (~> 2.3.0)
+ rake
+ ruby-debug
+ shoulda
+ sqlite3-ruby (~> 1.3.0)
View
@@ -0,0 +1,11 @@
+# This file was generated by Appraisal
+
+source "http://rubygems.org"
+gem "ruby-debug"
+gem "rails", ">=3.0.3"
+gem "rake"
+gem "sqlite3-ruby", "~>1.3.0"
+gem "shoulda"
+gem "mocha"
+gem "aws-s3", {:require=>"aws/s3"}
+gem "appraisal"
@@ -0,0 +1,97 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ abstract (1.0.0)
+ actionmailer (3.0.3)
+ actionpack (= 3.0.3)
+ mail (~> 2.2.9)
+ actionpack (3.0.3)
+ activemodel (= 3.0.3)
+ activesupport (= 3.0.3)
+ builder (~> 2.1.2)
+ erubis (~> 2.6.6)
+ i18n (~> 0.4)
+ rack (~> 1.2.1)
+ rack-mount (~> 0.6.13)
+ rack-test (~> 0.5.6)
+ tzinfo (~> 0.3.23)
+ activemodel (3.0.3)
+ activesupport (= 3.0.3)
+ builder (~> 2.1.2)
+ i18n (~> 0.4)
+ activerecord (3.0.3)
+ activemodel (= 3.0.3)
+ activesupport (= 3.0.3)
+ arel (~> 2.0.2)
+ tzinfo (~> 0.3.23)
+ activeresource (3.0.3)
+ activemodel (= 3.0.3)
+ activesupport (= 3.0.3)
+ activesupport (3.0.3)
+ appraisal (0.1)
+ bundler
+ rake
+ arel (2.0.4)
+ aws-s3 (0.6.2)
+ builder
+ mime-types
+ xml-simple
+ builder (2.1.2)
+ columnize (0.3.2)
+ erubis (2.6.6)
+ abstract (>= 1.0.0)
+ i18n (0.4.2)
+ linecache (0.43)
+ mail (2.2.10)
+ activesupport (>= 2.3.6)
+ i18n (~> 0.4.1)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.16)
+ mocha (0.9.9)
+ rake
+ polyglot (0.3.1)
+ rack (1.2.1)
+ rack-mount (0.6.13)
+ rack (>= 1.0.0)
+ rack-test (0.5.6)
+ rack (>= 1.0)
+ rails (3.0.3)
+ actionmailer (= 3.0.3)
+ actionpack (= 3.0.3)
+ activerecord (= 3.0.3)
+ activeresource (= 3.0.3)
+ activesupport (= 3.0.3)
+ bundler (~> 1.0)
+ railties (= 3.0.3)
+ railties (3.0.3)
+ actionpack (= 3.0.3)
+ activesupport (= 3.0.3)
+ rake (>= 0.8.7)
+ thor (~> 0.14.4)
+ rake (0.8.7)
+ ruby-debug (0.10.4)
+ columnize (>= 0.1)
+ ruby-debug-base (~> 0.10.4.0)
+ ruby-debug-base (0.10.4)
+ linecache (>= 0.3)
+ shoulda (2.11.3)
+ sqlite3-ruby (1.3.2)
+ thor (0.14.6)
+ treetop (1.4.9)
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.23)
+ xml-simple (1.0.12)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ appraisal
+ aws-s3
+ mocha
+ rails (>= 3.0.3)
+ rake
+ ruby-debug
+ shoulda
+ sqlite3-ruby (~> 1.3.0)
View
@@ -37,6 +37,7 @@
require 'paperclip/interpolations'
require 'paperclip/style'
require 'paperclip/attachment'
+require 'paperclip/storage'
require 'paperclip/callback_compatability'
require 'paperclip/command_line'
require 'paperclip/railtie'
@@ -103,15 +104,6 @@ def run cmd, *params
CommandLine.new(cmd, *params).run
end
- def included base #:nodoc:
- base.extend ClassMethods
- if base.respond_to?("set_callback")
- base.send :include, Paperclip::CallbackCompatability::Rails3
- else
- base.send :include, Paperclip::CallbackCompatability::Rails21
- end
- end
-
def processor name #:nodoc:
name = name.to_s.camelize
processor = Paperclip.const_get(name)
@@ -121,6 +113,12 @@ def processor name #:nodoc:
processor
end
+ def each_instance_with_attachment(klass, name)
+ Object.const_get(klass).all.each do |instance|
+ yield(instance) if instance.send(:"#{name}?")
+ end
+ end
+
# Log a paperclip-specific line. Uses ActiveRecord::Base.logger
# by default. Set Paperclip.options[:log] to false to turn off.
def log message
@@ -159,6 +157,17 @@ class NotIdentifiedByImageMagickError < PaperclipError #:nodoc:
class InfiniteInterpolationError < PaperclipError #:nodoc:
end
+ module Glue
+ def self.included base #:nodoc:
+ base.extend ClassMethods
+ if base.respond_to?("set_callback")
+ base.send :include, Paperclip::CallbackCompatability::Rails3
+ else
+ base.send :include, Paperclip::CallbackCompatability::Rails21
+ end
+ end
+ end
+
module ClassMethods
# +has_attached_file+ gives the class it is called on an attribute that maps to a file. This
# is typically a file stored somewhere on the filesystem and has been uploaded by a user.
Oops, something went wrong.

0 comments on commit 1b8bb3c

Please sign in to comment.