capsum 1.0.8 → 1.1.0

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: 57e6e6a836aee6aa424c46e97f36d2202b047b4f
4
- data.tar.gz: '08ac801ce0dd2973d048b734bc07bd06bcff1968'
3
+ metadata.gz: 25710bb189d3cbee3e3930fa820866f211cd2daf
4
+ data.tar.gz: d341bf0cb34b32dd3ed63b0dac5c118f245e7f66
5
5
  SHA512:
6
- metadata.gz: 49c58efcee8f8f55de26305036de77bf2559d51d67af5c98bebde55590fa6e69ca71d4e30d40c8e51fbcd2de8550279f81ec9726a76cadb3a935e86b0006ad10
7
- data.tar.gz: ac0d7b537af5fae58898c7f75e1099055945231ca16ac0e6ea0960a6a2a6146d927ccc75834c092b95c56e3afd6dd2e8ab21e766dcb691faa9143fdaa7239b46
6
+ metadata.gz: b33875284c5c307f39837cee76ac6a89e83ee1e9c39ebdcd3c3e866074c4f1abb74a3227101e6f823fa41437d8ac621da39283b2d61c6967d1b83bee1cc15d80
7
+ data.tar.gz: ab11757575e9e48dde39d8c445aed3dec9931e9018c44e49f2f129578178e8ab70e3cbb67d02d4142f9e51abf3cc8a8f0179139055c7ab175af37133cd8d92f3
data/README.md CHANGED
@@ -20,6 +20,9 @@ require 'capistrano/deploy'
20
20
 
21
21
  require "capsum/typical" # for rails project
22
22
  # require "capsum/sidekiq"
23
+
24
+ require "capsum/rsync"
25
+ install_plugin Capsum::Rsync
23
26
  ~~~~
24
27
 
25
28
  ### ./config/deploy.rb
@@ -19,9 +19,9 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  # Dependency Gems
22
- spec.add_dependency "capistrano", "~> 3.6.1"
22
+ spec.add_dependency "capistrano", "~> 3.8.1"
23
23
  # spec.add_dependency "capistrano-rsync", "~> 1.0.2" # broken, wait update
24
- spec.add_dependency "capistrano-rails", "~> 1.1.8"
24
+ spec.add_dependency "capistrano-rails", "~> 1.3.0"
25
25
  spec.add_development_dependency "capistrano-sidekiq", Capsum::CAPISTRANO_SIDEKIQ_REQUIREMENT # optional
26
26
 
27
27
  # spec.add_dependency "capistrano-helpers", "~> 0.7.1"
@@ -2,7 +2,7 @@ require "capsum"
2
2
  require "capsum/git"
3
3
  require "capsum/shared"
4
4
  require "capistrano/console"
5
- require "capistrano/rsync"
5
+ require File.expand_path("../remote_env.rb", __FILE__)
6
6
 
7
7
  namespace :load do
8
8
  task :defaults do
@@ -13,9 +13,7 @@ namespace :load do
13
13
  fetch(:linked_files) { set :linked_files, [] }
14
14
  fetch(:linked_dirs) { set :linked_dirs, [] }
15
15
 
16
- set :scm, :rsync
17
-
18
- default_env[:https_proxy] = default_env[:http_proxy] = ENV["proxy"] if ENV["proxy"]
16
+ remote_env[:https_proxy] = remote_env[:http_proxy] = ENV["proxy"] if ENV["proxy"]
19
17
  end
20
18
  end
21
19
 
