GithubHelp home page GithubHelp logo

wrapsync2's Introduction

w(r)ap(sync) 2

wrapsync2 is a wrapper script for rsync and a Python rewrite of wrapsync. Its main purpose is to simplify rsync'ing common directories.

Setup and usage

Manual setup

  1. Rename config.example.json to config.json.

  2. Prepare the variables inside the config file.

    Required:

    • username – SSH login.
    • domain – full URL at which the SSH port is exposed.
    • remote-path – an absolute path to the remote directory containing everything we may want to sync.
    • local-path – an absolute path to the local directory containing everything we may want to sync.

    Optional:

    • flagsrsync flags; if no flags are given, this option will be omitted.
    • exclude – an array of patterns of file names/directory names; what matches these patterns will be excluded from syncing; defaults to no exclusions.

    Example config:

    • The SSH username is georgesmith.
    • The SSH URL is ssh-example.com.
    • The absolute path to the parent directory of all the directories/projects we may want to rsync on the remote machine is /home/george/services.
    • The local equivalent is /Users/george/services.
    • The rsync flags we need are -a and -P.
    • And George wants to exclude node_modules directory and all *.jar files from syncing.
    "username": "georgesmith",
    "domain": "ssh-example.com",
    "remote-path": "/home/george/services",
    "local-path": "/Users/george/services",
    "flags": "aP",
    "exclude": ["node_modules", "*.jar"]
  3. Run the script.

    cd wrapsync2
    ./wrapsync2 <push/pull/help> <dir_name> [rsync_options]
    
    # Examples:
    ./wrapsync2 push my-first-python-project --update
    ./wrapsync2 pull my-second-python-project --delete
  4. (Optional) For convenience, create a symlink to the script.

    cd wrapsync2
    ln -s "$(pwd)/wrapsync2.py" /usr/local/bin/ws

    Now the script can be used from anywhere:

    ws <pull/push/help> <dir_name> [options]
    
    # Examples:
    ws push linux --update
    ws pull windows --delete

Unit tests

  1. Install Pytest.

    pip3 install -U pytest
  2. Run the tests.

    python3 -m pytest
    
    # Or simply:
    pytest

Linting

  1. Install Flake8.

    pip3 install flake8
  2. Run the linter manually.

    flake8
  3. Or, integrate the linter with the editor.

    VS Code-specific instructions: https://code.visualstudio.com/docs/python/linting

wrapsync2's People

Contributors

amrwc avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

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.