Skip to content

Commit

Permalink
Merge git://github.com/thoughtbot/paperclip
Browse files Browse the repository at this point in the history
  • Loading branch information
Gonzih committed Jan 15, 2011
2 parents 763ae11 + 7a38ef7 commit 973d372
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 2 deletions.
14 changes: 13 additions & 1 deletion README.rdoc
Expand Up @@ -15,7 +15,19 @@ 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

As a plugin:

ruby script/plugin install git://github.com/thoughtbot/paperclip.git

==Quick Start

Expand Down
3 changes: 3 additions & 0 deletions lib/paperclip/attachment.rb
Expand Up @@ -235,6 +235,9 @@ def reprocess!
else
true
end
rescue Errno::EACCES => e
warn "#{e} - skipping file"
false
end

# Returns true if a file has been assigned.
Expand Down
2 changes: 1 addition & 1 deletion paperclip.gemspec
Expand Up @@ -4,7 +4,7 @@ require 'paperclip/version'
include_files = ["README*", "LICENSE", "Rakefile", "init.rb", "{lib,tasks,test,rails,generators,shoulda_macros}/**/*"].map do |glob|
Dir[glob]
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 = ["**/*.rbc", "test/s3.yml", "test/debug.log", "test/paperclip.db", "test/doc", "test/doc/*", "test/pkg", "test/pkg/*", "test/tmp", "test/tmp/*"].map do |glob|
Dir[glob]
end.flatten

Expand Down
16 changes: 16 additions & 0 deletions test/integration_test.rb
Expand Up @@ -34,6 +34,22 @@ class IntegrationTest < Test::Unit::TestCase
should "create its thumbnails properly" do
assert_match /\b50x50\b/, `identify "#{@dummy.avatar.path(:thumb)}"`
end

context 'reprocessing with unreadable original' do
setup { File.chmod(0000, @dummy.avatar.path) }

should "not raise an error" do
assert_nothing_raised do
@dummy.avatar.reprocess!
end
end

should "return false" do
assert ! @dummy.avatar.reprocess!
end

teardown { File.chmod(0644, @dummy.avatar.path) }
end

context "redefining its attachment styles" do
setup do
Expand Down
23 changes: 23 additions & 0 deletions test/storage_test.rb
Expand Up @@ -7,6 +7,29 @@ def rails_env(env)
Object.const_set(:Rails, stub('Rails', :env => env))
end
end

context "filesystem" do
setup do
rebuild_model :styles => { :thumbnail => "25x25#" }
@dummy = Dummy.create!

@dummy.avatar = File.open(File.join(File.dirname(__FILE__), "fixtures", "5k.png"))
end

should "allow file assignment" do
assert @dummy.save
end

should "store the original" do
@dummy.save
assert File.exists?(@dummy.avatar.path)
end

should "store the thumbnail" do
@dummy.save
assert File.exists?(@dummy.avatar.path(:thumbnail))
end
end

context "Parsing S3 credentials" do
setup do
Expand Down

0 comments on commit 973d372

Please sign in to comment.