rdiff-simple 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 968755a5bad68f5d74be8c4094397bf7c0cd2bf7
4
+ data.tar.gz: e145778c06a3476e26ebd2d5dc7098aabc2e7081
5
+ SHA512:
6
+ metadata.gz: 232641a5ef647d6f32687ebca5b4885906964e5a5adb4984a094f92ea86b52433d6002faeeac57124a80a92746f3b4164d6f102c5e46ede9617a2a1fd338d5ea
7
+ data.tar.gz: fdaf92c0dec9589b2eee66b92823f85b252ffaf6a96aa7ea8a3bd777d1f94da096a8566482797d01fa28dbabd023fe11e00b64c0478676793cec7abdaa7447f4
data/.gitignore CHANGED
@@ -15,3 +15,6 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .ruby-version
19
+ bin
20
+ Guardfile
data/Gemfile CHANGED
@@ -2,3 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in rdiff-simple.gemspec
4
4
  gemspec
5
+
6
+ group :development do
7
+ gem "guard-rspec", require: false
8
+ end
@@ -1,3 +1,3 @@
1
1
  module RdiffSimple
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/rdiff_simple.rb CHANGED
@@ -1 +1,16 @@
1
1
  require "rdiff_simple/version"
2
+
3
+ module RdiffSimple
4
+
5
+ class NotInstalledError < Exception; end
6
+
7
+ def self.execute(*args)
8
+ raise NotInstalledError, 'rdiff-backup not installed' unless installed?
9
+
10
+ system('rdiff-backup', *args)
11
+ end
12
+
13
+ def self.installed?
14
+ system('which rdiff-backup')
15
+ end
16
+ end
@@ -1,7 +1,56 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe RdiffSimple do
4
- it "should be defined" do
5
- defined?(RdiffSimple).should == 'constant'
4
+ describe '#execute' do
5
+ context 'when no arguments are given' do
6
+ it 'should return false' do
7
+ subject.execute.should be_false
8
+ end
9
+ end
10
+
11
+ context 'when arguments are given' do
12
+ it 'should return true' do
13
+ subject.execute('--version').should be_true
14
+ end
15
+ end
16
+
17
+ context 'when rdiff-backup is not installed' do
18
+ before(:each) do
19
+ mock_rdiff_installed(false)
20
+ end
21
+
22
+ it 'should be false' do
23
+ expect { subject.execute('--version') }.should raise_error(RdiffSimple::NotInstalledError)
24
+ end
25
+ end
26
+ end
27
+
28
+ describe '#installed?' do
29
+ context 'when rdiff-backup is installed' do
30
+ before(:each) do
31
+ mock_rdiff_installed(true)
32
+ end
33
+
34
+ it 'should be true' do
35
+ subject.installed?.should be_true
36
+ end
37
+ end
38
+
39
+ context 'when rdiff-backup is not installed' do
40
+ before(:each) do
41
+ mock_rdiff_installed(false)
42
+ end
43
+
44
+ it 'should be false' do
45
+ subject.installed?.should be_false
46
+ end
47
+ end
48
+ end
49
+
50
+ def mock_rdiff_installed(value)
51
+ subject
52
+ .should_receive(:system)
53
+ .with('which rdiff-backup')
54
+ .and_return(value)
6
55
  end
7
56
  end
data/spec/spec_helper.rb CHANGED
@@ -17,4 +17,3 @@ RSpec.configure do |config|
17
17
  config.treat_symbols_as_metadata_keys_with_true_values = true
18
18
  config.run_all_when_everything_filtered = true
19
19
  end
20
-
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdiff-simple
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
5
- prerelease:
4
+ version: 0.0.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ryan Hansen
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-25 00:00:00.000000000 Z
11
+ date: 2013-06-30 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rspec
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,33 +41,29 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: coveralls
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  description: A simple wrapper around rdiff-backup
@@ -100,34 +91,27 @@ files:
100
91
  homepage: http://github.com/ketiko/rdiff-simple
101
92
  licenses:
102
93
  - MIT
94
+ metadata: {}
103
95
  post_install_message:
104
96
  rdoc_options:
105
97
  - --charset=UTF-8
106
98
  require_paths:
107
99
  - lib
108
100
  required_ruby_version: !ruby/object:Gem::Requirement
109
- none: false
110
101
  requirements:
111
- - - ! '>='
102
+ - - '>='
112
103
  - !ruby/object:Gem::Version
113
104
  version: '0'
114
- segments:
115
- - 0
116
- hash: 2591675845849006014
117
105
  required_rubygems_version: !ruby/object:Gem::Requirement
118
- none: false
119
106
  requirements:
120
- - - ! '>='
107
+ - - '>='
121
108
  - !ruby/object:Gem::Version
122
109
  version: '0'
123
- segments:
124
- - 0
125
- hash: 2591675845849006014
126
110
  requirements: []
127
111
  rubyforge_project:
128
- rubygems_version: 1.8.23
112
+ rubygems_version: 2.0.2
129
113
  signing_key:
130
- specification_version: 3
114
+ specification_version: 4
131
115
  summary: A wrapper around the rdiff-backup executable
132
116
  test_files:
133
117
  - spec/rdiff_simple_spec.rb