spmjs / grunt-scp Goto Github PK
View Code? Open in Web Editor NEWCopy files to remote server.
License: MIT License
Copy files to remote server.
License: MIT License
I would like to call a function before copying my files.
With grunt, you can normally do :
copy: {
myTask: {
options: {
process: function (content, srcpath) {
return content;
}
},
files: [...]
}
}
I would like to do the same using scp, unfortunately it doesn't trigger the function. Any solution or alternative ?
Are there any plans so support keyboard interactive login?
Currently I can add tryKeyboard: true
to the options but whenever I do so the script hangs.
This might be an issue with scp2, but I'm not sure.
Do you have a test case for this?
Password prompt if ssh agent is set
Would be beneficial in larget projects to only upload the changed files using grunt-newer.
When I missed the cwd
option, I got a error:
Arguments to path.resolve must be strings Use
And after I add the cwd
option, the error is gone.
before:
scp: { options: { }, beta: { files: [{ src: 'newer/**', filter: 'isFile', dest: '/home/cdn/test' }] }, },
after:
scp: { options: { }, beta: { files: [{ cwd:'newer', src: '**', filter: 'isFile', dest: '/home/cdn/test' }] }, },
I want to be able to use this with already authorised keys.
I can SSH to my server just fine but not 100% sure how to use this without specifying either the password or the privateKey in the config. Is there a way to get it to use OSX's default ssh config?
scp: {
options: {
host: 'host',
port: 22,
username: 'root',
privateKey: grunt.file.read('/Users/nblasgen/.ssh/id_dsa')
}, ...
}
If I run the task without a passphrase, I get:
Fatal error: Encrypted private key detected, but no passphrase given
If I change the passphrase to null, same error. If I change it to "" (empty string) I get:
Fatal error: Unable to parse private key while generating public key (expected sequence)
Any ideas? I've googled quite a bit.
There is a problem with file resolvings in upload method if you set standard grunt's files' config
expand: true
. Files are then uploaded to path eg.
mkdir /kernel/services/console.js
mkdir /kernel/services/console.js/services
write /kernel/services/console.js/services/console.js
for config
{
expand: true,
filter: 'isFile',
cwd: 'build/kernel',
src: '**/*',
dest: 'kernel/'
}
And filter filter: 'isFile'
is needed to be configured, which is not clearly said why to do it.
升级后,没改动任何代码,报错。
write path/to/foo.js/foo.js
只存在 path/to/foo.js
这个文件,现在路径莫名重复了文件名
I want to deploy the same file to two different locations: Dev and UAT. So I define a task as such:
scp : {
dev: {
options : {
host : 'myip',
username : 'username',
password : 'password'
},
your_target: {
files: [{
cwd: '<% yeoman.exports %>',
src: 'exports/my.war',
//filter: 'isFile',
// path on the server
dest: '/full/path/to/location/'
}]
}
}
}
Which doesn't work when I call scp:dev
When I remote the dev object and call scp
it works fine.
Is this an issue or am I using incorrectly?
I see on the documentation :
Copy files to remote server
But is it possible to use it to download a file from the server ?.
I am wanting to use the latest code which has keyboard interactivity when you put password as true. It doesn't seem that the NPM is pulling the latest code. As I am not as familiar with NPM and Plugin interaction is there a missing step that would make sure NPM pulls the latest code?
Having a private key hardwired into a gruntfile seems to me to be a really bad idea. I think you need an option that specifies a key file to read.
When transfering big files, it's hard (if not impossible) to know if a transfer has stalled or is working. Being able to enable a feedback on the file transfer would be great.
Running "scp:instance_1" (scp) task
.ssh connect 33.33.33.60
write /var/deploy/my-app.zip
ssh close 33.33.33.60
Done, without errors.
could be
Running "scp:instance_1" (scp) task
.ssh connect 33.33.33.60
write /var/deploy/my-app.zip.................................
ssh close 33.33.33.60
Done, without errors.
And on the config side of things:
grunt.initConfig( {
scp: {
options: {
host: '33.33.33.60',
username: 'deploy',
privateKey: grunt.file.read('~/.ssh/id_dsa'),
feedback: true,
},
instance_1: {
files: [{
cwd: './',
src: 'my-app.zip',
filter: 'isFile',
// path on the server
dest: '/var/www/'
}]
},
},
})
I'm not sure if that's still something we're not able to do due to some limitation on https://github.com/mscdex/ssh2, if someone has a better understanding of the underlying api's please comment (I wouldn't be surprised if we can already enable it through some other option).
Hi,
I meet some problems when install the package with npm. The error information as following.
npm http GET https://registry.npmjs.org/grunt-scp
npm http GET https://registry.npmjs.org/grunt-scp
npm http GET https://registry.npmjs.org/grunt-scp
npm ERR! Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! at SecurePair.<anonymous> (tls.js:1370:32)
npm ERR! at SecurePair.EventEmitter.emit (events.js:92:17)
npm ERR! at SecurePair.maybeInitFinished (tls.js:982:10)
npm ERR! at CleartextStream.read [as _read] (tls.js:469:13)
npm ERR! at CleartextStream.Readable.read (_stream_readable.js:320:10)
npm ERR! at EncryptedStream.write [as _write] (tls.js:366:25)
npm ERR! at doWrite (_stream_writable.js:226:10)
npm ERR! at writeOrBuffer (_stream_writable.js:216:5)
npm ERR! at EncryptedStream.Writable.write (_stream_writable.js:183:11)
npm ERR! at write (_stream_readable.js:582:24)
npm audit reports several modules (inquirer, scp2) using old lodash < 4.17.11 causing Prototype Pollution warnings.
my gruntfile.js
is below
secret: grunt.file.readJSON('environment.json'),
scp: {
test:{
options: {
host: '<%= secret.server1.host %>',
username: '<%= secret.server1.username %>',
privateKey: '<%= grunt.file.read(secret.server1.privateKey) %>',
showProgress: true
// tryKeyboard: true
},
files: [{
cwd: './dist',
src: '**/*',
filter: 'isFile',
dest: '/path/to/folder/project.test'
}]
},
prod: {
options: {
host: '<%= secret.server2.host %>',
username: '<%= secret.server2.username %>',
privateKey: '<%= grunt.file.read(secret.server2.privateKey) %>',
tryKeyboard:true
},
files: [{
cwd: './dist',
src:'**/*',
dest:'/srv/www/vhosts/project'
}]
}
} `
when i try to deploy to test
i get following error
[31mFatal error: handle is not a Buffer��[39m
14:28:21
14:28:21
14:28:21 Execution Time (2014-11-12 01:25:31 UTC)
please help, Thanks
This module is incredibly useful to me, and I don't want to find an alternative. I'm happy to fork the code myself and help out, if someone can tell me what I need to do.
[email protected] is the latest version of Grunt that can be used with this module. That version of Grunt has out-of-date dependencies ([email protected]), which will be fully deprecated on node releases >= v7.0. Is there a reason why this package has a locked-in peer dependency? Any chance of it being updated for newer versions of Grunt?
it's doesn't work.
config.scp = {
"dev" : { "options" : {
"host" : "aa",
"username" : "set",
"password" : "set"
},
"upload" : {
"files" : [{
"cwd" : "./",
"src" : "set.zip",
"filter" : "isFile",
"dest" : "./"
}]
},
"live" : {}
}
grunt scp:dev:upload;
is there anything errors?
npm audit reports using old scp2 module < 3.0.2 causing "high" risk Regular Expression Denial of Service warnings.
It would be awesome to have support for SSH certificate auth. I'm interested in using Grunt to perform some configuration actions on the OpenShift PaaS. But it only allows certificate login.
I'd like the ability to configure the file permissions when I am SCP. Is this something that can be enhanced here or is there something else that needs to be done prior?
Using grunt-scp without a cwd
option in the files
configuration produces the following warning:
$ grunt -vvv
...
Verifying property scp.upload exists in config...OK
Files: ... -> /opt/data
Options: host="example.org", username="root", password="password"
Warning: Arguments to path.resolve must be strings Use --force to continue.
Aborted due to warnings.
I had thought that doing the following with src: 'build/*'
should be okay:
scp: {
options: {
host: 'example.org',
username: 'root',
password: 'password'
},
upload: {
files: [
{src: 'build/*', dest: '/opt/data'}
]
}
}
Seems the issue is https://github.com/spmjs/grunt-scp/blob/master/tasks/scp.js#L81, where fileObj.cwd
and fileObj.orig.cwd
are both undefined.
Using grunt 0.4.5, grunt-scp 0.1.7, npm 1.4.21 and Node v0.10.25.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.