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
40207c74
Commit
40207c74
authored
Apr 17, 2012
by
Prem Sichanugrist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix whitespace errors
parent
9d1355b5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
5 additions
and
13 deletions
+5
-13
lib/paperclip/io_adapters/attachment_adapter.rb
+0
-2
lib/paperclip/missing_attachment_styles.rb
+5
-8
test/attachment_adapter_test.rb
+0
-1
test/storage/fog_test.rb
+0
-1
test/storage/s3_live_test.rb
+0
-1
No files found.
lib/paperclip/io_adapters/attachment_adapter.rb
View file @
40207c74
module
Paperclip
module
Paperclip
class
AttachmentAdapter
class
AttachmentAdapter
def
initialize
(
target
)
def
initialize
(
target
)
@target
=
target
@target
=
target
cache_current_values
cache_current_values
...
@@ -62,7 +61,6 @@ module Paperclip
...
@@ -62,7 +61,6 @@ module Paperclip
end
end
dest
dest
end
end
end
end
end
end
...
...
lib/paperclip/missing_attachment_styles.rb
View file @
40207c74
require
'set'
require
'set'
module
Paperclip
module
Paperclip
class
<<
self
class
<<
self
attr_accessor
:classes_with_attachments
attr_accessor
:classes_with_attachments
attr_writer
:registered_attachments_styles_path
attr_writer
:registered_attachments_styles_path
...
@@ -12,7 +11,6 @@ module Paperclip
...
@@ -12,7 +11,6 @@ module Paperclip
self
.
classes_with_attachments
=
Set
.
new
self
.
classes_with_attachments
=
Set
.
new
# Get list of styles saved on previous deploy (running rake paperclip:refresh:missing_styles)
# Get list of styles saved on previous deploy (running rake paperclip:refresh:missing_styles)
def
self
.
get_registered_attachments_styles
def
self
.
get_registered_attachments_styles
YAML
.
load_file
(
Paperclip
.
registered_attachments_styles_path
)
YAML
.
load_file
(
Paperclip
.
registered_attachments_styles_path
)
...
@@ -49,9 +47,9 @@ module Paperclip
...
@@ -49,9 +47,9 @@ module Paperclip
current_styles
[
klass_sym
][
attachment_name
.
to_sym
]
||=
Array
.
new
current_styles
[
klass_sym
][
attachment_name
.
to_sym
]
||=
Array
.
new
current_styles
[
klass_sym
][
attachment_name
.
to_sym
]
<<
style_name
.
to_sym
current_styles
[
klass_sym
][
attachment_name
.
to_sym
]
<<
style_name
.
to_sym
current_styles
[
klass_sym
][
attachment_name
.
to_sym
].
map!
(
&
:to_s
).
sort!
.
map!
(
&
:to_sym
).
uniq!
current_styles
[
klass_sym
][
attachment_name
.
to_sym
].
map!
(
&
:to_s
).
sort!
.
map!
(
&
:to_sym
).
uniq!
end
end
end
end
end
end
end
end
end
end
private_class_method
:current_attachments_styles
private_class_method
:current_attachments_styles
...
@@ -71,7 +69,7 @@ module Paperclip
...
@@ -71,7 +69,7 @@ module Paperclip
current_styles
.
each
do
|
klass
,
attachment_definitions
|
current_styles
.
each
do
|
klass
,
attachment_definitions
|
attachment_definitions
.
each
do
|
attachment_name
,
styles
|
attachment_definitions
.
each
do
|
attachment_name
,
styles
|
registered
=
registered_styles
[
klass
][
attachment_name
]
||
[]
rescue
[]
registered
=
registered_styles
[
klass
][
attachment_name
]
||
[]
rescue
[]
missed
=
styles
-
registered
missed
=
styles
-
registered
if
missed
.
present?
if
missed
.
present?
klass_sym
=
klass
.
to_s
.
to_sym
klass_sym
=
klass
.
to_s
.
to_sym
missing_styles
[
klass_sym
]
||=
Hash
.
new
missing_styles
[
klass_sym
]
||=
Hash
.
new
...
@@ -80,8 +78,7 @@ module Paperclip
...
@@ -80,8 +78,7 @@ module Paperclip
missing_styles
[
klass_sym
][
attachment_name
.
to_sym
].
map!
(
&
:to_s
).
sort!
.
map!
(
&
:to_sym
).
uniq!
missing_styles
[
klass_sym
][
attachment_name
.
to_sym
].
map!
(
&
:to_s
).
sort!
.
map!
(
&
:to_sym
).
uniq!
end
end
end
end
end
end
end
end
end
end
end
end
test/attachment_adapter_test.rb
View file @
40207c74
...
@@ -44,5 +44,4 @@ class AttachmentAdapterTest < Test::Unit::TestCase
...
@@ -44,5 +44,4 @@ class AttachmentAdapterTest < Test::Unit::TestCase
assert_equal
expected
.
length
,
actual
.
length
assert_equal
expected
.
length
,
actual
.
length
assert_equal
expected
,
actual
assert_equal
expected
,
actual
end
end
end
end
test/storage/fog_test.rb
View file @
40207c74
...
@@ -5,7 +5,6 @@ Fog.mock!
...
@@ -5,7 +5,6 @@ Fog.mock!
class
FogTest
<
Test
::
Unit
::
TestCase
class
FogTest
<
Test
::
Unit
::
TestCase
context
""
do
context
""
do
context
"with credentials provided in a path string"
do
context
"with credentials provided in a path string"
do
setup
do
setup
do
rebuild_model
:styles
=>
{
:medium
=>
"300x300>"
,
:thumb
=>
"100x100>"
},
rebuild_model
:styles
=>
{
:medium
=>
"300x300>"
,
:thumb
=>
"100x100>"
},
...
...
test/storage/s3_live_test.rb
View file @
40207c74
...
@@ -3,7 +3,6 @@ require 'aws'
...
@@ -3,7 +3,6 @@ require 'aws'
unless
ENV
[
"S3_BUCKET"
].
blank?
unless
ENV
[
"S3_BUCKET"
].
blank?
class
S3LiveTest
<
Test
::
Unit
::
TestCase
class
S3LiveTest
<
Test
::
Unit
::
TestCase
context
"when assigning an S3 attachment directly to another model"
do
context
"when assigning an S3 attachment directly to another model"
do
setup
do
setup
do
rebuild_model
:styles
=>
{
:thumb
=>
"100x100"
,
:square
=>
"32x32#"
},
rebuild_model
:styles
=>
{
:thumb
=>
"100x100"
,
:square
=>
"32x32#"
},
...
...
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