Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Rearranged stuff and added a gem build/deploy process. Official relea…

…se of 2.1.0.

git-svn-id: https://svn.thoughtbot.com/plugins/paperclip/trunk@464 7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
  • Loading branch information...
commit 22b4c0c29fc6d832e97c597c143dacb60e0dc85e 1 parent 77e91c0
authored April 18, 2008
1  .gitignore
... ...
@@ -1,2 +1,3 @@
1 1
 *.swp
2 2
 tmp
  3
+s3.yml
17  Rakefile
@@ -3,6 +3,9 @@ require 'rake/testtask'
3 3
 require 'rake/rdoctask'
4 4
 require 'rake/gempackagetask'
5 5
 
  6
+$LOAD_PATH << File.join(File.dirname(__FILE__), 'lib')
  7
+require 'paperclip'
  8
+
6 9
 desc 'Default: run unit tests.'
7 10
 task :default => [:clean, :test]
8 11
 
@@ -44,7 +47,7 @@ end
44 47
 
45 48
 spec = Gem::Specification.new do |s| 
46 49
   s.name              = "paperclip"
47  
-  s.version           = "2.1.0"
  50
+  s.version           = Paperclip::VERSION
48 51
   s.author            = "Jon Yurek"
49 52
   s.email             = "jyurek@thoughtbot.com"
50 53
   s.homepage          = "http://www.thoughtbot.com/"
@@ -67,3 +70,15 @@ end
67 70
 Rake::GemPackageTask.new(spec) do |pkg| 
68 71
   pkg.need_tar = true 
69 72
 end 
  73
+
  74
+desc "Release new version"
  75
+task :release => [:test, :sync_docs, :gem] do
  76
+  require 'rubygems'
  77
+  require 'rubyforge'
  78
+  r = RubyForge.new
  79
+  r.login
  80
+  r.add_release spec.rubyforge_project,
  81
+                spec.name,
  82
+                spec.version,
  83
+                File.join("pkg", "#{spec.name}-#{spec.version}.gem")
  84
+end
2  init.rb
... ...
@@ -1,3 +1 @@
1 1
 require File.join(File.dirname(__FILE__), "lib", "paperclip")
2  
-ActiveRecord::Base.extend( Paperclip::ClassMethods )
3  
-File.send :include, Paperclip::Upfile
9  lib/paperclip.rb
@@ -35,6 +35,9 @@
35 35
 
36 36
 # The base module that gets included in ActiveRecord::Base.
37 37
 module Paperclip
  38
+
  39
+  VERSION = "2.1.0"
  40
+
38 41
   class << self
39 42
     # Provides configurability to Paperclip. There are a number of options available, such as:
40 43
     # * whiny_thumbnails: Will raise an error if Paperclip cannot process thumbnails of 
@@ -198,3 +201,9 @@ def destroy_attached_files
198 201
   end
199 202
 
200 203
 end
  204
+
  205
+# Set it all up.
  206
+if Object.const_defined?("ActiveRecord")
  207
+  ActiveRecord::Base.send(:include, Paperclip)
  208
+  File.send(:include, Paperclip::Upfile)
  209
+end
18  test/test_attachment.rb
@@ -81,6 +81,7 @@ class AttachmentTest < Test::Unit::TestCase
81 81
       Paperclip::Attachment.default_options.merge!({
82 82
         :path => ":rails_root/tmp/:attachment/:class/:style/:id/:basename.:extension"
83 83
       })
  84
+      FileUtils.rm_rf("tmp")
84 85
       @instance = stub
85 86
       @instance.stubs(:id).returns(41)
86 87
       @instance.stubs(:class).returns(Dummy)
@@ -172,6 +173,23 @@ class AttachmentTest < Test::Unit::TestCase
172 173
           should "still have its #file attribute not be nil" do
173 174
             assert ! @attachment.file.nil?
174 175
           end
  176
+
  177
+          context "and deleted" do
  178
+            setup do
  179
+              @existing_names = @attachment.styles.keys.collect do |style|
  180
+                @attachment.path(style)
  181
+              end
  182
+              @instance.expects(:[]=).with(:test_file_name, nil)
  183
+              @instance.expects(:[]=).with(:test_content_type, nil)
  184
+              @instance.expects(:[]=).with(:test_file_size, nil)
  185
+              @attachment.assign nil
  186
+              @attachment.save
  187
+            end
  188
+
  189
+            should "delete the files" do
  190
+              @existing_names.each{|f| assert ! File.exists?(f) }
  191
+            end
  192
+          end
175 193
         end
176 194
       end
177 195
     end

0 notes on commit 22b4c0c

Please sign in to comment.
Something went wrong with that request. Please try again.