alcapon 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/capez.rb +34 -2
  2. metadata +7 -12
data/lib/capez.rb CHANGED
@@ -51,6 +51,15 @@ namespace :deploy do
51
51
 
52
52
  end
53
53
 
54
+ namespace :deploy do
55
+ namespace :rollback do
56
+ task :cleanup, :except => { :no_release => true } do
57
+ run( "if [ `readlink #{current_path}` != #{current_release} ]; then #{sudo} rm -rf #{current_release}; fi" )
58
+ end
59
+ end
60
+ end
61
+
62
+
54
63
  namespace :capez do
55
64
 
56
65
  namespace :cache do
@@ -101,8 +110,8 @@ namespace :capez do
101
110
  desc <<-DESC
102
111
  Sync your var directory with a remote one
103
112
  DESC
104
- task :sync, :roles => :web, :only => { :primary => true } do
105
- confirmation = Capistrano::CLI.ui.ask "You're about to sync your local var/ directory with a remote one (current stage = #{stage}). Are you sure (y/N) ?"
113
+ task :sync_to_local, :roles => :web, :only => { :primary => true } do
114
+ confirmation = Capistrano::CLI.ui.ask "You're about to sync your local var/ directory FROM a remote one (current stage = #{stage}). Are you sure (y/N) ?"
106
115
  abort "Aborted" unless confirmation.downcase == 'y'
107
116
 
108
117
  shared_host = fetch( :shared_host, nil )
@@ -118,6 +127,29 @@ namespace :capez do
118
127
  run_locally( "rsync -az #{exclude_string} #{user}@#{shared_host}:#{shared_path}/var/* var/" )
119
128
  end
120
129
 
130
+ desc <<-DESC
131
+ Sync your a remote var folder with local datas
132
+ DESC
133
+ task :sync_to_remote, :roles => :web, :only => { :primary => true } do
134
+ confirmation = Capistrano::CLI.ui.ask "You're about to sync your local var/ directory TO a remote one (current stage = #{stage}). Are you sure (y/N) ?"
135
+ abort "Aborted" unless confirmation.downcase == 'y'
136
+
137
+ shared_host = fetch( :shared_host, nil )
138
+ abort "Please set 'shared_host'" if shared_host == nil
139
+
140
+ # TODO : make it configurable
141
+ exclude_string = ""
142
+ exclude_paths = [ "/cache", "/log", "/*/cache", "/*/log", "/autoload" ]
143
+ exclude_paths.each{ |item|
144
+ exclude_string << "--exclude '#{item}' "
145
+ }
146
+
147
+ try_sudo( "chown -R #{user}:#{webserver_user} #{shared_path}/var/*" )
148
+ run_locally( "rsync -az #{exclude_string} var/* #{user}@#{shared_host}:#{shared_path}/var/ " )
149
+ try_sudo( "chown -R #{webserver_user} #{shared_path}/var/*" )
150
+ try_sudo( "chmod -R ug+rwx #{shared_path}/var/*" )
151
+ end
152
+
121
153
  end
122
154
  # End of namespace :capez:var
123
155
 
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alcapon
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease:
4
+ prerelease: false
6
5
  segments:
7
6
  - 0
8
- - 1
7
+ - 2
9
8
  - 0
10
- version: 0.1.0
9
+ version: 0.2.0
11
10
  platform: ruby
12
11
  authors:
13
12
  - Arnaud Lafon
@@ -15,17 +14,16 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2012-07-10 00:00:00 Z
17
+ date: 2012-10-18 00:00:00 +02:00
18
+ default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: capistrano
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
24
  requirements:
26
25
  - - ">="
27
26
  - !ruby/object:Gem::Version
28
- hash: 63
29
27
  segments:
30
28
  - 2
31
29
  - 12
@@ -47,6 +45,7 @@ files:
47
45
  - lib/db.rb
48
46
  - README.md
49
47
  - LICENSE.md
48
+ has_rdoc: true
50
49
  homepage: http://alafon.github.com/alcapon
51
50
  licenses: []
52
51
 
@@ -56,27 +55,23 @@ rdoc_options: []
56
55
  require_paths:
57
56
  - lib
58
57
  required_ruby_version: !ruby/object:Gem::Requirement
59
- none: false
60
58
  requirements:
61
59
  - - ">="
62
60
  - !ruby/object:Gem::Version
63
- hash: 3
64
61
  segments:
65
62
  - 0
66
63
  version: "0"
67
64
  required_rubygems_version: !ruby/object:Gem::Requirement
68
- none: false
69
65
  requirements:
70
66
  - - ">="
71
67
  - !ruby/object:Gem::Version
72
- hash: 3
73
68
  segments:
74
69
  - 0
75
70
  version: "0"
76
71
  requirements: []
77
72
 
78
73
  rubyforge_project:
79
- rubygems_version: 1.8.24
74
+ rubygems_version: 1.3.6
80
75
  signing_key:
81
76
  specification_version: 3
82
77
  summary: Enable Capistrano for your eZ Publish projects