Commit c6ccb54d by Jon Yurek

Rearranged stuff and added a gem build/deploy process. Official release of 2.1.0.

parent c44048d0
......@@ -3,6 +3,9 @@ require 'rake/testtask'
require 'rake/rdoctask'
require 'rake/gempackagetask'
$LOAD_PATH << File.join(File.dirname(__FILE__), 'lib')
require 'paperclip'
desc 'Default: run unit tests.'
task :default => [:clean, :test]
......@@ -44,7 +47,7 @@ end
spec = Gem::Specification.new do |s|
s.name = "paperclip"
s.version = "2.1.0"
s.version = Paperclip::VERSION
s.author = "Jon Yurek"
s.email = "jyurek@thoughtbot.com"
s.homepage = "http://www.thoughtbot.com/"
......@@ -67,3 +70,15 @@ end
Rake::GemPackageTask.new(spec) do |pkg|
pkg.need_tar = true
end
desc "Release new version"
task :release => [:test, :sync_docs, :gem] do
require 'rubygems'
require 'rubyforge'
r = RubyForge.new
r.login
r.add_release spec.rubyforge_project,
spec.name,
spec.version,
File.join("pkg", "#{spec.name}-#{spec.version}.gem")
end
require File.join(File.dirname(__FILE__), "lib", "paperclip")
ActiveRecord::Base.extend( Paperclip::ClassMethods )
File.send :include, Paperclip::Upfile
\ No newline at end of file
......@@ -35,6 +35,9 @@ require 'paperclip/attachment'
# The base module that gets included in ActiveRecord::Base.
module Paperclip
VERSION = "2.1.0"
class << self
# Provides configurability to Paperclip. There are a number of options available, such as:
# * whiny_thumbnails: Will raise an error if Paperclip cannot process thumbnails of
......@@ -198,3 +201,9 @@ module Paperclip
end
end
# Set it all up.
if Object.const_defined?("ActiveRecord")
ActiveRecord::Base.send(:include, Paperclip)
File.send(:include, Paperclip::Upfile)
end
......@@ -81,6 +81,7 @@ class AttachmentTest < Test::Unit::TestCase
Paperclip::Attachment.default_options.merge!({
:path => ":rails_root/tmp/:attachment/:class/:style/:id/:basename.:extension"
})
FileUtils.rm_rf("tmp")
@instance = stub
@instance.stubs(:id).returns(41)
@instance.stubs(:class).returns(Dummy)
......@@ -172,6 +173,23 @@ class AttachmentTest < Test::Unit::TestCase
should "still have its #file attribute not be nil" do
assert ! @attachment.file.nil?
end
context "and deleted" do
setup do
@existing_names = @attachment.styles.keys.collect do |style|
@attachment.path(style)
end
@instance.expects(:[]=).with(:test_file_name, nil)
@instance.expects(:[]=).with(:test_content_type, nil)
@instance.expects(:[]=).with(:test_file_size, nil)
@attachment.assign nil
@attachment.save
end
should "delete the files" do
@existing_names.each{|f| assert ! File.exists?(f) }
end
end
end
end
end
......
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