capistrano-db-pull 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 23e7fa198b7f768db665cdf3f2817607065e14a3
4
+ data.tar.gz: 4cb1921a81df400f094149ce22a152037ea89bb4
5
+ SHA512:
6
+ metadata.gz: 92fb33b8b8d30ba9e178a2fd69bb82c5f58b2fd172e17a1b303f358bbc6c1c832e0baf72c55a40f4c95d93faf078c3575407489a42cb09ca67d8af6ab5ec3882
7
+ data.tar.gz: 8973045627fadb3538b5605e9c32eafff1dc2a95d6acd19c7ab2664afb438fdab3e96c672f56af9a9367e3f9f461b39534b079732ba4334a1079c080f41728e2
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ *.gem
data/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ Copyright (c) 2016, ivaldi
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+
10
+ * Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the documentation
12
+ and/or other materials provided with the distribution.
13
+
14
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
18
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,19 @@
1
+ $:.push File.expand_path('../lib', __FILE__)
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = 'capistrano-db-pull'
5
+ s.version = '0.0.1'
6
+ s.licenses = ['BSD-2-Clause']
7
+
8
+ s.summary = 'Download remote database to local database'
9
+ s.description = 'Capistrano task to download a remote database to a local
10
+ database, converting between different formats on-the-fly.'
11
+
12
+ s.authors = ['Frank Groeneveld']
13
+ s.email = ['frank@ivaldi.nl']
14
+ s.homepage = 'https://github.com/ivaldi/capistrano-db-pull'
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+
18
+ s.add_runtime_dependency 'capistrano', '~> 3.0'
19
+ end
File without changes
@@ -0,0 +1 @@
1
+ load File.expand_path('../../tasks/db-pull.rake', __FILE__)
@@ -0,0 +1,26 @@
1
+ namespace :db do
2
+ task :pull do
3
+ on roles(:db) do
4
+ execute "pg_dump --data-only --exclude-table=schema_migrations --column-inserts | gzip -9 > #{fetch(:application)}.sql.gz"
5
+ download! "#{fetch(:application)}.sql.gz", "#{fetch(:application)}.sql.gz"
6
+ execute "rm #{fetch(:application)}.sql.gz"
7
+ end
8
+
9
+ system "echo 'BEGIN;' > #{fetch(:application)}.sql"
10
+ system "gunzip -c #{fetch(:application)}.sql.gz | sed '/^SET/ d' |\
11
+ sed '/^SELECT pg_catalog.setval/ d' |\
12
+ sed \"s/ true,/ 't',/g\" |\
13
+ sed \"s/ false,/ 'f',/g\" |\
14
+ sed \"s/(true/('t'/g\" |\
15
+ sed \"s/(false/('f'/g\" |\
16
+ sed \"s/true)/'t')/g\" |\
17
+ sed \"s/false)/'f')/g\" >> #{fetch(:application)}.sql"
18
+ system "echo 'END;' >> #{fetch(:application)}.sql"
19
+
20
+ system "bin/rake db:drop && bin/rake db:schema:load &&
21
+ cat #{fetch(:application)}.sql | sqlite3 db/development.sqlite3"
22
+
23
+ system "rm #{fetch(:application)}.sql"
24
+ system "rm #{fetch(:application)}.sql.gz"
25
+ end
26
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-db-pull
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Frank Groeneveld
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-02-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: capistrano
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ description: |-
28
+ Capistrano task to download a remote database to a local
29
+ database, converting between different formats on-the-fly.
30
+ email:
31
+ - frank@ivaldi.nl
32
+ executables: []
33
+ extensions: []
34
+ extra_rdoc_files: []
35
+ files:
36
+ - ".gitignore"
37
+ - LICENSE
38
+ - capistrano-db-pull.gemspec
39
+ - lib/capistrano-db-pull.rb
40
+ - lib/capistrano/db/pull.rb
41
+ - lib/capistrano/tasks/db-pull.rake
42
+ homepage: https://github.com/ivaldi/capistrano-db-pull
43
+ licenses:
44
+ - BSD-2-Clause
45
+ metadata: {}
46
+ post_install_message:
47
+ rdoc_options: []
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ requirements: []
61
+ rubyforge_project:
62
+ rubygems_version: 2.5.1
63
+ signing_key:
64
+ specification_version: 4
65
+ summary: Download remote database to local database
66
+ test_files: []