Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
PUBLIC
/
surfer-okd
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 0f5a7ba2
authored
Nov 27, 2015
by
Girish Ramakrishnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display uploaded URL
1 parent
0e8695d7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
cli/actions.js
cli/actions.js
View file @
0f5a7ba
...
@@ -94,10 +94,15 @@ function put(filePath, otherFilePaths, options) {
...
@@ -94,10 +94,15 @@ function put(filePath, otherFilePaths, options) {
async
.
eachSeries
(
files
,
function
(
file
,
callback
)
{
async
.
eachSeries
(
files
,
function
(
file
,
callback
)
{
var
relativeFilePath
=
path
.
resolve
(
file
).
slice
(
process
.
cwd
().
length
+
1
);
var
relativeFilePath
=
path
.
resolve
(
file
).
slice
(
process
.
cwd
().
length
+
1
);
var
destinationPath
=
(
options
.
destination
?
'/'
+
options
.
destination
:
''
)
+
'/'
+
relativeFilePath
;
console
.
log
(
'Uploading file %s -> %s'
,
relativeFilePath
.
cyan
,
destinationPath
.
cyan
);
console
.
log
(
'Uploading file %s -> %s'
,
relativeFilePath
.
cyan
,
((
options
.
destination
?
options
.
destination
:
''
)
+
'/'
+
relativeFilePath
).
cyan
);
superagent
.
put
(
config
.
server
()
+
API
+
relativeFilePath
).
query
(
gQuery
).
attach
(
'file'
,
file
).
end
(
function
(
error
,
result
)
{
if
(
error
)
return
callback
(
error
);
if
(
result
.
statusCode
!==
201
)
return
callback
(
new
Error
(
'Error uploading file: '
+
result
.
statusCode
));
superagent
.
put
(
config
.
server
()
+
API
+
relativeFilePath
).
query
(
gQuery
).
attach
(
'file'
,
file
).
end
(
callback
);
console
.
log
(
'Uploaded to '
+
config
.
server
()
+
destinationPath
);
});
},
function
(
error
)
{
},
function
(
error
)
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
'Failed to put file.'
,
error
);
console
.
log
(
'Failed to put file.'
,
error
);
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment