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
955db222
Commit
955db222
authored
Jun 14, 2014
by
Joost Baaij
Committed by
Jon Yurek
Jun 20, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace File.exists? with File.exist?
File.exists? has been deprecated since Ruby 1.9.2
parent
aa0aec29
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
12 additions
and
12 deletions
+12
-12
features/step_definitions/attachment_steps.rb
+1
-1
features/step_definitions/rails_steps.rb
+1
-1
lib/paperclip/content_type_detector.rb
+1
-1
lib/paperclip/storage/filesystem.rb
+1
-1
spec/paperclip/integration_spec.rb
+3
-3
spec/paperclip/storage/filesystem_spec.rb
+1
-1
spec/paperclip/storage/fog_spec.rb
+1
-1
spec/paperclip/storage/s3_spec.rb
+1
-1
spec/paperclip/tempfile_factory_spec.rb
+1
-1
spec/support/matchers/exist.rb
+1
-1
No files found.
features/step_definitions/attachment_steps.rb
View file @
955db222
...
...
@@ -35,7 +35,7 @@ end
Then
/^the attachment "([^"]*)" should exist$/
do
|
filename
|
in_current_dir
do
File
.
exist
s
?
(
attachment_path
(
filename
)).
should
be
File
.
exist?
(
attachment_path
(
filename
)).
should
be
end
end
...
...
features/step_definitions/rails_steps.rb
View file @
955db222
...
...
@@ -197,7 +197,7 @@ Given /^I am using Rails newer than ([\d\.]+)$/ do |version|
end
def
transform_file
(
filename
)
if
File
.
exist
s
?
(
filename
)
if
File
.
exist?
(
filename
)
content
=
File
.
read
(
filename
)
File
.
open
(
filename
,
"w"
)
do
|
f
|
content
=
yield
(
content
)
...
...
lib/paperclip/content_type_detector.rb
View file @
955db222
...
...
@@ -40,7 +40,7 @@ module Paperclip
private
def
empty_file?
File
.
exist
s
?
(
@filename
)
&&
File
.
size
(
@filename
)
==
0
File
.
exist?
(
@filename
)
&&
File
.
size
(
@filename
)
==
0
end
alias
:empty?
:empty_file?
...
...
lib/paperclip/storage/filesystem.rb
View file @
955db222
...
...
@@ -69,7 +69,7 @@ module Paperclip
while
(
true
)
path
=
File
.
dirname
(
path
)
FileUtils
.
rmdir
(
path
)
break
if
File
.
exist
s
?
(
path
)
# Ruby 1.9.2 does not raise if the removal failed.
break
if
File
.
exist?
(
path
)
# Ruby 1.9.2 does not raise if the removal failed.
end
rescue
Errno
::
EEXIST
,
Errno
::
ENOTEMPTY
,
Errno
::
ENOENT
,
Errno
::
EINVAL
,
Errno
::
ENOTDIR
,
Errno
::
EACCES
# Stop trying to remove parent directories
...
...
spec/paperclip/integration_spec.rb
View file @
955db222
...
...
@@ -81,7 +81,7 @@ describe 'Paperclip' do
context
"Attachment"
do
before
do
@thumb_path
=
"tmp/public/system/dummies/avatars/000/000/001/thumb/5k.png"
File
.
delete
(
@thumb_path
)
if
File
.
exist
s
?
(
@thumb_path
)
File
.
delete
(
@thumb_path
)
if
File
.
exist?
(
@thumb_path
)
rebuild_model
styles:
{
thumb:
"50x50#"
}
@dummy
=
Dummy
.
new
@file
=
File
.
new
(
fixture_file
(
"5k.png"
),
'rb'
)
...
...
@@ -109,8 +109,8 @@ describe 'Paperclip' do
before
do
@thumb_small_path
=
"tmp/public/system/dummies/avatars/000/000/001/thumb_small/5k.png"
@thumb_large_path
=
"tmp/public/system/dummies/avatars/000/000/001/thumb_large/5k.png"
File
.
delete
(
@thumb_small_path
)
if
File
.
exist
s
?
(
@thumb_small_path
)
File
.
delete
(
@thumb_large_path
)
if
File
.
exist
s
?
(
@thumb_large_path
)
File
.
delete
(
@thumb_small_path
)
if
File
.
exist?
(
@thumb_small_path
)
File
.
delete
(
@thumb_large_path
)
if
File
.
exist?
(
@thumb_large_path
)
rebuild_model
styles:
{
thumb_small:
"50x50#"
,
thumb_large:
"60x60#"
}
@dummy
=
Dummy
.
new
@file
=
File
.
new
(
fixture_file
(
"5k.png"
),
'rb'
)
...
...
spec/paperclip/storage/filesystem_spec.rb
View file @
955db222
...
...
@@ -38,7 +38,7 @@ describe Paperclip::Storage::Filesystem do
it
"is removed after after_flush_writes"
do
paths
=
@dummy
.
avatar
.
queued_for_write
.
values
.
map
(
&
:path
)
@dummy
.
save
assert
paths
.
none?
{
|
path
|
File
.
exist
s
?
(
path
)
},
assert
paths
.
none?
{
|
path
|
File
.
exist?
(
path
)
},
"Expect all the files to be deleted."
end
...
...
spec/paperclip/storage/fog_spec.rb
View file @
955db222
...
...
@@ -167,7 +167,7 @@ describe Paperclip::Storage::Fog do
it
"is removed after after_flush_writes"
do
paths
=
@dummy
.
avatar
.
queued_for_write
.
values
.
map
(
&
:path
)
@dummy
.
save
assert
paths
.
none?
{
|
path
|
File
.
exist
s
?
(
path
)
},
assert
paths
.
none?
{
|
path
|
File
.
exist?
(
path
)
},
"Expect all the files to be deleted."
end
...
...
spec/paperclip/storage/s3_spec.rb
View file @
955db222
...
...
@@ -691,7 +691,7 @@ describe Paperclip::Storage::S3 do
@dummy
.
avatar
.
stubs
(
:s3_object
).
returns
(
stub
(
write:
true
))
paths
=
@dummy
.
avatar
.
queued_for_write
.
values
.
map
(
&
:path
)
@dummy
.
save
assert
paths
.
none?
{
|
path
|
File
.
exist
s
?
(
path
)
},
assert
paths
.
none?
{
|
path
|
File
.
exist?
(
path
)
},
"Expect all the files to be deleted."
end
...
...
spec/paperclip/tempfile_factory_spec.rb
View file @
955db222
...
...
@@ -24,6 +24,6 @@ describe Paperclip::TempfileFactory do
it
'is able to take nothing as a parameter and not error'
do
file
=
subject
.
generate
assert
File
.
exist
s
?
(
file
.
path
)
assert
File
.
exist?
(
file
.
path
)
end
end
spec/support/matchers/exist.rb
View file @
955db222
RSpec
::
Matchers
.
define
:exist
do
|
expected
|
match
do
|
actual
|
File
.
exist
s
?
(
actual
)
File
.
exist?
(
actual
)
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