rsyncinator 0.0.0 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,12 +2,12 @@ set :rsync_user, -> { fetch(:deployment_username) }
2
2
  set :rsync_log_file, -> { shared_path.join('log', 'rsyncinator.log') }
3
3
  set :rsync_tail_lines, "10"
4
4
 
5
- def rsync(host, from_host, source, destination)
5
+ def rsync(host)
6
6
  execute(
7
- "rsync", "-ah", fetch(:rsync_options),
7
+ "rsync", "-ah", fetch(:rsync_options), fetch(:rsync_excludes),
8
8
  "--rsh", "\"ssh", "-o", "PasswordAuthentication=no", "-o", "StrictHostKeyChecking=no\"",
9
9
  "--log-file", fetch(:rsync_log_file),
10
- "#{fetch(:rsync_user)}@#{from_host}:#{source}", destination
10
+ "#{fetch(:rsync_user)}@#{fetch(:rsync_from_host)}:#{fetch(:rsync_source)}", fetch(:rsync_destination)
11
11
  )
12
12
  end
13
13
 
@@ -5,10 +5,18 @@ server "my-app-stage.example.com",
5
5
  :rsyncs => [ # rsyncinator
6
6
  {
7
7
  :from => "my-app.example.com",
8
- :dirs => {
9
- shared_path.join("var", "images") => shared_path.join("var", "images"),
10
- shared_path.join("public", "images") => shared_path.join("public", "images")
11
- }
8
+ :dir_sets => [
9
+ {
10
+ :from_dir => shared_path.join("var", "images"),
11
+ :to_dir => shared_path.join("var", "images"),
12
+ :excludes => [shared_path.join("var", "tmp"), "*.tmp"]
13
+ },
14
+ {
15
+ :from_dir => shared_path.join("public", "assets"),
16
+ :to_dir => shared_path.join("public", "assets"),
17
+ :excludes => ["tmp/*"]
18
+ }
19
+ ]
12
20
  }
13
21
  ]
14
22
  ### ------------------------------------------------------------------
@@ -9,8 +9,13 @@ task :rsync do
9
9
  else
10
10
  execute "mkdir", "-p", Pathname.new(fetch(:rsync_log_file)).split.first.to_s
11
11
  host.properties.rsyncs.each do |sync|
12
- sync[:dirs].each do |source, destination|
13
- rsync(host, sync[:from], source, destination)
12
+ sync[:dir_sets].each do |dir_set|
13
+ dir_set[:excludes] ||= []
14
+ set :rsync_excludes, dir_set[:excludes].collect { |exclude| "--exclude '#{exclude.to_s}'" }.join(' ')
15
+ set :rsync_from_host, sync[:from]
16
+ set :rsync_source, dir_set[:from_dir]
17
+ set :rsync_destination, dir_set[:to_dir]
18
+ rsync(host)
14
19
  end
15
20
  end
16
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsyncinator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-08-21 00:00:00.000000000 Z
12
+ date: 2015-10-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
@@ -91,7 +91,7 @@ dependencies:
91
91
  - - ~>
92
92
  - !ruby/object:Gem::Version
93
93
  version: 1.5.1
94
- description: Capistrano Plugin to rsync between roles
94
+ description: Capistrano Plugin to run Rsyncs repeatably
95
95
  email: davidamick@ctisolutionsinc.com
96
96
  executables: []
97
97
  extensions: []
@@ -130,6 +130,6 @@ rubyforge_project:
130
130
  rubygems_version: 1.8.23.2
131
131
  signing_key:
132
132
  specification_version: 3
133
- summary: Rsync between roles
133
+ summary: Define and run Rsyncs repeatably
134
134
  test_files: []
135
135
  has_rdoc: