Module: Six::Repositories::Rsync
- Defined in:
- lib/six/rsync.rb,
lib/six/rsync-app.rb,
lib/six/rsync/lib.rb,
lib/six/rsync/base.rb,
lib/six/rsync/path.rb,
lib/six/rsync/options.rb,
lib/six/rsync/repository.rb,
lib/six/rsync/working_directory.rb
Defined Under Namespace
Classes: App, Base, Lib, Path, Repository, RsyncError, RsyncExecuteError, WorkingDirectory
Constant Summary collapse
- COMPONENT =
'six-rsync'
- VERSION =
'0.8.0'
- BASE_PATH =
Dir.pwd
- DATA_PATH =
File.join(HOME_PATH, COMPONENT)
- CONFIG_FILE =
File.join(DATA_PATH, 'config.yml')
- CONFIG =
config ? config : Hash.new
- DIR_RSYNC =
'.rsync'
- DIR_PACK =
File.join(DIR_RSYNC, '.pack')
- @@log =
Create loggers
Log4r::Logger.new(COMPONENT)
- @@host =
''
Class Method Summary collapse
-
.bare(rsync_dir, options = {}) ⇒ Object
open a bare repository.
-
.clone(repository, name, options = {}) ⇒ Object
clones a remote repository.
-
.convert(working_dir = '.', options = {}) ⇒ Object
Converts into repository.
- .host ⇒ Object
-
.init(working_dir = '.', options = {}) ⇒ Object
initialize a new rsync repository, defaults to the current working directory.
- .logger ⇒ Object
-
.open(working_dir, options = {}) ⇒ Object
open an existing rsync working directory.
- .parse_options ⇒ Object
Class Method Details
.bare(rsync_dir, options = {}) ⇒ Object
open a bare repository
this takes the path to a bare rsync repo it expects not to be able to use a working directory so you can’t checkout stuff, commit things, etc. but you can do most read operations
73 74 75 |
# File 'lib/six/rsync.rb', line 73 def self.(rsync_dir, = {}) Base.(rsync_dir, ) end |
.clone(repository, name, options = {}) ⇒ Object
clones a remote repository
options
:bare => true (does a bare clone)
:repository => '/path/to/alt_rsync_dir'
:index => '/path/to/alt_index_file'
example
Rsync.clone('rsync://repo.or.cz/ruby', 'clone', :bare => true)
115 116 117 |
# File 'lib/six/rsync.rb', line 115 def self.clone(repository, name, = {}) Base.clone(repository, name, ) end |
.convert(working_dir = '.', options = {}) ⇒ Object
Converts into repository
92 93 94 |
# File 'lib/six/rsync.rb', line 92 def self.convert(working_dir = '.', = {}) Base.convert(working_dir, ) end |
.host ⇒ Object
19 20 21 |
# File 'lib/six/rsync-app.rb', line 19 def host @@host end |
.init(working_dir = '.', options = {}) ⇒ Object
initialize a new rsync repository, defaults to the current working directory
options
:repository => '/path/to/alt_rsync_dir'
:index => '/path/to/alt_index_file'
101 102 103 |
# File 'lib/six/rsync.rb', line 101 def self.init(working_dir = '.', = {}) Base.init(working_dir, ) end |
.logger ⇒ Object
15 16 17 |
# File 'lib/six/rsync-app.rb', line 15 def logger @@log end |
.open(working_dir, options = {}) ⇒ Object
open an existing rsync working directory
this will most likely be the most common way to create a rsync reference, referring to a working directory. if not provided in the options, the library will assume your rsync_dir is in the default place (.rsync/)
options
:repository => '/path/to/alt_rsync_dir'
:index => '/path/to/alt_index_file'
87 88 89 |
# File 'lib/six/rsync.rb', line 87 def self.open(working_dir, = {}) Base.open(working_dir, ) end |
.parse_options ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/six/rsync/options.rb', line 11 def todo = [] #, general_todo, second_todo = [], [], [] = Hash.new OptionParser.new do |opts| $0[/.*\/(.*)/] opts. = "Usage: #{$1} [folder] [options]" opts.on("-v", "--[no-]verbose", "Run verbosely") do |v| [:verbose] = v end opts.on("-i", "--init", "Initializes Repository") do |bool| todo << :init if bool end opts.on("-s", "--status", "Status of Repository") do |bool| todo << :status if bool end opts.on("-u", "--update", "Updates Repository") do |bool| todo << :update if bool end opts.on("-c", "--commit", "Commits changes to Repository") do |bool| todo << :commit if bool end opts.on("-n", "--convert", "Converts into repository") do |bool| todo << :convert if bool end opts.on("--clone S", String, "Clones a Repository") do |s| todo << :clone @@host = s end opts.on("-o", "--info", "Shows information from repository") do |bool| todo << :info end opts.on("-l", "--log", "Write logfile") do |bool| [:logging] = bool if bool end end.parse! [, todo] end |