synco 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,25 +2,27 @@
2
2
 
3
3
  Synco is a tool for scripted synchronization and backups. It provides a custom Ruby DSL for describing backup and synchronization tasks involving one more more system and disk. It is designed to provide flexibility while reducing the complexity multi-server backups.
4
4
 
5
- * Single and multi-server data synchronization.
6
- * Incremental backups both locally and remotely.
7
- * Backup staging and coordination.
8
- * Backup verification using [Fingerprint](https://github.com/ioquatix/fingerprint).
9
- * Data backup redundancy controlled via DNS.
5
+ - Single and multi-server data synchronization.
6
+ - Incremental backups both locally and remotely.
7
+ - Backup staging and coordination.
8
+ - Backup verification using [Fingerprint](https://github.com/ioquatix/fingerprint).
9
+ - Data backup redundancy controlled via DNS.
10
+
11
+ [![Development Status](https://github.com/ioquatix/synco/workflows/Test/badge.svg)](https://github.com/ioquatix/synco/actions?workflow=Test)
10
12
 
11
13
  ## Installation
12
14
 
13
15
  Add this line to your application's Gemfile:
14
16
 
15
- gem 'synco'
17
+ gem 'synco'
16
18
 
17
19
  And then execute:
18
20
 
19
- $ bundle
21
+ $ bundle
20
22
 
21
23
  Or install it yourself as:
22
24
 
23
- $ gem install synco
25
+ $ gem install synco
24
26
 
25
27
  ## Usage
26
28
 
@@ -28,7 +30,7 @@ Synco imposes a particular structure regarding the organisation of backup script
28
30
 
29
31
  A simple backup script might look something like this:
30
32
 
31
- ```ruby
33
+ ``` ruby
32
34
  #!/usr/bin/env ruby
33
35
 
34
36
  require 'synco'
@@ -59,7 +61,7 @@ This will produce an identical copy using rsync of the specified directories. As
59
61
 
60
62
  Building on the above backup, you can use `Synco::Methods::RSyncSnapshot` which supports snapshot based backups. It creates a snapshot into a sub-directory called `latest.snapshot` and uses RSync's `--link-dest` to hard-link files when unchanged. Synco provides scripts to rotate and prune these backups as required, but you must invoke them as part of the script:
61
63
 
62
- ```ruby
64
+ ``` ruby
63
65
  server(:backup) do |server|
64
66
  server.host = "backup.example.com"
65
67
  server.root = "/"
@@ -73,7 +75,7 @@ end
73
75
 
74
76
  These commands can also be run from the command line.
75
77
 
76
- ```
78
+ ```
77
79
  rotate [--format <name>] [--latest <name>] [--snapshot <name>]
78
80
  Rotate a backup snapshot into a timestamped directory.
79
81
 
@@ -100,7 +102,7 @@ prune [--hourly <count>] [--daily <count>] [--weekly <count>] [--monthly <count>
100
102
 
101
103
  Synco supports mounting disks before the backup begins and unmounting them after done. The specifics of this process may require some adjustment based on your OS. For example on linux, `sudo` is used to invoke `mount` and `umount`.
102
104
 
103
- ```ruby
105
+ ``` ruby
104
106
  server(:destination) do |server|
105
107
  self.mountpoint = '/mnt/backups'
106
108
  self.root = File.join(server.mountpoint, 'laptop')
@@ -118,10 +120,8 @@ end
118
120
 
119
121
  On Linux, you might want to create the file `/etc/sudoers.d/synco` with the following contents:
120
122
 
121
- ```
122
- %wheel ALL=(root) NOPASSWD: /bin/mount
123
- %wheel ALL=(root) NOPASSWD: /bin/umount
124
- ```
123
+ %wheel ALL=(root) NOPASSWD: /bin/mount
124
+ %wheel ALL=(root) NOPASSWD: /bin/umount
125
125
 
126
126
  Please make sure you take the time to educate yourself on the security of such a setup.
127
127
 
@@ -129,7 +129,7 @@ Please make sure you take the time to educate yourself on the security of such a
129
129
 
130
130
  If you'd like to dump data before running the backup, it's possible using the event handling mechanisms:
131
131
 
132
- ```ruby
132
+ ``` ruby
133
133
  server(:master) do |server|
134
134
  server.host = "server.example.com"
135
135
  server.root = "/"
@@ -143,7 +143,7 @@ end
143
143
 
144
144
  The exact contents of `mysql-backup.sh` will depend on your requirements, but here is an example:
145
145
 
146
- ```bash
146
+ ``` bash
147
147
  #!/usr/bin/env bash
148
148
 
149
149
  BACKUP_DIR=/srv/mysql
@@ -165,7 +165,7 @@ done
165
165
 
166
166
  It is possible to make a [cryptographic checksum of the data](https://github.com/ioquatix/fingerprint). On a filesystem that support immutable snapshots, you can do this before the data is copied. For traditional filesystems, you generally need to do this afterwards.
167
167
 
168
- ```ruby
168
+ ``` ruby
169
169
  server(:master) do |server|
170
170
  server.host = "server.example.com"
171
171
  server.root = "/"
@@ -185,13 +185,11 @@ Fingerprint is used in many of the specs to verify file copies.
185
185
 
186
186
  Synco can manage synchronization and backups of ZFS partitions. However, to use the standard tools, it is necessary to enable `zfs_admin_snapshot`, in `/etc/modprobe.d/zfs.conf`:
187
187
 
188
- ```
189
- options zfs zfs_admin_snapshot=1
190
- ```
188
+ options zfs zfs_admin_snapshot=1
191
189
 
192
190
  Propagate user permissions for the ZFS partition:
193
191
 
194
- ```bash
192
+ ``` bash
195
193
  sudo zfs allow -ld -u `whoami` create,mount,send,receive,snapshot tank/test
196
194
  ```
197
195
 
@@ -209,7 +207,7 @@ Firstly, a backup script defaults to the server with the name `:master` as the m
209
207
 
210
208
  However, it is possible instead to specify a hostname, e.g. `primary.example.com`. Then, specify several servers, e.g. `s01.example.com`, `s02.example.com` and so on:
211
209
 
212
- ```ruby
210
+ ``` ruby
213
211
  Synco::run_script do |script|
214
212
  script.method = Synco::Methods::RSync.new(archive: true)
215
213
 
@@ -233,32 +231,18 @@ When you run the script, the behaviour will depend on whether `primary.example.c
233
231
 
234
232
  ## Contributing
235
233
 
236
- 1. Fork it
237
- 2. Create your feature branch (`git checkout -b my-new-feature`)
238
- 3. Commit your changes (`git commit -am 'Add some feature'`)
239
- 4. Push to the branch (`git push origin my-new-feature`)
240
- 5. Create new Pull Request
241
-
242
- ## License
234
+ We welcome contributions to this project.
243
235
 
244
- Released under the MIT license.
236
+ 1. Fork it.
237
+ 2. Create your feature branch (`git checkout -b my-new-feature`).
238
+ 3. Commit your changes (`git commit -am 'Add some feature'`).
239
+ 4. Push to the branch (`git push origin my-new-feature`).
240
+ 5. Create new Pull Request.
245
241
 
246
- Copyright, 2016, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
242
+ ### Developer Certificate of Origin
247
243
 
248
- Permission is hereby granted, free of charge, to any person obtaining a copy
249
- of this software and associated documentation files (the "Software"), to deal
250
- in the Software without restriction, including without limitation the rights
251
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
252
- copies of the Software, and to permit persons to whom the Software is
253
- furnished to do so, subject to the following conditions:
244
+ In order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed.
254
245
 
255
- The above copyright notice and this permission notice shall be included in
256
- all copies or substantial portions of the Software.
246
+ ### Community Guidelines
257
247
 
258
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
259
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
260
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
261
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
262
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
263
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
264
- THE SOFTWARE.
248
+ This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.
data.tar.gz.sig ADDED
Binary file
metadata CHANGED
@@ -1,57 +1,86 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: synco
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
- cert_chain: []
11
- date: 2020-02-10 00:00:00.000000000 Z
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIE2DCCA0CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMRgwFgYDVQQDDA9zYW11
14
+ ZWwud2lsbGlhbXMxHTAbBgoJkiaJk/IsZAEZFg1vcmlvbnRyYW5zZmVyMRIwEAYK
15
+ CZImiZPyLGQBGRYCY28xEjAQBgoJkiaJk/IsZAEZFgJuejAeFw0yMjA4MDYwNDUz
16
+ MjRaFw0zMjA4MDMwNDUzMjRaMGExGDAWBgNVBAMMD3NhbXVlbC53aWxsaWFtczEd
17
+ MBsGCgmSJomT8ixkARkWDW9yaW9udHJhbnNmZXIxEjAQBgoJkiaJk/IsZAEZFgJj
18
+ bzESMBAGCgmSJomT8ixkARkWAm56MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIB
19
+ igKCAYEAomvSopQXQ24+9DBB6I6jxRI2auu3VVb4nOjmmHq7XWM4u3HL+pni63X2
20
+ 9qZdoq9xt7H+RPbwL28LDpDNflYQXoOhoVhQ37Pjn9YDjl8/4/9xa9+NUpl9XDIW
21
+ sGkaOY0eqsQm1pEWkHJr3zn/fxoKPZPfaJOglovdxf7dgsHz67Xgd/ka+Wo1YqoE
22
+ e5AUKRwUuvaUaumAKgPH+4E4oiLXI4T1Ff5Q7xxv6yXvHuYtlMHhYfgNn8iiW8WN
23
+ XibYXPNP7NtieSQqwR/xM6IRSoyXKuS+ZNGDPUUGk8RoiV/xvVN4LrVm9upSc0ss
24
+ RZ6qwOQmXCo/lLcDUxJAgG95cPw//sI00tZan75VgsGzSWAOdjQpFM0l4dxvKwHn
25
+ tUeT3ZsAgt0JnGqNm2Bkz81kG4A2hSyFZTFA8vZGhp+hz+8Q573tAR89y9YJBdYM
26
+ zp0FM4zwMNEUwgfRzv1tEVVUEXmoFCyhzonUUw4nE4CFu/sE3ffhjKcXcY//qiSW
27
+ xm4erY3XAgMBAAGjgZowgZcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
28
+ BBYEFO9t7XWuFf2SKLmuijgqR4sGDlRsMC4GA1UdEQQnMCWBI3NhbXVlbC53aWxs
29
+ aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MC4GA1UdEgQnMCWBI3NhbXVlbC53aWxs
30
+ aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MA0GCSqGSIb3DQEBCwUAA4IBgQB5sxkE
31
+ cBsSYwK6fYpM+hA5B5yZY2+L0Z+27jF1pWGgbhPH8/FjjBLVn+VFok3CDpRqwXCl
32
+ xCO40JEkKdznNy2avOMra6PFiQyOE74kCtv7P+Fdc+FhgqI5lMon6tt9rNeXmnW/
33
+ c1NaMRdxy999hmRGzUSFjozcCwxpy/LwabxtdXwXgSay4mQ32EDjqR1TixS1+smp
34
+ 8C/NCWgpIfzpHGJsjvmH2wAfKtTTqB9CVKLCWEnCHyCaRVuKkrKjqhYCdmMBqCws
35
+ JkxfQWC+jBVeG9ZtPhQgZpfhvh+6hMhraUYRQ6XGyvBqEUe+yo6DKIT3MtGE2+CP
36
+ eX9i9ZWBydWb8/rvmwmX2kkcBbX0hZS1rcR593hGc61JR6lvkGYQ2MYskBveyaxt
37
+ Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
38
+ voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
39
+ -----END CERTIFICATE-----
40
+ date: 2024-10-21 00:00:00.000000000 Z
12
41
  dependencies:
13
42
  - !ruby/object:Gem::Dependency
14
- name: periodical
43
+ name: build-files
15
44
  requirement: !ruby/object:Gem::Requirement
16
45
  requirements:
17
46
  - - "~>"
18
47
  - !ruby/object:Gem::Version
19
- version: '1.1'
48
+ version: '1.0'
20
49
  type: :runtime
21
50
  prerelease: false
22
51
  version_requirements: !ruby/object:Gem::Requirement
23
52
  requirements:
24
53
  - - "~>"
25
54
  - !ruby/object:Gem::Version
26
- version: '1.1'
55
+ version: '1.0'
27
56
  - !ruby/object:Gem::Dependency
28
- name: samovar
57
+ name: fingerprint
29
58
  requirement: !ruby/object:Gem::Requirement
30
59
  requirements:
31
60
  - - "~>"
32
61
  - !ruby/object:Gem::Version
33
- version: '2.0'
62
+ version: '3.0'
34
63
  type: :runtime
35
64
  prerelease: false
36
65
  version_requirements: !ruby/object:Gem::Requirement
37
66
  requirements:
38
67
  - - "~>"
39
68
  - !ruby/object:Gem::Version
40
- version: '2.0'
69
+ version: '3.0'
41
70
  - !ruby/object:Gem::Dependency
42
- name: fingerprint
71
+ name: lockfile
43
72
  requirement: !ruby/object:Gem::Requirement
44
73
  requirements:
45
- - - "~>"
74
+ - - ">="
46
75
  - !ruby/object:Gem::Version
47
- version: '3.0'
76
+ version: '0'
48
77
  type: :runtime
49
78
  prerelease: false
50
79
  version_requirements: !ruby/object:Gem::Requirement
51
80
  requirements:
52
- - - "~>"
81
+ - - ">="
53
82
  - !ruby/object:Gem::Version
54
- version: '3.0'
83
+ version: '0'
55
84
  - !ruby/object:Gem::Dependency
56
85
  name: mapping
57
86
  requirement: !ruby/object:Gem::Requirement
@@ -67,19 +96,19 @@ dependencies:
67
96
  - !ruby/object:Gem::Version
68
97
  version: '1.0'
69
98
  - !ruby/object:Gem::Dependency
70
- name: build-files
99
+ name: periodical
71
100
  requirement: !ruby/object:Gem::Requirement
72
101
  requirements:
73
102
  - - "~>"
74
103
  - !ruby/object:Gem::Version
75
- version: '1.0'
104
+ version: '1.1'
76
105
  type: :runtime
77
106
  prerelease: false
78
107
  version_requirements: !ruby/object:Gem::Requirement
79
108
  requirements:
80
109
  - - "~>"
81
110
  - !ruby/object:Gem::Version
82
- version: '1.0'
111
+ version: '1.1'
83
112
  - !ruby/object:Gem::Dependency
84
113
  name: process-group
85
114
  requirement: !ruby/object:Gem::Requirement
@@ -95,89 +124,26 @@ dependencies:
95
124
  - !ruby/object:Gem::Version
96
125
  version: '1.1'
97
126
  - !ruby/object:Gem::Dependency
98
- name: lockfile
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :runtime
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: covered
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: bundler
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: rspec
127
+ name: samovar
141
128
  requirement: !ruby/object:Gem::Requirement
142
129
  requirements:
143
130
  - - "~>"
144
131
  - !ruby/object:Gem::Version
145
- version: '3.4'
146
- type: :development
132
+ version: '2.0'
133
+ type: :runtime
147
134
  prerelease: false
148
135
  version_requirements: !ruby/object:Gem::Requirement
149
136
  requirements:
150
137
  - - "~>"
151
138
  - !ruby/object:Gem::Version
152
- version: '3.4'
153
- - !ruby/object:Gem::Dependency
154
- name: rake
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ">="
158
- - !ruby/object:Gem::Version
159
- version: '0'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: '0'
167
- description:
139
+ version: '2.0'
140
+ description:
168
141
  email:
169
- - samuel.williams@oriontransfer.co.nz
170
142
  executables:
171
143
  - synco
172
144
  extensions: []
173
145
  extra_rdoc_files: []
174
146
  files:
175
- - ".github/workflows/development.yml"
176
- - ".gitignore"
177
- - ".rspec"
178
- - Gemfile
179
- - README.md
180
- - Rakefile
181
147
  - bin/synco
182
148
  - lib/synco.rb
183
149
  - lib/synco/command.rb
@@ -198,24 +164,15 @@ files:
198
164
  - lib/synco/shell.rb
199
165
  - lib/synco/shells/ssh.rb
200
166
  - lib/synco/version.rb
201
- - spec/spec_helper.rb
202
- - spec/synco/backup_script.rb
203
- - spec/synco/directory_spec.rb
204
- - spec/synco/local_backup.rb
205
- - spec/synco/local_sync.rb
206
- - spec/synco/method_spec.rb
207
- - spec/synco/rsync_spec.rb
208
- - spec/synco/scp_spec.rb
209
- - spec/synco/script_spec.rb
210
- - spec/synco/shell_spec.rb
211
- - spec/synco/usb_spec.rb
212
- - spec/synco/zfs_spec.rb
213
- - synco.gemspec
214
- homepage: ''
167
+ - license.md
168
+ - readme.md
169
+ homepage: https://github.com/ioquatix/synco
215
170
  licenses:
216
171
  - MIT
217
- metadata: {}
218
- post_install_message:
172
+ metadata:
173
+ funding_uri: https://github.com/sponsors/ioquatix/
174
+ source_code_uri: https://github.com/ioquatix/synco.git
175
+ post_install_message:
219
176
  rdoc_options: []
220
177
  require_paths:
221
178
  - lib
@@ -223,27 +180,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
223
180
  requirements:
224
181
  - - ">="
225
182
  - !ruby/object:Gem::Version
226
- version: '0'
183
+ version: '3.1'
227
184
  required_rubygems_version: !ruby/object:Gem::Requirement
228
185
  requirements:
229
186
  - - ">="
230
187
  - !ruby/object:Gem::Version
231
188
  version: '0'
232
189
  requirements: []
233
- rubygems_version: 3.0.6
234
- signing_key:
190
+ rubygems_version: 3.5.11
191
+ signing_key:
235
192
  specification_version: 4
236
193
  summary: Synco is a tool for scripted synchronization and backups.
237
- test_files:
238
- - spec/spec_helper.rb
239
- - spec/synco/backup_script.rb
240
- - spec/synco/directory_spec.rb
241
- - spec/synco/local_backup.rb
242
- - spec/synco/local_sync.rb
243
- - spec/synco/method_spec.rb
244
- - spec/synco/rsync_spec.rb
245
- - spec/synco/scp_spec.rb
246
- - spec/synco/script_spec.rb
247
- - spec/synco/shell_spec.rb
248
- - spec/synco/usb_spec.rb
249
- - spec/synco/zfs_spec.rb
194
+ test_files: []
metadata.gz.sig ADDED
Binary file
@@ -1,40 +0,0 @@
1
- name: Development
2
-
3
- on: [push, pull_request]
4
-
5
- jobs:
6
- test:
7
- strategy:
8
- fail-fast: false
9
- matrix:
10
- os: [ubuntu-latest, macos-latest]
11
- ruby: [2.3, 2.4, 2.5, 2.6, 2.7]
12
- runs-on: ${{matrix.os}}
13
- steps:
14
- - uses: actions/checkout@v2
15
-
16
- - uses: ruby/setup-ruby@v1
17
- with:
18
- ruby-version: ${{matrix.ruby}}
19
-
20
- - uses: actions/cache@v1
21
- with:
22
- path: vendor/bundle
23
- key: bundle-use-ruby-${{matrix.os}}-${{matrix.ruby}}-${{hashFiles('**/Gemfile')}}
24
- restore-keys: |
25
- bundle-use-ruby-${{matrix.os}}-${{matrix.ruby}}-
26
-
27
- - name: Installing packages (ubuntu)
28
- if: matrix.os == 'ubuntu-latest'
29
- run: sudo apt-get install rsync
30
-
31
- - name: Installing packages (macos)
32
- if: matrix.os == 'macos-latest'
33
- run: brew install rsync
34
-
35
- - name: Bundle install...
36
- run: |
37
- bundle config path vendor/bundle
38
- bundle install
39
-
40
- - run: bundle exec rake
data/.gitignore DELETED
@@ -1,22 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
- *.bundle
19
- *.so
20
- *.o
21
- *.a
22
- mkmf.log
data/.rspec DELETED
@@ -1,4 +0,0 @@
1
- --format documentation
2
- --backtrace
3
- --require spec_helper
4
- --warnings
data/Gemfile DELETED
@@ -1,8 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in ..gemspec
4
- gemspec
5
-
6
- group :test do
7
- gem 'fssm'
8
- end
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new
5
-
6
- task :default => :spec
data/spec/spec_helper.rb DELETED
@@ -1,34 +0,0 @@
1
- # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
20
-
21
- require 'bundler/setup'
22
- require 'covered/rspec'
23
-
24
- RSpec.configure do |config|
25
- # Enable flags like --only-failures and --next-failure
26
- config.example_status_persistence_file_path = ".rspec_status"
27
-
28
- # Disable RSpec exposing methods globally on `Module` and `main`
29
- config.disable_monkey_patching!
30
-
31
- config.expect_with :rspec do |c|
32
- c.syntax = :expect
33
- end
34
- end
@@ -1,63 +0,0 @@
1
- #!/usr/bin/env rspec
2
-
3
- # Copyright, 2015, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
22
-
23
- require 'fingerprint'
24
- require 'process/group'
25
- require 'fileutils'
26
- require 'digest'
27
-
28
- require 'synco/scope'
29
- require 'synco/script'
30
-
31
- SYNCO_PATH = File.expand_path("../../bin/synco", __dir__)
32
-
33
- RSpec.shared_context "backup script" do
34
- def create_files(master_path, target_path)
35
- FileUtils.rm_rf master_path
36
- FileUtils.rm_rf target_path
37
-
38
- FileUtils.mkdir_p master_path
39
- FileUtils.mkdir_p target_path
40
-
41
- (1...10).each do |i|
42
- path = File.join(master_path, i.to_s)
43
-
44
- FileUtils.mkdir(path)
45
-
46
- text = Digest::MD5.hexdigest(i.to_s)
47
-
48
- File.open(File.join(path, i.to_s), "w") { |f| f.write(text) }
49
- end
50
- end
51
-
52
- let(:tmp_path) {File.join(__dir__, 'tmp')}
53
- let(:master_path) {File.join(__dir__, 'tmp/master')}
54
- let(:target_path) {File.join(__dir__, 'tmp/target')}
55
-
56
- before(:each) do
57
- create_files(master_path, target_path)
58
- end
59
-
60
- after(:each) do
61
- # FileUtils.rm_rf tmp_path
62
- end
63
- end
@@ -1,33 +0,0 @@
1
- #!/usr/bin/env rspec
2
-
3
- # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
22
-
23
- require 'synco/directory'
24
-
25
- RSpec.describe Synco::Directory.new(".", arguments: ['--foo']) do
26
- it "should have arguments" do
27
- expect(subject.arguments).to include('--foo')
28
- end
29
-
30
- it "must be relative path" do
31
- expect{Synco::Directory.new("/var")}.to raise_error(ArgumentError)
32
- end
33
- end