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
d61ddd5c
Commit
d61ddd5c
authored
Mar 30, 2012
by
Prem Sichanugrist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Silence ALL the STDERR warnings!
parent
51bb0f9f
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
9 deletions
+15
-9
lib/paperclip/geometry.rb
+2
-0
lib/paperclip/thumbnail.rb
+0
-1
test/helper.rb
+0
-7
test/integration_test.rb
+5
-1
test/thumbnail_test.rb
+8
-0
No files found.
lib/paperclip/geometry.rb
View file @
d61ddd5c
...
...
@@ -24,7 +24,9 @@ module Paperclip
file_path
=
file
.
respond_to?
(
:path
)
?
file
.
path
:
file
raise
(
Errors
::
NotIdentifiedByImageMagickError
.
new
(
"Cannot find the geometry of a file with a blank name"
))
if
file_path
.
blank?
geometry
=
begin
silence_stream
(
STDERR
)
do
Paperclip
.
run
(
"identify"
,
"-format %wx%h :file"
,
:file
=>
"
#{
file_path
}
[0]"
)
end
rescue
Cocaine
::
ExitStatusError
""
rescue
Cocaine
::
CommandNotFoundError
=>
e
...
...
lib/paperclip/thumbnail.rb
View file @
d61ddd5c
...
...
@@ -44,7 +44,6 @@ module Paperclip
@current_format
=
File
.
extname
(
@file
.
path
)
@basename
=
File
.
basename
(
@file
.
path
,
@current_format
)
end
# Returns true if the +target_geometry+ is meant to crop.
...
...
test/helper.rb
View file @
d61ddd5c
...
...
@@ -28,13 +28,6 @@ end
ROOT
=
Pathname
(
File
.
expand_path
(
File
.
join
(
File
.
dirname
(
__FILE__
),
'..'
)))
def
silence_warnings
old_verbose
,
$VERBOSE
=
$VERBOSE
,
nil
yield
ensure
$VERBOSE
=
old_verbose
end
class
Test
::
Unit
::
TestCase
def
setup
silence_warnings
do
...
...
test/integration_test.rb
View file @
d61ddd5c
...
...
@@ -40,12 +40,16 @@ class IntegrationTest < Test::Unit::TestCase
should
"not raise an error"
do
assert_nothing_raised
do
silence_stream
(
STDERR
)
do
@dummy
.
avatar
.
reprocess!
end
end
end
should
"return false"
do
assert
!
@dummy
.
avatar
.
reprocess!
silence_stream
(
STDERR
)
do
assert
!
@dummy
.
avatar
.
reprocess!
end
end
teardown
{
File
.
chmod
(
0644
,
@dummy
.
avatar
.
path
)
}
...
...
test/thumbnail_test.rb
View file @
d61ddd5c
...
...
@@ -78,8 +78,10 @@ class ThumbnailTest < Test::Unit::TestCase
begin
ENV
[
'PATH'
]
=
''
assert_raises
(
Paperclip
::
Errors
::
CommandNotFoundError
)
do
silence_stream
(
STDERR
)
do
@thumb
.
make
end
end
ensure
ENV
[
'PATH'
]
=
old_path
end
...
...
@@ -155,11 +157,13 @@ class ThumbnailTest < Test::Unit::TestCase
should
"error when trying to create the thumbnail"
do
assert_raises
(
Paperclip
::
Error
)
do
silence_stream
(
STDERR
)
do
@thumb
.
make
end
end
end
end
end
context
"being thumbnailed with convert options set"
do
setup
do
...
...
@@ -195,17 +199,21 @@ class ThumbnailTest < Test::Unit::TestCase
should
"error when trying to create the thumbnail"
do
assert_raises
(
Paperclip
::
Error
)
do
silence_stream
(
STDERR
)
do
@thumb
.
make
end
end
end
should
"let us know when a command isn't found versus a processing error"
do
old_path
=
ENV
[
'PATH'
]
begin
ENV
[
'PATH'
]
=
''
assert_raises
(
Paperclip
::
Errors
::
CommandNotFoundError
)
do
silence_stream
(
STDERR
)
do
@thumb
.
make
end
end
ensure
ENV
[
'PATH'
]
=
old_path
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