engineyard-eycap 0.4.5 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,6 @@
1
+ == 0.4.6 / 2009-03-24
2
+ * fixed bug to restore clone_prod_to_staging using the compressed file
3
+
1
4
  == 0.4.5 / 2009-03-03
2
5
  * happy square root day!
3
6
  * added the staging restore to db:clone_prod_to_staging
data/Manifest.txt CHANGED
@@ -3,6 +3,7 @@ Manifest.txt
3
3
  README.txt
4
4
  Rakefile
5
5
  lib/capistrano/recipes/deploy/strategy/filtered_remote_cache.rb
6
+ lib/capistrano/recipes/deploy/strategy/remote_cache.rb
6
7
  lib/eycap.rb
7
8
  lib/eycap/lib/ey_logger.rb
8
9
  lib/eycap/lib/ey_logger_hooks.rb
@@ -0,0 +1,56 @@
1
+ require 'capistrano/recipes/deploy/strategy/remote'
2
+
3
+ module Capistrano
4
+ module Deploy
5
+ module Strategy
6
+
7
+ # Implements the deployment strategy that keeps a cached checkout of
8
+ # the source code on each remote server. Each deploy simply updates the
9
+ # cached checkout, and then does a copy from the cached copy to the
10
+ # final deployment location.
11
+ class RemoteCache < Remote
12
+ # Executes the SCM command for this strategy and writes the REVISION
13
+ # mark file to each host.
14
+ def deploy!
15
+ update_repository_cache
16
+ copy_repository_cache
17
+ end
18
+
19
+ def check!
20
+ super.check do |d|
21
+ d.remote.writable(shared_path)
22
+ end
23
+ end
24
+
25
+ private
26
+
27
+ def repository_cache
28
+ File.join(configuration[:repository_cache] || "cached-copy")
29
+ end
30
+
31
+ def update_repository_cache
32
+ logger.trace "updating the cached checkout on all servers"
33
+ command = "if [ -d #{repository_cache} ]; then " +
34
+ "#{source.sync(revision, repository_cache)}; " +
35
+ "else #{source.checkout(revision, repository_cache)}; fi"
36
+ scm_run(command)
37
+ end
38
+
39
+ def copy_repository_cache
40
+ logger.trace "copying the cached version to #{configuration[:release_path]}"
41
+ if copy_exclude.empty?
42
+ run "cp -RPp #{repository_cache} #{configuration[:release_path]} && #{mark}"
43
+ else
44
+ exclusions = copy_exclude.map { |e| "--exclude=\"#{e}\"" }.join(' ')
45
+ run "rsync -lrp #{exclusions} #{repository_cache}/* #{configuration[:release_path]} && #{mark}"
46
+ end
47
+ end
48
+
49
+ def copy_exclude
50
+ @copy_exclude ||= Array(configuration.fetch(:copy_exclude, []))
51
+ end
52
+ end
53
+
54
+ end
55
+ end
56
+ end
@@ -25,14 +25,14 @@ Capistrano::Configuration.instance(:must_exist).load do
25
25
  run "mysqldump --add-drop-table -u #{dbuser} -h #{dbhost} -p #{environment_database} | bzip2 -c > #{backup_file}.bz2" do |ch, stream, out |
26
26
  ch.send_data "#{dbpass}\n" if out=~ /^Enter password:/
27
27
  end
28
- run "mysql -u #{dbuser} -p -h #{staging_dbhost} #{staging_database} < #{backup_file}" do |ch, stream, out|
28
+ run "bzcat #{backup_file}.bz2 | mysql -u #{dbuser} -p -h #{staging_dbhost} #{staging_database}" do |ch, stream, out|
29
29
  ch.send_data "#{dbpass}\n" if out=~ /^Enter password:/
30
30
  end
31
31
  else
32
- run "pg_dump -W -c -U #{dbuser} -h #{production_dbhost} -f #{backup_file} #{production_database}" do |ch, stream, out|
32
+ run "pg_dump -W -c -U #{dbuser} -h #{production_dbhost} #{production_database} | bzip2 -c > #{backup_file}.bz2" do |ch, stream, out|
33
33
  ch.send_data "#{dbpass}\n" if out=~ /^Password:/
34
34
  end
35
- run "psql -W -U #{dbuser} -h #{staging_dbhost} -f #{backup_file} #{staging_database}" do |ch, stream, out|
35
+ run "bzcat #{backup_file}.bz2 | psql -W -U #{dbuser} -h #{staging_dbhost} #{staging_database}" do |ch, stream, out|
36
36
  ch.send_data "#{dbpass}\n" if out=~ /^Password:/
37
37
  end
38
38
  end
data/lib/eycap.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eycap
2
- VERSION = '0.4.5'
2
+ VERSION = '0.4.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: engineyard-eycap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Engine Yard
@@ -48,6 +48,7 @@ files:
48
48
  - README.txt
49
49
  - Rakefile
50
50
  - lib/capistrano/recipes/deploy/strategy/filtered_remote_cache.rb
51
+ - lib/capistrano/recipes/deploy/strategy/remote_cache.rb
51
52
  - lib/eycap.rb
52
53
  - lib/eycap/lib/ey_logger.rb
53
54
  - lib/eycap/lib/ey_logger_hooks.rb