@@ -0,0 +1,23 @@
1
+ module Capistrano
2
+ module DSL
3
+ def remote_env
4
+ fetch(:remote_env)
5
+ end
6
+ end
7
+ end
8
+
9
+ module Capsum
10
+ module RemoteEnv
11
+ set_if_empty :remote_env, {}
12
+
13
+ def on(hosts, options={}, &block)
14
+ super(hosts, options) do
15
+ with remote_env do
16
+ instance_eval(&block)
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+
23
+ extend Capsum::RemoteEnv
@@ -0,0 +1,24 @@
1
+ require "capistrano/scm/plugin"
2
+
3
+ class Capsum::Rsync < Capistrano::SCM::Plugin
4
+ def set_defaults
5
+ set_if_empty :rsync_options, %w(--links --recursive --delete --delete-excluded --exclude .git*)
6
+ set_if_empty :rsync_copy, "rsync --archive --acls --xattrs"
7
+
8
+ # Stage is used on your local machine for rsyncing from.
9
+ set_if_empty :rsync_stage, "tmp/deploy"
10
+
11
+ # Cache is used on the server to copy files to from to the release directory.
12
+ set_if_empty :rsync_cache, "shared/deploy"
13
+ end
14
+
15
+ def register_hooks
16
+ after "deploy:new_release_path", "rsync:create_release"
17
+ before "deploy:check", "rsync:check"
18
+ before "deploy:set_current_revision", "rsync:set_current_revision"
19
+ end
20
+
21
+ def define_tasks
22
+ eval_rakefile File.expand_path("../tasks/rsync.rake", __FILE__)
23
+ end
24
+ end
@@ -1,11 +1,4 @@
1
- set_if_empty :rsync_options, %w(--links --recursive --delete --delete-excluded --exclude .git*)
2
- set_if_empty :rsync_copy, "rsync --archive --acls --xattrs"
3
-
4
- # Stage is used on your local machine for rsyncing from.
5
- set_if_empty :rsync_stage, "tmp/deploy"
6
-
7
- # Cache is used on the server to copy files to from to the release directory.
8
- set_if_empty :rsync_cache, "shared/deploy"
1
+ rsync_plugin = self
9
2
 
10
3
  rsync_cache = lambda do
11
4
  cache = fetch(:rsync_cache)
@@ -60,8 +53,7 @@ namespace :rsync do
60
53
  end
61
54
 
62
55
  desc "Stage and rsync to the server (or its cache)."
63
- task :sync => %w(stage) do
64
-
56
+ task sync: %w(stage) do
65
57
  roles(:all).each do |role|
66
58
  user = role.user + "@" if role.user
67
59
 
@@ -75,17 +67,15 @@ namespace :rsync do
75
67
  rsync << fetch(:rsync_stage) + "/"
76
68
  rsync << "#{user}#{role.hostname}:#{rsync_cache.call || release_path}"
77
69
 
78
- # Kernel.system *rsync
79
70
  run_locally { execute *rsync }
80
71
  end
81
72
  end
82
73
 
83
74
  desc "Copy the code to the releases directory."
84
- task :create_release => %w(sync) do
75
+ task create_release: %w(sync) do
85
76
  # Skip copying if we've already synced straight to the release directory.
86
77
  next if !fetch(:rsync_cache)
87
78
 
88
-
89
79
  folder = fetch(:rsync_folder, "/")
90
80
  copy = %(#{fetch(:rsync_copy)} "#{rsync_cache.call}#{folder}" "#{release_path}/")
91
81
  on roles(:all) do
@@ -1,4 +1,4 @@
1
1
  module Capsum
2
- VERSION = "1.0.8"
3
- CAPISTRANO_SIDEKIQ_REQUIREMENT = "~> 0.5.4"
2
+ VERSION = "1.1.0"
3
+ CAPISTRANO_SIDEKIQ_REQUIREMENT = "~> 0.10.0"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capsum
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sunteya
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-10 00:00:00.000000000 Z
11
+ date: 2017-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 3.6.1
19
+ version: 3.8.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 3.6.1
26
+ version: 3.8.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: capistrano-rails
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.1.8
33
+ version: 1.3.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.1.8
40
+ version: 1.3.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: capistrano-sidekiq
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.5.4
47
+ version: 0.10.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.5.4
54
+ version: 0.10.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -94,8 +94,6 @@ files:
94
94
  - README.md
95
95
  - Rakefile
96
96
  - capsum.gemspec
97
- - lib/capistrano/rsync.rb
98
- - lib/capistrano/tasks/rsync.rake
99
97
  - lib/capsum.rb
100
98
  - lib/capsum/autostart.rb
101
99
  - lib/capsum/bundler.rb
@@ -105,8 +103,11 @@ files:
105
103
  - lib/capsum/git.rb
106
104
  - lib/capsum/passenger.rb
107
105
  - lib/capsum/patch_sshkit_force_encoding_to_utf8.rb
106
+ - lib/capsum/remote_env.rb
107
+ - lib/capsum/rsync.rb
108
108
  - lib/capsum/shared.rb
109
109
  - lib/capsum/sidekiq.rb
110
+ - lib/capsum/tasks/rsync.rake
110
111
  - lib/capsum/typical.rb
111
112
  - lib/capsum/version.rb
112
113
  - lib/capsum/whenever.rb
@@ -1 +0,0 @@
1
- load File.expand_path("../tasks/rsync.rake", __FILE__)