-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
lucas-caro
committed
Feb 20, 2017
0 parents
commit c550a24
Showing
6 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.DS_Store | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.git* | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Copyright (c) 2017 Lucas Caro | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# SFTP deployer | ||
|
||
Deploy your site via SFTP. | ||
|
||
## Install | ||
|
||
``` | ||
$ npm install hexo-deployer-sftp --save | ||
``` | ||
|
||
## Usage | ||
|
||
See https://hexo.io/docs/deployment.html | ||
|
||
## Warning | ||
|
||
This application will delete files and directories on the remote server to match the local machine. Use this application in production at your own risk. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
const deploy = require('sftp-sync-deploy') | ||
|
||
hexo.extend.deployer.register('sftp', function(args, callback){ | ||
if (!args.host || !args.user){ | ||
const help = [ | ||
'You should argsure deployment settings in _config.yml first!', | ||
'', | ||
'Example:', | ||
' deploy:', | ||
' type: sftp', | ||
' host: <host>', | ||
' port: [port] # Default is 21', | ||
' user: <user>', | ||
' pass: <pass> # leave blank for paswordless connections', | ||
' privateKey: [path/to/privateKey] # Optional', | ||
' passphrase: [passphrase] # Optional', | ||
' agent: [path/to/agent/socket] # Optional, defaults to $SSH_AUTH_SOCK', | ||
' remotePath: [remotePath] # Default is `/`', | ||
'', | ||
'For more help, you can check the docs: ' + 'http://hexo.io/docs/deployment.html'.underline | ||
] | ||
|
||
console.log(help.join('\n')) | ||
return callback() | ||
} | ||
|
||
const config = { | ||
host: args.host, | ||
port: args.port || 22, | ||
username: args.user, | ||
password: args.pass, | ||
privateKey: args.privateKey, | ||
passphrase: args.passphrase, | ||
agent: args.agent || process.env.SSH_AUTH_SOCK, | ||
localDir: hexo.public_dir, | ||
remoteDir: args.remotePath || '/' | ||
} | ||
|
||
const options = { | ||
dryRun: !!args.dryrun, | ||
// exclude: [ // exclude patterns (glob) | ||
// 'node_modules', | ||
// 'src/**/*.spec.ts' | ||
// ] | ||
} | ||
|
||
deploy(config, options).then(() => { | ||
callback() | ||
}).catch(err => { | ||
callback(err) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "hexo-deployer-sftp", | ||
"version": "0.0.1", | ||
"description": "SFTP deployer for Hexo", | ||
"main": "index", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/lucascaro/hexo-deployer-sftp.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/lucascaro/hexo-deployer-sftp/issues" | ||
}, | ||
"keywords": [ | ||
"hexo", | ||
"sftp", | ||
"sync", | ||
"deploy", | ||
"deployer" | ||
], | ||
"author": "Lucas Caro <lucascaro@gmail.com>", | ||
"license": "MIT", | ||
"dependencies": { | ||
"sftp-sync-deploy": "^0.4.3" | ||
} | ||
} |