rupl

1.1.3 • Public • Published

RUPL

RSync UPLoader

NPM Version NPM Downloads

What?

RUPL is a file uploader which will synchronize a remote folder with the contents of a local one.

Disclaimer

RUPL uploads files to your server - if they are older than those on your local machine they will get overwritten. This is not source control, it is a syncing mechanism.

Why?

  • It gives you a single-word command to upload all your changed files to your server
  • no need for messy FTP
  • secure
  • fast
  • only uploads changes
  • allows you to exclude files and folders

Requirements

RUPL uses SCP, which needs a ssh connection. As of now this must come in the form of a ~/.ssh/config entry. If you don't have any of these then check out this page.

Once you have your ssh config file populated RUPL will be able to find your servers.

How?

  1. Install the node CLI rupl module (npm install rupl -g)
  2. Go to the root of your project folder and run rupl
  3. The first time you run it RUPL will take you through setting up the config file (./rupl.json)
  4. After that whenever you run it RUPL will upload any files that have changed
  5. So, make some changes, run RUPL and your site will match your local folder
# install rupl
npm install rupl -g

# run it
rupl
# rupl will then update your server with any changes in your local project

rupl.json

RUPL will create a config file called rupl.json in the same folder that you first run it. Here is an example:

{
    "default":{
        "ssh":"myserver",
        "targetDir":"/var/www/html/mysite",
        "exclude":[
            ".git",
            "rupl.json",
            ".*",
            "private",
            "public",
            "node_modules"
        ]
    }
}

Note that the entries are written in a default object - this is for future when we add multiple setups in one config file, but for now there is only one root-level option called default. It's all self-explanatory but in case it's not here are the options:

  • ssh: The config Host entry for your ssh connection
  • targetDir: the root dir of your project (on the server). Note that this can be an absolute path (starting /) or a relative path (relative to the home directory of your ssh login) if it doesn't start with a /.
  • exclude: array of items that will be excluded. Feel free to edit this list, it will get filled with some defaults to start.
  • prune: boolean, if true then runs with --delete option which will remove items from the server that don't exist locally
  • runAfter: [optional], run a single command on the server (through the same ssh connection) after upload

Using include instead of exclude

If you want to sync only a certain number of folders or files rather than excluding them then this can be acheived using include. However, thanks to the quirk of rsync any folders need to be followed by 3 * symbols. Not sure why at this stage but if you search for rsync include you'll see that it works well.

Note that right now include and exclude are exclusive so pick one or the other. If you use include then any exclude params will be ignored.

In this example below we want to sync the contents of dir1 and dir2 and a couple of files.

{
    "default":{
        "ssh":"myserver",
        "targetDir":"/var/www/html/mysite",
        "include":[
            "dir1/***",
            "dir2/***",
            "file1.txt",
            "file2.txt"
        ]
    }
}

Enjoy RUPL, please note that it comes with no guarantees or warranties, use it at your own risk. It uses the rsync command with the -av parameters. For more information see http://linux.die.net/man/1/rsync.

Readme

Keywords

none

Package Sidebar

Install

npm i rupl

Weekly Downloads

1

Version

1.1.3

License

ISC

Last publish

Collaborators

  • dogfish