Giter VIP home page Giter VIP logo

remote-test-refresh's Introduction

remote-test-refresh

Build Status Coverage Status Dependencies Status

Clojars Project

remote-test-refresh is a leiningen plugin which uses SSH to synchronize code changes between local and remote machine automatically. When running, remote-test-refresh will scan code resources in the local project for changes. When detecting change, remote-test-refresh will transfer it per ssh and apply it to the remote repository.

In summary, remote-test-refresh offer possibilities:

  • to synchronize code change between local and remote repository over ssh.
  • to run command (.i.e start application, run tests) in the project on the remote machine and stream its output to local machine.
  • to forward port between remote and local machine. It's useful to test application interactively.

This picture illustrates how remote-test-refresh leverages the SSH for synchronization:

     |----Local Machine----|        remote-test-refresh        |----Remote Machine---|  
     |                     |     <----------SSH---------->     |                     | 
     | +--parent-folder    |      + transfer code change       | +--parent-folder    | 
     |    +-- project-1    |      + port forwarding            |   +-- project-1     | 
     |    +-- project-2    |      + run command remotely       |   +-- project-2     | 
     |---------------------|                                   |---------------------|  
	                                                       

To configure remote-test-refresh, you can define :remote-test in your .lein/profiles.clj or in project.clj of the local project repository:

:remote-test {:user              "your-ssh-user"                ;required for ssh connection
		      :host              "host-name-or-ip"              ;required for ssh connection
		      :with-system-agent true                           ;required for ssh connection 
	          :remote-path       "repo/parent/folder/on/remote" ;required for sync code change
	          :forwarding-port   9001                           ;optional for port forwarding
	          :command           "lein run"                     ;optional for running cmd
	          :notify-command    ["terminal-notifier" "-title"] ;optional for notification
	         }

remote-path specifies the absolute path to the parent folder on remote machine. remote-test-refresh must know it, in order to apply code change to the remote repository correctly.

if :remote-test can not be found in the project.clj/profiles, remote-test-refresh will ask you all those parameters at the runtime.

If :with-system-agent is set to false, remote-test-refresh will use a separated ssh agent to connect to remote machine. In this case, remote-test-refresh will ask you for ssh authentication at the runtime.

#Notification

By defining :notify-command you will be notified every time code change has been transferred successfully to remote machine. Currently it's tested for Mac OSX and Ubuntu.

On Mac:

 # install terminal-notifier
 $ brew install terminal-notifier
:remote-test {:user "user"
              ...
              :notify-command  ["terminal-notifier" "-title" "Tests" "-message"]}

On Ubuntu:

 # install notify
 $ sudo apt-get install libnotify-bin
:remote-test {:user "user"
              ...
              :notify-command  ["notify-send" "Tests"]}

#Usage

To start remote-test-refresh :

$ lein remote-test-refresh
* Remote-Test-Refresh version: 0.1.8

* ==> Which command do you want to run on the repository of remote machine (optional): lein run  
* ==> Enter a port > 1023 if you need a port to be forwarded (optional): 8080

* Starting with the parameters: {:repo "repo", :user "user", :auth {:with-system-agent false, :password ***}, :host 1.2.3.4, :remote-path /folder/path/}
* Starting session with the parameters: {:username "user", :strict-host-key-checking :no, :password ***, :use-system-ssh-agent false}

* Change has been transferred successfully
  Application starting ...
...

Issues

If you have this problem under ubuntu when using system agent option:

 java.lang.UnsatisfiedLinkError: Unable to load library 'c': /usr/lib/x86_64-linux-gnu/libc.so: invalid ELF header

A solution could be:

$ cd /lib/x86_64-linux-gnu
$ sudo ln -s libc.so.6 libc.so

License

Copyright © 2016 Distributed under the Eclipse Public License version 1.0.

remote-test-refresh's People

Contributors

minhtuannguyen6868 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.