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
634864d7
Commit
634864d7
authored
May 10, 2009
by
Jon Yurek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Log commands with Paperclip.options[:log_command] = true
parent
af1ae004
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
lib/paperclip.rb
+2
-0
test/paperclip_test.rb
+8
-0
No files found.
lib/paperclip.rb
View file @
634864d7
...
...
@@ -62,6 +62,7 @@ module Paperclip
:image_magick_path
=>
nil
,
:command_path
=>
nil
,
:log
=>
true
,
:log_command
=>
false
,
:swallow_stderr
=>
true
}
end
...
...
@@ -90,6 +91,7 @@ module Paperclip
def
run
cmd
,
params
=
""
,
expected_outcodes
=
0
command
=
%Q<
#{
%
Q
[
#{path_for_command(cmd)} #{params}].gsub(/\s+/, " ")}>
command
=
"
#{
command
}
2>
#{
bit_bucket
}
"
if
Paperclip
.
options
[
:swallow_stderr
]
Paperclip
.
log
(
command
)
if
Paperclip
.
options
[
:log_command
]
output
=
`
#{
command
}
`
unless
[
expected_outcodes
].
flatten
.
include?
(
$?
.
exitstatus
)
raise
PaperclipCommandLineError
,
"Error while running
#{
cmd
}
"
...
...
test/paperclip_test.rb
View file @
634864d7
...
...
@@ -30,6 +30,14 @@ class PaperclipTest < Test::Unit::TestCase
Paperclip
.
expects
(
:"`"
).
with
(
"convert one.jpg two.jpg 2>/dev/null"
)
Paperclip
.
run
(
"convert"
,
"one.jpg two.jpg"
)
end
should
"log the command when :log_command is set"
do
Paperclip
.
options
[
:log_command
]
=
true
Paperclip
.
expects
(
:bit_bucket
).
returns
(
"/dev/null"
)
Paperclip
.
expects
(
:log
).
with
(
"this is the command 2>/dev/null"
)
Paperclip
.
expects
(
:"`"
).
with
(
"this is the command 2>/dev/null"
)
Paperclip
.
run
(
"this"
,
"is the command"
)
end
end
should
"raise when sent #processor and the name of a class that exists but isn't a subclass of Processor"
do
...
...
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