capistrano-bundle_rsync 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c90d50f28156ca6735117d30e27e8e7b314dbc58
4
- data.tar.gz: d8316808133e0c4f0c1603814b2a456921ea747f
3
+ metadata.gz: 63590982f55043e42dd7b1d9295aa885f265b8d6
4
+ data.tar.gz: 10f89bb5c7f34feeae5efafd0c7f67394b646b7c
5
5
  SHA512:
6
- metadata.gz: 4afc9dbd2074b3fcf99f7cd39e2a2b3ceee5987c3dc037c2dc6d871c6687ca035e5c6e80ced33817d3fa6df7a30e5ce3abc89156106ca6543e1a3b13a9995372
7
- data.tar.gz: 174c5c142f974acb7eaa7b64886ee34e50ef19065f9f98178714d61bfb64cde754810b36fdd0a5f6580289a1c2b595a37ff018eaa35864aa5ea6b45411ef213e
6
+ metadata.gz: 43f1ab1478797a5a701209a52039978b84da445711c67d807bd4b601c59518912cbfc0e1e10f9de7ba29b56c5a3f29650a53c915b08d0d368824679bdefb2117
7
+ data.tar.gz: 1fd91e762d4e034f9abd49cab993b21121a585b59e0da75f3cbd9d025145ad4a3635e54008e156eda2f546ce0154bb992b60364f661843388edf66a629056dff
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 0.2.5 (2014/08/05)
2
+
3
+ Enhancements:
4
+
5
+ * Add `bundle_rsync_shared_dirs` and `bundle_rsync_shared_rsync_options` options
6
+
1
7
  # 0.2.4 (2014/07/28)
2
8
 
3
9
  Changes:
data/README.md CHANGED
@@ -56,12 +56,14 @@ bundle_rsync_local_mirror_path | `#{base_path}/mirror"` | Path where to mirror y
56
56
  bundle_rsync_local_releases_path | `"#{base_path}/releases"` | Path of the directory to checkout your repository
57
57
  bundle_rsync_local_release_path | `"#{releases_path}/#{datetime}"` | Path to checkout your repository (releases_path + release_name)
58
58
  bundle_rsync_local_bundle_path | `"#{base_path}/bundle"` | Path where to bundle install gems.
59
- bundle_rsync_config_files | `nil` | Additional files to rsync. Specified files are copied into `config` directory.
60
59
  bundle_rsync_ssh_options | `ssh_options` | Configuration of ssh for rsync. Default uses the value of `ssh_options`
61
60
  bundle_rsync_keep_releases | `keep_releases` | The number of releases to keep on .local_repo
62
61
  bundle_rsync_max_parallels | number of hosts | Number of concurrency. The default is the number of hosts to deploy.
63
62
  bundle_rsync_rsync_bwlimit | nil | Configuration of rsync --bwlimit (KBPS) option. Not Avabile if `bundle_rsync_rsync_options` is specified.
64
63
  bundle_rsync_rsync_options | `-az --delete` | Configuration of rsync options.
64
+ bundle_rsync_config_files | `nil` | Additional files to rsync. Specified files are copied into `config` directory.
65
+ bundle_rsync_shared_dirs | `nil` | Additional directories to rsync. Specified directories are copied into `shared` directory.
66
+ bundle_rsync_shared_rsync_options | `-az` | Configuration of rsync options for `config_files` and `shared_dirs`
65
67
  bundle_rsync_skip_bundle | false | (Secret option) Do not `bundle` and rsync bundle.
66
68
 
67
69
  ## Task Orders
@@ -73,6 +75,7 @@ bundle_rsync_skip_bundle | false | (Secret option) Do not `bundle` and rsync bun
73
75
  ** Execute bundle_rsync:create_release
74
76
  ** Execute bundle_rsync:bundler:install
75
77
  ** Execute bundle_rsync:rsync_release
78
+ ** Execute bundle_rsync:rsync_shared
76
79
  ** Execute bundle_rsync:bundler:rsync
77
80
  ** Execute bundle_rsync:set_current_revision
