Capistrano::Configuration::Actions::FileTransferExt
A sort of utilities which helps you transferring files with Capistrano.
Installation
Add this line to your application's Gemfile:
gem 'capistrano-file-transfer-ext'
And then execute:
$ bundle
Or install it yourself as:
$ gem install capistrano-file-transfer-ext
Usage
Add require line in your Capfile or config/deploy.rb or so.
require "capistrano/configuration/actions/file_transfer_ext"
Now you can use them in your tasks.
-
safe_upload- Transfers a file from the local host to multiple remote hosts. (more...) -
safe_put- Store the contents of multiple servers. (more...) -
transfer_if_modified- Transfer files from/to remote servers only if they are different. (more...) -
install- Install files on remote servers. (more...) -
install_if_modified- Install files on remote servers only if they are different. (more...)
Reference
safe_upload
Definition
safe_upload(from, to, options={}, &block)
Module
Capistrano::Configuration::Actions::FileTransferExt
The safe_upload acts like almost as same as upload, but with some little enhancements.
- overwrite remote file only if transmission has been successfully completed.
- (if you request) overwrite remote file only if the checksums are different.
Arguments
from
Thie may be either a String, or an IO object (e.g. an open file handle, or a StringIO instance).
to
This must be a string indicating the path on the remote server that should be uploaded to.
options
All of the options of upload are sensible. In addition, there are some extra options.
-
:installIt must be either:always(the default), or:if_modified. If:if_modifiedis given, install the file only if the checksums are different. -
:digestThis is a symbol indicating which algorithm should be used to calculate the checksum of files.:md5is default. -
:digest_cmdThe command to calculate checksum of files.md5sumis default. -
:run_methodspecify the method to run commands.:runby default. you may need to set this value as:sudoif you want to overwrite system files.
safe_put
Definition
safe_put(data, to, options={})
Module
Capistrano::Configuration::Actions::FileTransferExt
The safe_put action is safe_upload's little brother.
Arguments
data
This is a string containing the contents of the file you want to upload.
to
This is a string naming the file on the remote server(s) that should be created (or overwritten) with the given data.
options
All of the options of safe_upload are sensible.
transfer_if_modified
Definition
transfer_if_modified(direction, from, to, options={}, &block)
Module
Capistrano::Configuration::Actions::FileTransferExt
The transfer_if_modified action is transfer's senior brother.
Transfer files from/to remote servers only if they are different.
Arguments
direction
The direction of transfer. :up or :down is sensible.
from
Thie may be either a String, or an IO object (e.g. an open file handle, or a StringIO instance).
to
This must be a string indicating the path on the remote server that should be uploaded to.
options
All of the options of transfer are sensible. In addition, there are some extra options.
-
:digestThis is a symbol indicating which algorithm should be used to calculate the checksum of files.:md5is default. -
:digest_cmdThe command to calculate checksum of files.md5sumis default.
install
Definition
install(from, to, options={}, &block)
Module
Capistrano::Configuration::Actions::FileTransferExt
Install files on remote servers. This method acts like mv, but with little enhancements.
Arguments
from
This must be a string indicating the path on the remote server that should be installed from.
to
This must be a string indicating the path on the remote server that should be installed to.
options
-
:viaspecify the method to run commands.:runby default. you may need to set this value as:sudoif you want to overwrite system files. -
:modeThe mode of destination file. If:preserveis given, preserve original mode ofto. -
:ownerThe owner of destination file. If:preserveis given and:viais:sudo, preserve original owner ofto. -
:groupThe group of destination file. If:preserveis given and:viais:sudo, preserve original group ofto.
install_if_modified
Definition
install_if_modified(from, to, options={}, &block)
Module
Capistrano::Configuration::Actions::FileTransferExt
The install_if_modified action is install's senior brother.
Install files on remote servers only if they are different.
Arguments
from
This must be a string indicating the path on the remote server that should be installed from.
to
This must be a string indicating the path on the remote server that should be installed to.
options
-
:viaspecify the method to run commands.:runby default. you may need to set this value as:sudoif you want to overwrite system files. -
:modeThe mode of destination file. If not given, preserve original mode ofto. -
:ownerThe owner of destination file. If not given and:viais:sudo, preserve original owner ofto. -
:groupThe group of destination file. If not given and:viais:sudo, preserve original group ofto. -
:digestThis is a symbol indicating which algorithm should be used to calculate the checksum of files.:md5is default. -
:digest_cmdThe command to calculate checksum of files.md5sumis default.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Added some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
Author
- YAMASHITA Yuu (https://github.com/yyuu)
- Geisha Tokyo Entertainment Inc. (http://www.geishatokyo.com/)
License
MIT