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
06d69afb
Commit
06d69afb
authored
Mar 05, 2012
by
Mike Boone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not add duplicate paths to Cocaine::CommandLine.path for each run.
parent
9092f7a7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletions
+10
-1
lib/paperclip.rb
+1
-1
test/paperclip_test.rb
+9
-0
No files found.
lib/paperclip.rb
View file @
06d69afb
...
@@ -93,7 +93,7 @@ module Paperclip
...
@@ -93,7 +93,7 @@ module Paperclip
#
#
def
run
(
cmd
,
arguments
=
""
,
local_options
=
{})
def
run
(
cmd
,
arguments
=
""
,
local_options
=
{})
command_path
=
options
[
:command_path
]
command_path
=
options
[
:command_path
]
Cocaine
::
CommandLine
.
path
=
(
Cocaine
::
CommandLine
.
path
?
[
Cocaine
::
CommandLine
.
path
,
command_path
].
flatten
:
command_path
)
Cocaine
::
CommandLine
.
path
=
(
Cocaine
::
CommandLine
.
path
?
[
Cocaine
::
CommandLine
.
path
].
flatten
|
[
command_path
]
:
command_path
)
local_options
=
local_options
.
merge
(
:logger
=>
logger
)
if
logging?
&&
(
options
[
:log_command
]
||
local_options
[
:log_command
])
local_options
=
local_options
.
merge
(
:logger
=>
logger
)
if
logging?
&&
(
options
[
:log_command
]
||
local_options
[
:log_command
])
Cocaine
::
CommandLine
.
new
(
cmd
,
arguments
,
local_options
).
run
Cocaine
::
CommandLine
.
new
(
cmd
,
arguments
,
local_options
).
run
end
end
...
...
test/paperclip_test.rb
View file @
06d69afb
...
@@ -22,6 +22,15 @@ class PaperclipTest < Test::Unit::TestCase
...
@@ -22,6 +22,15 @@ class PaperclipTest < Test::Unit::TestCase
Paperclip
.
run
(
"convert"
,
"stuff"
)
Paperclip
.
run
(
"convert"
,
"stuff"
)
assert_equal
[
Cocaine
::
CommandLine
.
path
].
flatten
.
include?
(
"/opt/my_app/bin"
),
true
assert_equal
[
Cocaine
::
CommandLine
.
path
].
flatten
.
include?
(
"/opt/my_app/bin"
),
true
end
end
should
"not duplicate Cocaine::CommandLine.path on multiple runs"
do
Cocaine
::
CommandLine
.
expects
(
:new
).
with
(
"convert"
,
"more_stuff"
,
{}).
returns
(
stub
(
:run
))
Cocaine
::
CommandLine
.
path
=
nil
Paperclip
.
options
[
:command_path
]
=
"/opt/my_app/bin"
Paperclip
.
run
(
"convert"
,
"stuff"
)
Paperclip
.
run
(
"convert"
,
"more_stuff"
)
assert_equal
1
,
[
Cocaine
::
CommandLine
.
path
].
flatten
.
size
end
end
end
context
"Calling Paperclip.run with a logger"
do
context
"Calling Paperclip.run with a logger"
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