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
c7b802cb
Commit
c7b802cb
authored
May 07, 2009
by
Jon Yurek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deprecations: Interpolation definition and thumbnail validation
parent
acc8f754
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
6 deletions
+12
-6
Rakefile
+0
-1
lib/paperclip.rb
+4
-1
lib/paperclip/attachment.rb
+5
-1
lib/paperclip/storage.rb
+3
-3
No files found.
Rakefile
View file @
c7b802cb
...
@@ -64,7 +64,6 @@ spec = Gem::Specification.new do |s|
...
@@ -64,7 +64,6 @@ spec = Gem::Specification.new do |s|
s
.
extra_rdoc_files
=
FileList
[
"README*"
].
to_a
s
.
extra_rdoc_files
=
FileList
[
"README*"
].
to_a
s
.
rdoc_options
<<
'--line-numbers'
<<
'--inline-source'
s
.
rdoc_options
<<
'--line-numbers'
<<
'--inline-source'
s
.
requirements
<<
"ImageMagick"
s
.
requirements
<<
"ImageMagick"
s
.
add_runtime_dependency
'right_aws'
s
.
add_development_dependency
'thoughtbot-shoulda'
s
.
add_development_dependency
'thoughtbot-shoulda'
s
.
add_development_dependency
'mocha'
s
.
add_development_dependency
'mocha'
end
end
...
...
lib/paperclip.rb
View file @
c7b802cb
...
@@ -75,7 +75,7 @@ module Paperclip
...
@@ -75,7 +75,7 @@ module Paperclip
end
end
def
interpolates
key
,
&
block
def
interpolates
key
,
&
block
Paperclip
::
Attachment
.
i
nterpolations
[
key
]
=
block
Paperclip
::
I
nterpolations
[
key
]
=
block
end
end
# The run method takes a command to execute and a string of parameters
# The run method takes a command to execute and a string of parameters
...
@@ -235,6 +235,9 @@ module Paperclip
...
@@ -235,6 +235,9 @@ module Paperclip
# Adds errors if thumbnail creation fails. The same as specifying :whiny_thumbnails => true.
# Adds errors if thumbnail creation fails. The same as specifying :whiny_thumbnails => true.
def
validates_attachment_thumbnails
name
,
options
=
{}
def
validates_attachment_thumbnails
name
,
options
=
{}
warn
(
'[DEPRECATED] validates_attachment_thumbnail is deprecated. '
'This validation is on by default and will be removed from future versions. '
'If you wish to turn it off, supply :whiny => false in your definition.'
)
attachment_definitions
[
name
][
:whiny_thumbnails
]
=
true
attachment_definitions
[
name
][
:whiny_thumbnails
]
=
true
end
end
...
...
lib/paperclip/attachment.rb
View file @
c7b802cb
...
@@ -37,7 +37,8 @@ module Paperclip
...
@@ -37,7 +37,8 @@ module Paperclip
@validations
=
options
[
:validations
]
@validations
=
options
[
:validations
]
@default_style
=
options
[
:default_style
]
@default_style
=
options
[
:default_style
]
@storage
=
options
[
:storage
]
@storage
=
options
[
:storage
]
@whiny
=
options
[
:whiny_thumbnails
]
@whiny
=
options
[
:whiny_thumbnails
]
||
options
[
:whiny
]
@whiny
=
true
unless
@whiny
==
false
# default to true if nil
@convert_options
=
options
[
:convert_options
]
||
{}
@convert_options
=
options
[
:convert_options
]
||
{}
@processors
=
options
[
:processors
]
||
[
:thumbnail
]
@processors
=
options
[
:processors
]
||
[
:thumbnail
]
@options
=
options
@options
=
options
...
@@ -198,6 +199,9 @@ module Paperclip
...
@@ -198,6 +199,9 @@ module Paperclip
# style as arguments. This hash can be added to with your own proc if
# style as arguments. This hash can be added to with your own proc if
# necessary.
# necessary.
def
self
.
interpolations
def
self
.
interpolations
warn
(
'[DEPRECATION] Paperclip::Attachment.interpolations is deprecated '
'and will be removed from future versions. '
'Use Paperclip.interpolates instead'
)
Paperclip
::
Interpolations
Paperclip
::
Interpolations
end
end
...
...
lib/paperclip/storage.rb
View file @
c7b802cb
...
@@ -140,13 +140,13 @@ module Paperclip
...
@@ -140,13 +140,13 @@ module Paperclip
@s3_host_alias
=
@options
[
:s3_host_alias
]
@s3_host_alias
=
@options
[
:s3_host_alias
]
@url
=
":s3_path_url"
unless
@url
.
to_s
.
match
(
/^:s3.*url$/
)
@url
=
":s3_path_url"
unless
@url
.
to_s
.
match
(
/^:s3.*url$/
)
end
end
base
.
class
.
interpolations
[
:s3_alias_url
]
=
lambda
do
|
attachment
,
style
|
Paperclip
.
interpolates
(
:s3_alias_url
)
do
|
attachment
,
style
|
"
#{
attachment
.
s3_protocol
}
://
#{
attachment
.
s3_host_alias
}
/
#{
attachment
.
path
(
style
).
gsub
(
%r{^/}
,
""
)
}
"
"
#{
attachment
.
s3_protocol
}
://
#{
attachment
.
s3_host_alias
}
/
#{
attachment
.
path
(
style
).
gsub
(
%r{^/}
,
""
)
}
"
end
end
base
.
class
.
interpolations
[
:s3_path_url
]
=
lambda
do
|
attachment
,
style
|
Paperclip
.
interpolates
(
:s3_path_url
)
do
|
attachment
,
style
|
"
#{
attachment
.
s3_protocol
}
://s3.amazonaws.com/
#{
attachment
.
bucket_name
}
/
#{
attachment
.
path
(
style
).
gsub
(
%r{^/}
,
""
)
}
"
"
#{
attachment
.
s3_protocol
}
://s3.amazonaws.com/
#{
attachment
.
bucket_name
}
/
#{
attachment
.
path
(
style
).
gsub
(
%r{^/}
,
""
)
}
"
end
end
base
.
class
.
interpolations
[
:s3_domain_url
]
=
lambda
do
|
attachment
,
style
|
Paperclip
.
interpolates
(
:s3_domain_url
)
do
|
attachment
,
style
|
"
#{
attachment
.
s3_protocol
}
://
#{
attachment
.
bucket_name
}
.s3.amazonaws.com/
#{
attachment
.
path
(
style
).
gsub
(
%r{^/}
,
""
)
}
"
"
#{
attachment
.
s3_protocol
}
://
#{
attachment
.
bucket_name
}
.s3.amazonaws.com/
#{
attachment
.
path
(
style
).
gsub
(
%r{^/}
,
""
)
}
"
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