rsync 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -15,3 +15,5 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ test.rb
19
+ test.txt
@@ -1,9 +1,11 @@
1
1
  require "rsync/version"
2
2
  require "rsync/command"
3
3
  require "rsync/result"
4
+ require 'rsync/configure'
4
5
 
5
6
  # The main interface to rsync
6
7
  module Rsync
8
+ extend Configure
7
9
  # Creates and runs an rsync {Command} and return the {Result}
8
10
  # @param source {String}
9
11
  # @param destination {String}
@@ -11,6 +13,7 @@ module Rsync
11
13
  # @return {Result}
12
14
  # @yield {Result}
13
15
  def self.run(source, destination, args = [], &block)
16
+ destination = "#{self.host}:#{destination}" if self.host
14
17
  result = Command.run(source, destination, args)
15
18
  yield(result) if block_given?
16
19
  result
@@ -0,0 +1,13 @@
1
+ module Rsync
2
+ module Configure
3
+ VALID_OPTION_KEYS = [
4
+ :host
5
+ ].freeze
6
+
7
+ attr_accessor *VALID_OPTION_KEYS
8
+
9
+ def configure
10
+ yield self
11
+ end
12
+ end
13
+ end
@@ -1,4 +1,4 @@
1
1
  module Rsync
2
2
  # Project version
3
- VERSION = "1.0.7"
3
+ VERSION = "1.0.8"
4
4
  end
@@ -2,6 +2,28 @@ require 'spec_helper'
2
2
  require 'rsync'
3
3
 
4
4
  describe Rsync do
5
+
6
+ context 'with configurations' do
7
+ before do
8
+ Rsync.configure do |config|
9
+ config.host = 'root@127.0.0.1'
10
+ end
11
+ end
12
+
13
+ it "should respond to host" do
14
+ Rsync.should respond_to(:host)
15
+ Rsync.host.should == 'root@127.0.0.1'
16
+ end
17
+
18
+ describe "run" do
19
+ it "prepend the host to the destination" do
20
+ Rsync::Command.stub(:run)
21
+ Rsync.run('/foo1', '/foo2', ["-a"])
22
+ Rsync::Command.should have_received(:run).with('/foo1', 'root@127.0.0.1:/foo2', ["-a"])
23
+ end
24
+ end
25
+ end
26
+
5
27
  around(:each) do |example|
6
28
  TempDir.create do |src, dest|
7
29
  @src = src
@@ -1,5 +1,9 @@
1
1
  require 'tmpdir'
2
2
 
3
+ RSpec.configure do |config|
4
+ config.color_enabled = true
5
+ end
6
+
3
7
  class TempDir
4
8
  attr_accessor :path
5
9
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsync
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-24 00:00:00.000000000Z
12
+ date: 2013-11-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
- requirement: &18808520 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '1.3'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *18808520
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.3'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: rake
27
- requirement: &18807800 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '0'
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *18807800
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: rspec
38
- requirement: &18806920 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,7 +53,12 @@ dependencies:
43
53
  version: '0'
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *18806920
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
47
62
  description:
48
63
  email:
49
64
  - jbussdieker@gmail.com
@@ -60,6 +75,7 @@ files:
60
75
  - lib/rsync.rb
61
76
  - lib/rsync/change.rb
62
77
  - lib/rsync/command.rb
78
+ - lib/rsync/configure.rb
63
79
  - lib/rsync/result.rb
64
80
  - lib/rsync/version.rb
65
81
  - rsync.gemspec
@@ -81,15 +97,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
97
  - - ! '>='
82
98
  - !ruby/object:Gem::Version
83
99
  version: '0'
100
+ segments:
101
+ - 0
102
+ hash: 1609043924082832949
84
103
  required_rubygems_version: !ruby/object:Gem::Requirement
85
104
  none: false
86
105
  requirements:
87
106
  - - ! '>='
88
107
  - !ruby/object:Gem::Version
89
108
  version: '0'
109
+ segments:
110
+ - 0
111
+ hash: 1609043924082832949
90
112
  requirements: []
91
113
  rubyforge_project:
92
- rubygems_version: 1.8.17
114
+ rubygems_version: 1.8.25
93
115
  signing_key:
94
116
  specification_version: 3
95
117
  summary: Ruby/Rsync is a Ruby library that can syncronize files between remote hosts
@@ -100,4 +122,3 @@ test_files:
100
122
  - spec/rsync/result_spec.rb
101
123
  - spec/rsync_spec.rb
102
124
  - spec/spec_helper.rb
103
- has_rdoc: