Permalink
Browse files

memoize these variables since capistrano apparently calls them a numb…

…er of times
  • Loading branch information...
1 parent e26f5fe commit 6e2e5dec8546d8d165995896f89a5d67a400adc1 @tilsammans committed Aug 4, 2011
Showing with 5 additions and 4 deletions.
  1. +1 −1 capistrano_transmit.gemspec
  2. +4 −3 lib/capistrano/transmit.rb
View
2 capistrano_transmit.gemspec
@@ -2,7 +2,7 @@
Gem::Specification.new do |s|
s.name = %q{capistrano_transmit}
- s.version = "0.2.8"
+ s.version = "0.2.9"
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
s.authors = ["Joost Baaij"]
View
7 lib/capistrano/transmit.rb
@@ -4,6 +4,7 @@
Capistrano::Configuration.instance.load do
+ _cset :user, nil
_cset(:deploy_host) { find_servers(:roles => :db).first.host }
_cset(:dumpfile) { "#{current_path}/tmp/#{_db_remote['database']}.sql.gz" }
@@ -49,17 +50,17 @@ def _user_with_host
# Output of the entire database.yml on the remote server.
def _db_config
- capture("cat #{current_path}/config/database.yml")
+ @_db_config ||= capture("cat #{current_path}/config/database.yml")
end
# Production database configuration hash.
def _db_remote
- YAML::load(_db_config)['production']
+ @_db_remote ||= YAML::load(_db_config)['production']
end
# Development database configuration hash.
def _db_local
- YAML::load_file("config/database.yml")['development']
+ @_db_local ||= YAML::load_file("config/database.yml")['development']
end
end

0 comments on commit 6e2e5de

Please sign in to comment.