Skip to content

Commit cfab06c

Browse files
author
Caleb Land
committed
initial commit
0 parents  commit cfab06c

File tree

9 files changed

+218
-0
lines changed

9 files changed

+218
-0
lines changed

.bnsignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# The list of files that should be ignored by Mr Bones.
2+
# Lines that start with '#' are comments.
3+
#
4+
# A .gitignore file can be used instead by setting it as the ignore
5+
# file in your Rakefile:
6+
#
7+
# PROJ.ignore_file = '.gitignore'
8+
#
9+
# For a project with a C extension, the following would be a good set of
10+
# exclude patterns (uncomment them if you want to use them):
11+
# *.[oa]
12+
# *~
13+
announcement.txt
14+
coverage
15+
doc
16+
pkg

History.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
== 1.0.0 / 2009-03-18
2+
3+
* 1 major enhancement
4+
* Birthday!

README.txt

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
rbsync
2+
by Caleb Land
3+
http://www.github.com/caleb/rbsync
4+
5+
== DESCRIPTION:
6+
7+
RBSync is a thin Ruby wrapper around rsync. It removes the string building
8+
from calling rsync from ruby.
9+
10+
== FEATURES/PROBLEMS:
11+
12+
* RBSync is a thin wrapper, so as to expose as much of rsync's power
13+
as possible
14+
* RBSync does, however, require that rsync be installed
15+
16+
== SYNOPSIS:
17+
18+
RBSync has a convenience class which makes it easy to sync with rsync's
19+
archive (-a) flag:
20+
21+
import 'rubygems'
22+
import 'rbsync'
23+
24+
# Builds a usable rsync command using the -a (archive) flag to rsync
25+
rsync = RBSync::RBSync.new '/mysite/', '[email protected]:/var/www/mysite'
26+
rsync.archive!
27+
rsync.sync
28+
29+
If you want more control, you could specify each flag separately. This command
30+
is equivalent to the one above:
31+
32+
rsync = RBSync::RBsync.new '/mysite/', '[email protected]:/var/www/mysite'
33+
# turns on rsync's delete flag (--delete)
34+
rsync.delete!
35+
rsync.recursive!
36+
rsync.links!
37+
rsync.perms!
38+
rsync.times!
39+
rsync.group!
40+
rsync.owner!
41+
rsync.devices!
42+
rsync.specials!
43+
rsync.sync
44+
45+
You can even use the archive flag and turn off those flags which you don't want:
46+
rsync = RBSync::RBsync.new '/mysite/', '[email protected]:/var/www/mysite'
47+
rsync.archive!
48+
49+
# turn off the times (--times) flag
50+
~ rsync.times!
51+
52+
# turn off the devices (--devices) flag
53+
rsync.devices = false
54+
55+
rsync.sync
56+
57+
== REQUIREMENTS:
58+
59+
* Ruby >= 1.8.7
60+
61+
== INSTALL:
62+
63+
* sudo gem install rbsync
64+
65+
== LICENSE:
66+
67+
(The MIT License)
68+
69+
Copyright (c) 2009
70+
71+
Permission is hereby granted, free of charge, to any person obtaining
72+
a copy of this software and associated documentation files (the
73+
'Software'), to deal in the Software without restriction, including
74+
without limitation the rights to use, copy, modify, merge, publish,
75+
distribute, sublicense, and/or sell copies of the Software, and to
76+
permit persons to whom the Software is furnished to do so, subject to
77+
the following conditions:
78+
79+
The above copyright notice and this permission notice shall be
80+
included in all copies or substantial portions of the Software.
81+
82+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
83+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
84+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
85+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
86+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
87+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
88+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Rakefile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Look in the tasks/setup.rb file for the various options that can be
2+
# configured in this Rakefile. The .rake files in the tasks directory
3+
# are where the options are used.
4+
5+
begin
6+
require 'bones'
7+
Bones.setup
8+
rescue LoadError
9+
begin
10+
load 'tasks/setup.rb'
11+
rescue LoadError
12+
raise RuntimeError, '### please install the "bones" gem ###'
13+
end
14+
end
15+
16+
ensure_in_path 'lib'
17+
require 'rbsync'
18+
19+
task :default => 'spec:run'
20+
21+
PROJ.name = 'rbsync'
22+
PROJ.authors = 'Caleb Land'
23+
PROJ.email = '[email protected]'
24+
PROJ.url = 'http://www.github.com/caleb/rbsync'
25+
PROJ.version = RBSync::VERSION
26+
PROJ.rubyforge.name = 'rbsync'
27+
28+
PROJ.spec.opts << '--color'
29+
30+
# EOF

bin/rbsync

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env ruby
2+
3+
require File.expand_path(
4+
File.join(File.dirname(__FILE__), %w[.. lib rbsync]))
5+
6+
# Put your code here
7+
8+
# EOF

lib/rbsync.rb

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
2+
module RBSync
3+
4+
# :stopdoc:
5+
VERSION = '1.0.0'
6+
LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
7+
PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
8+
# :startdoc:
9+
10+
# Returns the version string for the library.
11+
#
12+
def self.version
13+
VERSION
14+
end
15+
16+
# Returns the library path for the module. If any arguments are given,
17+
# they will be joined to the end of the libray path using
18+
# <tt>File.join</tt>.
19+
#
20+
def self.libpath( *args )
21+
args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
22+
end
23+
24+
# Returns the lpath for the module. If any arguments are given,
25+
# they will be joined to the end of the path using
26+
# <tt>File.join</tt>.
27+
#
28+
def self.path( *args )
29+
args.empty? ? PATH : ::File.join(PATH, args.flatten)
30+
end
31+
32+
# Utility method used to require all files ending in .rb that lie in the
33+
# directory below this file that has the same name as the filename passed
34+
# in. Optionally, a specific _directory_ name can be passed in such that
35+
# the _filename_ does not have to be equivalent to the directory.
36+
#
37+
def self.require_all_libs_relative_to( fname, dir = nil )
38+
dir ||= ::File.basename(fname, '.*')
39+
search_me = ::File.expand_path(
40+
::File.join(::File.dirname(fname), dir, '**', '*.rb'))
41+
42+
Dir.glob(search_me).sort.each {|rb| require rb}
43+
end
44+
45+
end # module RBSync
46+
47+
RBSync.require_all_libs_relative_to(__FILE__)
48+
49+
# EOF

spec/rbsync_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
require File.join(File.dirname(__FILE__), %w[spec_helper])
3+
4+
describe RBSync do
5+
end
6+
7+
# EOF

spec/spec_helper.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
require File.expand_path(
3+
File.join(File.dirname(__FILE__), %w[.. lib rbsync]))
4+
5+
Spec::Runner.configure do |config|
6+
# == Mock Framework
7+
#
8+
# RSpec uses it's own mocking framework by default. If you prefer to
9+
# use mocha, flexmock or RR, uncomment the appropriate line:
10+
#
11+
# config.mock_with :mocha
12+
# config.mock_with :flexmock
13+
# config.mock_with :rr
14+
end
15+
16+
# EOF

test/test_rbsync.rb

Whitespace-only changes.

0 commit comments

Comments
 (0)