Skip to content

Small tool for synchronizing local files with remote server (based on ssh) or Alfresco (based on http)

License

Notifications You must be signed in to change notification settings

bms-devs/FileSynchronizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FileSynchronizer

Build Status Coverage Status

File synchronization tool for ssh and Alfresco


Purpose

This little app helps you with keeping your local files synchronized with remote files available either through ssh protocol or through Alfresco API. We use it mainly during development of other apps, but you could use to synchronize whatever you want.

Prerequisites

Building

To build the application you need sbt. You can download it from http://www.scala-sbt.org/download.html website, or you can just find sbt in your favourite package manager (apt-get, yum or other).

Application works on JVM, so you still need to have Java Development Kit (JDK) installed. Application should compile on JDK version 1.7+, that can be found here

Runing

To run the application you just need to install JRE version 1.7+. If you don't have it go to download page.

Running tests

Application tests are using ScalaTest. It's fully integrated with sbt, so to run all tests write:

sbt test

Building

To build fat-jar with all the application's dependencies we're using sbt-assembly plugin. The usage is pretty straightforward. To build the app you just need to write:

sbt assembly

Configuring

The application's configuration is by default placed in config.json file (filename can be changed with -c or --config argument). Here's the purpose of all application's properties:

  • connection
    • url - Host url (either ssh host or Alfresco host and port in http://host:port/ format)
    • login - User's login
    • password - User's password
  • sourceRoot - path of local directory inside which all the synchronized file will be located. This directory files and directories specified in next properties will be synchronized with remote host
  • destinationRoot - path of remote directory (ssh) or node ref (Alfresco) of folder which can be mapped to sourceRoot local directory. Depending on this field, the application will upload files through ssh or http using Alfresco API.
  • files - list of all the file to keep synchronized
  • directories - list of all the directories to keep synchronized

Here is the example configuration for ssh host:

{
  "connection": {
    "login": "root",
    "password": "password123",
    "url": "192.168.253.177"
  },
  "sourceRoot": "/home/bms/project/",
  "destinationRoot": "/opt/tomcat/webapps/project/",
  "files": [
    "WEB-INF/main.jsp"
  ],
  "directories": [
    "resources/js/"
  ]
}

And here is the example configuration for Alfresco repository:

{
  "connection": {
    "login": "admin",
    "password": "admin",
    "url": "http://localhost:8080"
  },
  "sourceRoot": "/home/bms/project/scripts/",
  "destinationRoot": "workspace://SpacesStore/17855f47-ef83-4eeb-b9f0-a41f07ab6cac",
  "files": [
    "start.js"
  ],
  "directories": [
    "controllers/"
  ]
}

Running

To run the application you have to execute jar which after build process will be available in target/scala-2.11/ folder. The jar filename will have FileSynchronizer-assembly-{version}.jar format. To run it you have to execute following command:

java -jar target/scala-2.11/FileSynchronizer-assembly-{version}.jar {additional options}

Here is the table of all additional options available:

Option Effect
-h, --help Display help message
-w, --watch Turn on watch mode. Given files will be monitored and uploaded in case of change
-W, --upload-and-watch Upload all files first and then turn on watch mode
-c, --config {filename} Load config from file with a given name

About

Small tool for synchronizing local files with remote server (based on ssh) or Alfresco (based on http)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages