Permalink
Browse files

Cleanup & new gemspec

  • Loading branch information...
1 parent 84d1d75 commit 29fc7729716fdc9c1f9a71ecccdca09208dc021c Cas Ebbers committed Jul 21, 2011
Showing with 33 additions and 47 deletions.
  1. +33 −0 capistrano_transmit.gemspec
  2. +0 −47 recipes/deploy.rb
View
33 capistrano_transmit.gemspec
@@ -0,0 +1,33 @@
+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+ s.name = %q{capistrano_transmit}
+ s.version = "0.1.0"
+
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
+ s.authors = ["Joost Baaij"]
+ s.date = %q{2011-07-21}
+ s.description = %q{Copies mysql databases between remote production and local development servers.}
+ s.email = %q{joost@spacebabies.nl}
+ s.extra_rdoc_files = ["README.rdoc", "lib/capistrano/transmit.rb"]
+ s.files = ["MIT-LICENSE", "README.rdoc", "Rakefile", "lib/capistrano/transmit.rb", "Manifest", "capistrano_transmit.gemspec"]
+ s.homepage = %q{http://github.com/tilsammans/capistrano_transmit}
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Capistrano_transmit", "--main", "README.rdoc"]
+ s.require_paths = ["lib"]
+ s.rubyforge_project = %q{capistrano_transmit}
+ s.rubygems_version = %q{1.3.7}
+ s.summary = %q{Copies mysql databases between remote production and local development servers.}
+
+ if s.respond_to? :specification_version then
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
+ s.specification_version = 3
+
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
+ s.add_runtime_dependency(%q<capistrano>, [">= 0"])
+ else
+ s.add_dependency(%q<capistrano>, [">= 0"])
+ end
+ else
+ s.add_dependency(%q<capistrano>, [">= 0"])
+ end
+end
View
47 recipes/deploy.rb
@@ -1,47 +0,0 @@
-after "transmit:get:mysql", "transmit:cleanup"
-after "transmit:put:mysql", "transmit:cleanup"
-
-namespace :transmit do
- namespace :get do
- desc 'Fetch the remote production database and overwrite your local development database with it'
- task :mysql, :roles => :db do
- run "mysqldump --opt --quick --extended-insert --skip-lock-tables -u #{db_remote['username']} --password='#{db_remote['password']}' --host='#{db_remote['host']}' #{db_remote['database']} | gzip > #{dumpfile}"
-
- system "rsync -vP #{user}@#{deploy_host}:#{dumpfile} tmp/#{db_local["database"]}.sql.gz"
- system "gunzip < tmp/#{db_local["database"]}.sql.gz | mysql -u #{db_local['username']} --password='#{db_local['password']}' --host='#{db_local['host']}' #{db_local['database']}"
- end
-
- desc 'Fetch the assets from the production server to the development environment'
- task :assets, :roles => :app do
- system "rsync -Lcrvz #{user}@#{deploy_host}:#{current_path}/public ."
- end
- end
-
- namespace :put do
- desc 'Upload the local development database to the remote production database and overwrite it'
- task :mysql, :roles => :db do
- system "mysqldump --opt -u #{db_local['username']} --password='#{db_local['password']}' --host='#{db_local['host']}' #{db_local['database']} > tmp/#{db_local['database']}.sql"
-
- system "rsync -vP tmp/#{db_local['database']}.sql #{user}@#{deploy_host}:#{dumpfile}"
- run "mysql -u #{db_remote['username']} --password='#{db_remote['password']}' --host='#{db_remote['host']}' #{db_remote['database']} < #{dumpfile}"
- end
- end
-
- task :cleanup do
- run "rm #{dumpfile}"
- system "rm tmp/#{db_local['database']}.sql.gz"
- end
-end
-
-set(:db_remote) do
- db_config = capture "cat #{current_path}/config/database.yml"
- YAML::load(db_config)['production']
-end
-
-set(:db_local) do
- YAML::load_file("config/database.yml")['development']
-end
-
-set :dumpfile do
- "#{current_path}/tmp/#{db_remote['database']}.sql.gz"
-end

0 comments on commit 29fc772

Please sign in to comment.