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
1738ea1d
Commit
1738ea1d
authored
Mar 09, 2011
by
Jon Yurek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow commandline args like 'xc:black'
parent
91c23385
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletions
+12
-1
lib/paperclip/command_line.rb
+7
-1
test/command_line_test.rb
+5
-0
No files found.
lib/paperclip/command_line.rb
View file @
1738ea1d
...
...
@@ -52,7 +52,7 @@ module Paperclip
raise
PaperclipCommandLineError
,
"Interpolation of
#{
key
}
isn't allowed."
end
shell_quote
(
vars
[
key
.
to_sym
])
interpolation
(
vars
,
key
)
||
match
end
end
...
...
@@ -60,6 +60,12 @@ module Paperclip
%w(expected_outcodes swallow_stderr)
end
def
interpolation
(
vars
,
key
)
if
vars
.
key?
(
key
.
to_sym
)
shell_quote
(
vars
[
key
.
to_sym
])
end
end
def
shell_quote
(
string
)
return
""
if
string
.
nil?
or
string
.
blank?
if
self
.
class
.
unix?
...
...
test/command_line_test.rb
View file @
1738ea1d
...
...
@@ -6,6 +6,11 @@ class CommandLineTest < Test::Unit::TestCase
File
.
stubs
(
:exist?
).
with
(
"/dev/null"
).
returns
(
true
)
end
should
"allow colons in parameters"
do
cmd
=
Paperclip
::
CommandLine
.
new
(
"convert"
,
"'a.jpg' -resize 175x220> -size 175x220 xc:black +swap -gravity center -composite 'b.jpg'"
,
:swallow_stderr
=>
false
)
assert_equal
"convert 'a.jpg' -resize 175x220> -size 175x220 xc:black +swap -gravity center -composite 'b.jpg'"
,
cmd
.
command
end
should
"take a command and parameters and produce a shell command for bash"
do
cmd
=
Paperclip
::
CommandLine
.
new
(
"convert"
,
"a.jpg b.png"
,
:swallow_stderr
=>
false
)
assert_equal
"convert a.jpg b.png"
,
cmd
.
command
...
...
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