Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
paperclip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
paperclip
Commits
c6ccb54d
Commit
c6ccb54d
authored
Apr 18, 2008
by
Jon Yurek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rearranged stuff and added a gem build/deploy process. Official release of 2.1.0.
parent
c44048d0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
4 deletions
+44
-4
.gitignore
+1
-0
Rakefile
+16
-1
init.rb
+0
-3
lib/paperclip.rb
+9
-0
test/test_attachment.rb
+18
-0
No files found.
.gitignore
View file @
c6ccb54d
*.swp
*.swp
tmp
tmp
s3.yml
Rakefile
View file @
c6ccb54d
...
@@ -3,6 +3,9 @@ require 'rake/testtask'
...
@@ -3,6 +3,9 @@ require 'rake/testtask'
require
'rake/rdoctask'
require
'rake/rdoctask'
require
'rake/gempackagetask'
require
'rake/gempackagetask'
$LOAD_PATH
<<
File
.
join
(
File
.
dirname
(
__FILE__
),
'lib'
)
require
'paperclip'
desc
'Default: run unit tests.'
desc
'Default: run unit tests.'
task
:default
=>
[
:clean
,
:test
]
task
:default
=>
[
:clean
,
:test
]
...
@@ -44,7 +47,7 @@ end
...
@@ -44,7 +47,7 @@ end
spec
=
Gem
::
Specification
.
new
do
|
s
|
spec
=
Gem
::
Specification
.
new
do
|
s
|
s
.
name
=
"paperclip"
s
.
name
=
"paperclip"
s
.
version
=
"2.1.0"
s
.
version
=
Paperclip
::
VERSION
s
.
author
=
"Jon Yurek"
s
.
author
=
"Jon Yurek"
s
.
email
=
"jyurek@thoughtbot.com"
s
.
email
=
"jyurek@thoughtbot.com"
s
.
homepage
=
"http://www.thoughtbot.com/"
s
.
homepage
=
"http://www.thoughtbot.com/"
...
@@ -67,3 +70,15 @@ end
...
@@ -67,3 +70,15 @@ end
Rake
::
GemPackageTask
.
new
(
spec
)
do
|
pkg
|
Rake
::
GemPackageTask
.
new
(
spec
)
do
|
pkg
|
pkg
.
need_tar
=
true
pkg
.
need_tar
=
true
end
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
init.rb
View file @
c6ccb54d
require
File
.
join
(
File
.
dirname
(
__FILE__
),
"lib"
,
"paperclip"
)
require
File
.
join
(
File
.
dirname
(
__FILE__
),
"lib"
,
"paperclip"
)
ActiveRecord
::
Base
.
extend
(
Paperclip
::
ClassMethods
)
File
.
send
:include
,
Paperclip
::
Upfile
\ No newline at end of file
lib/paperclip.rb
View file @
c6ccb54d
...
@@ -35,6 +35,9 @@ require 'paperclip/attachment'
...
@@ -35,6 +35,9 @@ require 'paperclip/attachment'
# The base module that gets included in ActiveRecord::Base.
# The base module that gets included in ActiveRecord::Base.
module
Paperclip
module
Paperclip
VERSION
=
"2.1.0"
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:
# * whiny_thumbnails: Will raise an error if Paperclip cannot process thumbnails of
# * whiny_thumbnails: Will raise an error if Paperclip cannot process thumbnails of
...
@@ -198,3 +201,9 @@ module Paperclip
...
@@ -198,3 +201,9 @@ module Paperclip
end
end
end
end
# Set it all up.
if
Object
.
const_defined?
(
"ActiveRecord"
)
ActiveRecord
::
Base
.
send
(
:include
,
Paperclip
)
File
.
send
(
:include
,
Paperclip
::
Upfile
)
end
test/test_attachment.rb
View file @
c6ccb54d
...
@@ -81,6 +81,7 @@ class AttachmentTest < Test::Unit::TestCase
...
@@ -81,6 +81,7 @@ class AttachmentTest < Test::Unit::TestCase
Paperclip
::
Attachment
.
default_options
.
merge!
({
Paperclip
::
Attachment
.
default_options
.
merge!
({
:path
=>
":rails_root/tmp/:attachment/:class/:style/:id/:basename.:extension"
:path
=>
":rails_root/tmp/:attachment/:class/:style/:id/:basename.:extension"
})
})
FileUtils
.
rm_rf
(
"tmp"
)
@instance
=
stub
@instance
=
stub
@instance
.
stubs
(
:id
).
returns
(
41
)
@instance
.
stubs
(
:id
).
returns
(
41
)
@instance
.
stubs
(
:class
).
returns
(
Dummy
)
@instance
.
stubs
(
:class
).
returns
(
Dummy
)
...
@@ -172,6 +173,23 @@ class AttachmentTest < Test::Unit::TestCase
...
@@ -172,6 +173,23 @@ class AttachmentTest < Test::Unit::TestCase
should
"still have its #file attribute not be nil"
do
should
"still have its #file attribute not be nil"
do
assert
!
@attachment
.
file
.
nil?
assert
!
@attachment
.
file
.
nil?
end
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
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment