Git Product home page Git Product logo

webdav-sync's Introduction

webdav-sync

Sync a local directory with a WebDAV server.

This tool was created because I wanted an alternative method to work with the Demandware e-commerce platform without requiring their IDE UX Studio which uses WebDAV to push the code to the development server.

Dependencies

This applications requires a local copy of curl.

Installation

npm install webdav-sync

Usage

From the command line

Show help:

webdav-sync -h

Options:
  --remote_base  URL for the remote endpoint            [required]
  --local_base   Path to the local directory            [required]
  --username     Username for secure login              [optional]
  --password     Password for secure login              [optional]
  --curl         Default curl command                   [default: "curl --insecure -s -S"]
  --ignored      Comma separated list of ignored paths  [default: ".hg,.git,.svn,.DS_Store"]
  --verbose      Makes webdav-sync more talkative with complete curl command and timestamp
  --help, -h     Displays this help

Syncing /var/src/code with https://user:[email protected]/webdav/cartridge/

webdav-sync --local_base /var/src/code --remote_base "https://user:[email protected]/webdav/"

From node.js

You can also include webdav-sync into your node app

var options = {
    local_base: "/var/src/code",
    remote_base: "https://user:[email protected]/webdav/",
    username: "option@lUsern@me",
    password: "option@lP@ssword"
};
var sync = (require('webdav-sync'))(options);
sync.start();

Change log

  • 0.1.1: First release
  • 0.2.4: Upgrading to node 0.6.x
  • 0.3.0: Cleanup and --verbose flag added
  • 0.4.0: Minor update due to change in stdout: File transfer fixes, connection test, transfer status icons
  • 0.4.4: Added options --username & --password as option for secure login (useful for problematic usernames/passwords with special characters...)
  • 0.5.0: Updated npm dependencies

TODO

License

(The MIT License)

Copyright (c) 2015 Bermi Ferrer <[email protected]>

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.

webdav-sync's People

Contributors

benredvan avatar bensmoif avatar bermi avatar lone-star avatar marcelkottmann avatar mobiushorizons avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webdav-sync's Issues

User management for webdav-sync

Hi,
We would like to implement user management for the webdav-sync.
It means that every user that login to the system will be able to browse to separate directories.
In addition to manage set of users.

Which component / tool / code we can use for this.

Thank you,
Moshe

Remove curl dependency

webdav-sync relies very tightly on command-line curl. We'd like to remove that dependency and have a built in async push and pull that does not require calls to curl.

/bin/sh undefined command not found

I get the following on OSX when I use this:

# node index.js
util.puts: Use console.log instead

util.puts: Use console.log instead

util.puts: Use console.log instead
STARTING
webdav-sync from /Users/someone/webdav-test/test
to https://user:[email protected]/some/path
util.puts: Use console.log instead
○ [CONNECTION TEST]
■til.print: Use console.log instead
util.puts: Use console.log instead
/bin/sh: undefined: command not found

2 way sync?

Is this syncing files both ways? Local->remote and remote->local? Or is it unidirectional?

Mandatory fields in node script

TL;DR: When using in a node script, some options will be required, although they shouldn't be.

Explanation:

Script 1
Here is my script:

var options = {
    local_base: "base",
    remote_base: "http://localhost:1234/location",
    username: "admin",
    password: "admin",
}; 
var sync = webdavSync(options);  

When running I get:

■ [CONNECTION TEST]
/bin/sh: undefined: command not found

The program will exit as soon as there is a file to sync

Script 2
Here is my script:

var options = {
    local_base: "base",
    remote_base: "http://localhost:1234/location",
    username: "admin",
    password: "admin",
    curl: 'curl --insecure -s -S'
}; 
var sync = webdavSync(options);  

When running I get:

■ [CONNECTION TEST]

The program will exit as soon as there is a file to sync

.../lone-star/.../node_modules/webdav-sync/lib/webdav_sync.js:195
    return __indexOf.call(options.ignored, path) >= 0;

Script 3
Here is my script:

var options = {
    local_base: "base",
    remote_base: "http://localhost:1234/location",
    username: "admin",
    password: "admin",
    curl: 'curl --insecure -s -S',
    ignored: ''
}; 
var sync = webdavSync(options);  

When running I get:

■ [CONNECTION TEST]

The program will successfully sync.

Feature: Debounce uploads

My dev processes involves running through a Grunt build before all the files are ready to get uploaded. The Grunt build creates (and modifies) the same files more than once in quick succession. It would be great to have the sync process debounce it's upload, to wait for Grunt to finish it's stuff.

Is recursive folders sync supported?

Hi, thanks for building webdav-sync. It seems for current NPM version recursive sync is not working for me. Test case.

  1. Create nested folder:

     ➜  Desktop mkdir folder0
     ➜  Desktop mkdir folder0/subfolder{0,1,2}
     ➜  Desktop touch folder0/subfolder{0,1,2}/file{0,1,2}
     ➜  Desktop tree folder0
     folder0
     ├── subfolder0
     │   ├── file0
     │   ├── file1
     │   └── file2
     ├── subfolder1
     │   ├── file0
     │   ├── file1
     │   └── file2
     └── subfolder2
         ├── file0
         ├── file1
         └── file2
    
  2. Move folder to syncable dir:

     ➜  Desktop ls ~/files/
     ➜  Desktop mv folder0 ~/files
     ■ [created] /folder0
     Mon Dec 05 2016 12:15:02 GMT+0300 (MSK)
     curl --insecure -s -S -u [email protected]:password -X MKCOL "https://server.com/folder0"  --verbose
     *   Trying 127.0.0.1...
     * Connected to server.com (127.0.0.1) port 443 (#0)
     * TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
     * Server certificate: *.server.com
     * Server certificate: DigiCert SHA2 Secure Server CA
     * Server certificate: DigiCert Global Root CA
     * Server auth using Basic with user '[email protected]'
     > MKCOL /folder0 HTTP/1.1
     > Host: server.com
     > Authorization: Basic xxxxxx====
     > User-Agent: curl/7.49.1
     > Accept: */*
     >
     < HTTP/1.1 201 Created
     < Server: nginx
     < Date: Mon, 05 Dec 2016 09:15:03 GMT
     < Content-Type: application/octet-stream
     < Content-Length: 0
     < Connection: keep-alive
     < X-Request-Id: web6-3359141-1480929302-39
     < X-Request-Id: web6-3359141-1480929302-40
     < Location: https://server.com/folder0
     < Pragma: no-cache
     < Cache-Control: no-cache
     < X-Frontend: frontend2
     < X-UA-Compatible: IE=edge,chrome=1
     <
     * Connection #0 to host server.com left intact
    
  3. Listing remote directory:

     ➜  Desktop tree /Volumes/server.com/folder0
     /Volumes/server.com/folder0
    
     0 directories, 0 files
    

¯_(ツ)_/¯

macOS 10.12, webdav-sync 0.5.0

Thanks!

Please publish current version to npm

Hello, when do you plan to publish the current version to npm? Our team has still issues because of
#14
when using the version which is published in npm (0.4.4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.