78
81
  ```
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "capistrano-bundle_rsync"
7
- spec.version = "0.2.4"
7
+ spec.version = "0.2.5"
8
8
  spec.authors = ["sonots", "tohae"]
9
9
  spec.email = ["sonots@gmail.com", "tohaechan@gmail.com"]
10
10
  spec.description = %q{Deploy an application and bundled gems via rsync}
@@ -14,6 +14,7 @@ set :deploy_to, "#{ENV['HOME']}/sample"
14
14
  set :scm, :bundle_rsync
15
15
  set :bundle_rsync_max_parallels, ENV['PARA']
16
16
  set :bundle_rsync_rsync_bwlimit, ENV['BWLIMIT'] # like 20000
17
+ set :bundle_rsync_shared_dirs, File.expand_path('..', __dir__) # rsync example to shared/example
17
18
 
18
19
  namespace :deploy do
19
20
  desc 'Restart web application'
@@ -25,6 +25,11 @@ module Capistrano::BundleRsync
25
25
  config_files.is_a?(Array) ? config_files : [config_files]
26
26
  end
27
27
 
28
+ def self.shared_dirs
29
+ return nil unless shared_dirs = fetch(:bundle_rsync_shared_dirs)
30
+ shared_dirs.is_a?(Array) ? shared_dirs : [shared_dirs]
31
+ end
32
+
28
33
  # Build ssh command options for rsync
29
34
  #
30
35
  # First, search available user and keys configurations for each role:
@@ -84,6 +89,11 @@ module Capistrano::BundleRsync
84
89
  fetch(:bundle_rsync_rsync_options) || "-az --delete#{bwlimit}"
85
90
  end
86
91
 
92
+ def self.shared_rsync_options
93
+ bwlimit = fetch(:bundle_rsync_rsync_bwlimit) ? " --bwlimit #{fetch(:bundle_rsync_rsync_bwlimit)}" : ""
94
+ fetch(:bundle_rsync_shared_sync_options) || "-az#{bwlimit}"
95
+ end
96
+
87
97
  def self.skip_bundle
88
98
  fetch(:bundle_rsync_skip_bundle)
89
99
  end
@@ -80,6 +80,38 @@ class Capistrano::BundleRsync::SCM < Capistrano::BundleRsync::Base
80
80
  )
81
81
  end
82
82
 
83
+ # @abstract
84
+ #
85
+ # Rsync arbitrary contents to shared directory
86
+ #
87
+ # This is an additional task endpoint provided by capistrano-bundle_rsync
88
+ #
89
+ # @return void
90
+ def rsync_shared
91
+ hosts = release_roles(:all)
92
+ rsync_options = config.shared_rsync_options
93
+
94
+ if config_files = config.config_files
95
+ Parallel.each(hosts, in_threads: config.max_parallels(hosts)) do |host|
96
+ ssh = config.build_ssh_command(host)
97
+ config_files.each do |config_file|
98
+ basename = File.basename(config_file)
99
+ execute :rsync, "#{rsync_options} --rsh='#{ssh}' #{config_file} #{host}:#{release_path}/config/#{basename}"
100
+ end
101
+ end
102
+ end
103
+
104
+ if shared_dirs = config.shared_dirs
105
+ Parallel.each(hosts, in_threads: config.max_parallels(hosts)) do |host|
106
+ ssh = config.build_ssh_command(host)
107
+ shared_dirs.each do |shared_dir|
108
+ basename = File.basename(shared_dir)
109
+ execute :rsync, "#{rsync_options} --rsh='#{ssh}' #{shared_dir}/ #{host}:#{shared_path}/#{basename}/"
110
+ end
111
+ end
112
+ end
113
+ end
114
+
83
115
  # @abstract
84
116
  #
85
117
  # Identify the SHA of the commit that will be deployed. This will most likely involve SshKit's capture method.
@@ -83,6 +83,14 @@ namespace :bundle_rsync do
83
83
  end
84
84
  end
85
85
 
86
+ # additional extra tasks of bundle_rsync scm
87
+ desc 'Rsync shared'
88
+ task :rsync_shared do
89
+ run_locally do
90
+ scm.rsync_shared
91
+ end
92
+ end
93
+
86
94
  desc 'Determine the revision that will be deployed'
87
95
  task :set_current_revision do
88
96
  run_locally do
@@ -92,6 +100,7 @@ namespace :bundle_rsync do
92
100
 
93
101
  after 'bundle_rsync:create_release', 'bundle_rsync:bundler:install'
94
102
  after 'bundle_rsync:bundler:install', 'bundle_rsync:rsync_release'
95
- after 'bundle_rsync:rsync_release', 'bundle_rsync:bundler:rsync'
103
+ after 'bundle_rsync:rsync_release', 'bundle_rsync:rsync_shared'
104
+ after 'bundle_rsync:rsync_shared', 'bundle_rsync:bundler:rsync'
96
105
  end
97
106
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-bundle_rsync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - sonots
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-07-26 00:00:00.000000000 Z
12
+ date: 2014-08-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano