multisync 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8a0350c5ae280342b7adaf8b0fc631fb8c3ee599b50c5102a0a65ac3a10d0c5
4
- data.tar.gz: 37cfb68379262654a58db051640cde44de7a2e7fc5da3a9a089cbcf28e5235ba
3
+ metadata.gz: 61ac03244c8167301ec37ba7e610862fd8a04bbcbf076ae924d6e68de7a433ca
4
+ data.tar.gz: '06986d1e288623a55578897df7ad2e29245077387b9f49aacf0e0c5e1be5517d'
5
5
  SHA512:
6
- metadata.gz: 01b4d15706e79188cc5c99cce466f22dccffacffefc1289abacf82f2d0879cc631dd1a763faade9c0853bb92a5dc4b5bda6a5721c1ca6048d0d9a3e039f8d059
7
- data.tar.gz: 3d99412299c849635251f0feb2ffced54f39118d92a455379d3468d7751a32a6a8af968cd86712c9478a165688ec2e53a793fec0fcd6b28f845403a85a52e07a
6
+ metadata.gz: 661926fde8d62277b7865747afc6af70e991ab23ec92c1c34a1ec742a580d3a8a6b4b136d043a417ee304f25586ed20039895926c79988bcb44ba91a800f7c11
7
+ data.tar.gz: 73c84b8e6dd7218c63ae1e9be51bf6775caa3715f73c0a4b896363832623310b9bfcdcf180f0b149efa5612a4abce4a783cb59429e63cc5b17347f2e82f55496
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Gem Version](https://badge.fury.io/rb/amaze.svg)](https://badge.fury.io/rb/multisync)
1
+ [![Gem Version](https://badge.fury.io/rb/multisync.svg)](https://badge.fury.io/rb/multisync)
2
2
 
3
3
  # Multisync
4
4
 
@@ -7,24 +7,28 @@ Multisync offers a DSL to organize sets of rsync tasks. It takes advantage of te
7
7
 
8
8
  ## Installation
9
9
 
10
- Add this line to your application's Gemfile:
10
+ Install multisync with:
11
11
 
12
- ```ruby
13
- gem 'multisync'
14
- ```
12
+ $ gem install multisync
15
13
 
16
- And then execute:
17
14
 
18
- $ bundle
15
+ ## Usage
19
16
 
20
- Or install it yourself as:
17
+ In order to run multisync you first need a catalog file (default: `~/.multisync.rb`). Copy the [sample file](sample/multisync.rb) to `~/.multisync.rb` and use it as a starting point to adjust it to your needs.
21
18
 
22
- $ gem install multisync
19
+ List your configuration (and check your catalog file for errors):
23
20
 
21
+ $ multisync -l
24
22
 
25
- ## Usage
26
23
 
27
- TODO: Write usage instructions here
24
+ Print out the rsync commands without executing them:
25
+
26
+ $ multisync -p
27
+
28
+
29
+ Run a group or task defined in your catalog file:
30
+
31
+ $ multisync nas
28
32
 
29
33
 
30
34
  ## Development
data/lib/multisync/cli.rb CHANGED
@@ -13,14 +13,11 @@ class Multisync::Cli
13
13
 
14
14
  def parser
15
15
  OptionParser.new do |o|
16
- o.banner = "\nRun rsync jobs defined in the catalog file '#{options[:file]}'.\n\n"+
17
- "Usage: #{File.basename $0} [options] [SET] [...]\n\n"+
18
- " SET selects a section from the catalog (see option -l)\n"+
19
- " use / as a follow:\n"+
20
- " work/pictures to specify the sync defined in the group work and\n"+
21
- " home/pictures to specify the sync defined in the group home\n"+
22
- " pictures alone will select both syncs, the one in the group work\n"+
23
- " as well as the one in the group home"
16
+ o.banner = "\nRun rsync jobs defined in the catalog file '#{options[:file]}'.\n\n" +
17
+ "Usage: #{File.basename $0} [options] [SET] [...]\n\n" +
18
+ " SET selects a section from the catalog (see option -l)\n" +
19
+ " use / as a group/task separator.\n" +
20
+ " e.g. #{File.basename $0} nas/userdata"
24
21
  o.separator ''
25
22
  o.on('-l', '--list', "List the catalog") do
26
23
  options[:list] = true
@@ -120,7 +117,7 @@ class Multisync::Cli
120
117
  dryrun: false,
121
118
  quiet: false,
122
119
  file: Multisync::Catalog.default_catalog_path,
123
- timeout: 31536000,
120
+ timeout: 31536000, # 1 year
124
121
  }
125
122
  end
126
123
 
@@ -1,3 +1,3 @@
1
1
  module Multisync
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
data/multisync.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
 
11
11
  spec.summary = %q{DSL for rsync.}
12
12
  spec.description = %q{Multisync offers a DSL to organize sets of rsync tasks.}
13
- spec.homepage = ""
13
+ spec.homepage = "https://github.com/pmarchi/multisync"
14
14
  spec.license = "MIT"
15
15
 
16
16
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
@@ -18,8 +18,8 @@ Gem::Specification.new do |spec|
18
18
  if spec.respond_to?(:metadata)
19
19
  spec.metadata["allowed_push_host"] = "https://rubygems.org"
20
20
 
21
- # spec.metadata["homepage_uri"] = spec.homepage
22
- # spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
21
+ spec.metadata["homepage_uri"] = spec.homepage
22
+ spec.metadata["source_code_uri"] = "https://github.com/pmarchi/multisync"
23
23
  # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
24
24
  else
25
25
  raise "RubyGems 2.0 or newer is required to protect against " \
data/sample/multisync.rb CHANGED
@@ -1,39 +1,115 @@
1
- options %w( --archive --delete --delete-excluded --exclude=.DS_Store )
2
-
3
- group :home do
4
- group :cloud do
5
- to "/Backup/Cloud"
6
-
7
- sync :dropbox do
8
- desc "Dropbox"
9
- from "~/Dropbox"
10
- options %q(--exclude='.dropbox.cache')
11
- end
12
-
13
- sync :copy do
14
- desc "Copy"
15
- from "~/Copy"
16
- options %w(--archive --delete --exclude='.copy.cache'), :override
17
- end
1
+ # Copy this file to your home: ~/.multisync.rb
2
+ # Choose one of the section A), B) or C) as a starting point
3
+ # to adjust the configuration to your needs.
4
+
5
+
6
+ ################################################################################
7
+
8
+ # A) Simple rsync task
9
+
10
+ sync :simple do
11
+ from "~/Documents"
12
+ to "/PathToExternalDisk"
13
+ options %w( --archive --exclude=.DS_Store ) # as array
14
+ end
15
+
16
+ # This task can be run with: "multisync simple"
17
+
18
+
19
+ ################################################################################
20
+
21
+ # B) Group of rsync tasks
22
+
23
+ group :userdata do
24
+
25
+ # Define the target path for the whole group and check the existance of the
26
+ # target path before running the rsync task.
27
+ # Also set an optional description for the target.
28
+ to "/PathToExternalDisk", description: "External HD", check: true
29
+
30
+ # Define rsync options for the whole group
31
+ options %w( --archive --exclude=.DS_Store )
32
+
33
+ sync :desktop do
34
+ # With optional description of the source
35
+ from "~/Desktop", description: "Desktop"
18
36
  end
19
37
 
20
- sync :pictures do
21
- desc "Pictures"
22
- from "~/Pictures/Private"
23
- to "/Backup/Home"
38
+ sync :documents do
39
+ from "~/Documents", description: "Documents"
40
+ end
41
+
42
+ sync :downloads do
43
+ from "~/Downloads", description: "Downloads"
44
+ # Add options specific to this task.
45
+ options %w( --exclude='*.download' )
24
46
  end
25
47
  end
26
48
 
27
- group :work do
28
- to "/Backup/Work"
49
+ # Run the whole group with: "multisync userdata"
50
+ # Run a single taks with: "multisync userdata/downloads"
51
+
52
+
53
+ ################################################################################
54
+
55
+ # C) Real world example using templates, defaults and options override
56
+
57
+ # rsync options for all tasks
58
+ options %w( --archive --delete --delete-excluded --delete-after --exclude=.DS_Store --exclude=.localized )
59
+
60
+
61
+ # Use templates to define a set of tasks that can be included later
62
+ template :data do
63
+
64
+ # Always check the existance of the source path
65
+ check_from true
66
+
67
+ # rsync tasks with uncomplete arguments:
68
+ # Define the target later where the template will be included.
69
+ # This can be used to sync multiple directories to different remote locations.
70
+ sync :documents do
71
+ from "~/Documents", description: "Documents"
72
+ end
29
73
 
30
74
  sync :pictures do
31
- desc "Pictures"
32
- from "~/Pictures/Work"
75
+ from "~/Pictures", description: "Pictures"
33
76
  end
34
77
 
35
- sync :doc do
36
- desc "Documentation"
37
- from "~/Work/doc"
78
+ sync :downloads do
79
+ from "~/Downloads", description: "Downloads"
80
+ # Don't merge options
81
+ options %w( --times --exclude='*.download' ), :override
38
82
  end
39
- end
83
+ end
84
+
85
+
86
+ group :hd do
87
+ # Uncomment the following line to run this group by default
88
+ # default
89
+
90
+ # Define the target to be used by all tasks.
91
+ # The existance of the target path should be checked.
92
+ to "/TargetPathToBackupDisk/MyComputer", description: "External Disk", check: true
93
+
94
+ # Include the template with the task definitions
95
+ include :data
96
+ end
97
+
98
+ group :nas do
99
+ to "user@nas.local:/data/backup/my_computer", description: "NAS", check: true
100
+
101
+ # Include the template with the task definitions
102
+ include :data
103
+ end
104
+
105
+ # Run both groups with: "multisync hd nas"
106
+ # Sync "desktop" to "hd" and "nas": "multisync desktop"
107
+ # Sync "desktop" to "hd" only: "multisync hd/desktop"
108
+
109
+
110
+ ################################################################################
111
+
112
+ # Additional notes
113
+ # - groups can be nested
114
+ # - use "default" to run one or more groups without specifing a name
115
+ # - "default" can also be set on the top level and defines all tasks as default.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multisync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Marchi
@@ -155,11 +155,13 @@ files:
155
155
  - lib/multisync/version.rb
156
156
  - multisync.gemspec
157
157
  - sample/multisync.rb
158
- homepage: ''
158
+ homepage: https://github.com/pmarchi/multisync
159
159
  licenses:
160
160
  - MIT
161
161
  metadata:
162
162
  allowed_push_host: https://rubygems.org
163
+ homepage_uri: https://github.com/pmarchi/multisync
164
+ source_code_uri: https://github.com/pmarchi/multisync
163
165
  post_install_message:
164
166
  rdoc_options: []
165
167
  require_paths: