Module: RakeDeployLib
- Defined in:
- lib/rake_deploy_lib.rb,
lib/rake_deploy_lib/version.rb
Overview
RakeDeployLib includes methodes for deploying und syncing files to a remote host. The Gem depends on rsync! The OS (Operating System) needs support for the rsync command (e.q. Linux, Unix, OS X).
-
deploy = transfare local (repository) files to remote server
-
sync = transfare remote server files to local (repository)
Constant Summary collapse
- VERSION =
"0.1.2"
Class Method Summary collapse
-
.deploy(local, user, host, remote, excludes) ⇒ Object
Deploys local (repository) files, excepts excludes, to the remote server.
Class Method Details
.deploy(local, user, host, remote, excludes) ⇒ Object
Deploys local (repository) files, excepts excludes, to the remote server. Please be aware, that files will be deleted at remote host, if they don’t exist local! With excludes you are able to prevent deletion.
-
local (mendetory) - directory relative to the project root without / (slash) at the end.
-
user (mendetory) - ssh user name at the remote server. Use of ssh certificate authentication is recommanded.
-
host (mendetory) - server domain like example.com
-
remote (mendetory) - absolute directory path without / (slash) at the end.
-
excludes (optional) - an arrey of files or directories to exclude.
-
Files: e.g. “myfile.txt” or “.gitignore”
-
Directories: e.g. “mydirectory/” be aware of the trailing / (slash)
-
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/rake_deploy_lib.rb', line 18 def RakeDeployLib.deploy(local, user, host, remote, excludes) if (!local || !user || !host || !remote) return false end cmd_rsync = "rsync -rz --delete " cmd_exclude = "" if excludes excludes.each do |to_exclude| cmd_exclude = "#{cmd_exclude}--exclude=#{to_exclude} " end cmd_rsync = "#{cmd_rsync}#{cmd_exclude}" end if (system "#{cmd_rsync}#{local}/ #{user}@#{host}:#{remote}/") return true else return false end end |