rails_db_dump 0.1.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +5 -0
- data/README.md +18 -8
- data/lib/rails_db_dump/tasks.rb +2 -4
- data/lib/rails_db_dump/version.rb +1 -1
- metadata +24 -45
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c148c61085a90715676e3cd726068f1efb43451e
|
4
|
+
data.tar.gz: 6663201a9255c48fb3584feb9f4209713daf7637
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cbb490599050e9b709e1bed85ed7200d56440b09c4d2ee5cb96909f9beb6d984399ee7eee6024366f3639be3679c0177a7509d10686f8372047eee32c2cc6a66
|
7
|
+
data.tar.gz: 17894808147063858e20483df1556b3e52d844b4bce467f99e119a8d59f0d574e8d304be596d31886302116c6d5545e9d1aa3d7336b38d8e96d6303060621513
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# rails_db_dump
|
2
2
|
|
3
|
-
|
3
|
+
Adds a Rake command to dump and restore the application's database.
|
4
|
+
|
5
|
+
Delegates to regular dumping utilities such as `mysqldump` and `pg_dump`. Unlike them, you *don't* have to remember any proper syntax.
|
6
|
+
|
7
|
+
You don't have to specify the connection parameters either; if the application works the dumper works, too.
|
4
8
|
|
5
9
|
## Usage
|
6
10
|
|
@@ -14,17 +18,23 @@ Pass a `TABLE_NAME` environment variable to dump a single table:
|
|
14
18
|
|
15
19
|
There is also a symmetrical task, `rake db:restore`, which restores the database from standard input.
|
16
20
|
|
17
|
-
##
|
21
|
+
## Requirements
|
18
22
|
|
19
|
-
Rails 3
|
23
|
+
Rails versions 2.3 through 4.2 are tested and supported.
|
20
24
|
|
21
|
-
|
25
|
+
Supported database engines: MySQL, PostgreSQL, SQLite. The command line utilities must be available from the PATH:
|
22
26
|
|
23
|
-
|
27
|
+
* for MySQL - `mysqldump`;
|
28
|
+
* for PostgreSQL - `pg_dump`;
|
29
|
+
* for SQLite - `sqlite` or `sqlite3`.
|
30
|
+
|
31
|
+
## Installation
|
32
|
+
|
33
|
+
Rails 3 and later: add `gem rails_db_dump, '~>1.0.0'` to your Gemfile.
|
24
34
|
|
25
|
-
|
35
|
+
Rails 2.3: add the gem to your environment; add `require 'rails_db_dump/tasks'` to the end of `Rakefile`.
|
26
36
|
|
27
|
-
##
|
37
|
+
## Integration with other tools
|
28
38
|
|
29
39
|
The thought behind this plugin was to do one thing and do it good, and that is reuse the existings database settings to provide database dumping functionality.
|
30
40
|
|
@@ -44,4 +54,4 @@ Or use `rsnapshot` to rotate backups.
|
|
44
54
|
|
45
55
|
* * *
|
46
56
|
|
47
|
-
©
|
57
|
+
© 2015 Leonid Shevtsov, released under the MIT license
|
data/lib/rails_db_dump/tasks.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
namespace :db do
|
2
2
|
desc "Dump the database to standard output. Pass a TABLE_NAME environment variable to dump a single table"
|
3
|
-
task :dump do
|
4
|
-
|
5
|
-
config = YAML.load_file(File.join(Rails.root,'config','database.yml'))[Rails.env]
|
3
|
+
task :dump => :environment do
|
4
|
+
config = Rails.configuration.database_configuration[Rails.env]
|
6
5
|
table_name = ENV['TABLE_NAME']
|
7
6
|
|
8
7
|
case config["adapter"]
|
@@ -46,7 +45,6 @@ namespace :db do
|
|
46
45
|
|
47
46
|
desc "Restore the database from standard input."
|
48
47
|
task :restore do
|
49
|
-
# Doesn't get any simpler than that!
|
50
48
|
if Rails.version > '3'
|
51
49
|
exec 'rails', 'dbconsole', '--include-password'
|
52
50
|
else
|
metadata
CHANGED
@@ -1,35 +1,26 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_db_dump
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 1
|
10
|
-
version: 0.1.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Leonid Shevtsov
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2011-02-22 00:00:00 +02:00
|
19
|
-
default_executable:
|
11
|
+
date: 2015-06-19 00:00:00.000000000 Z
|
20
12
|
dependencies: []
|
21
|
-
|
22
|
-
|
23
|
-
|
13
|
+
description: rails_db_dump is a wrapper for the native dumper of whatever database
|
14
|
+
engine you're using, taking access parameters from database.yml. Supports mysql,
|
15
|
+
postgresql and sqlite at the moment.
|
16
|
+
email:
|
24
17
|
- leonid@shevtsov.me
|
25
18
|
executables: []
|
26
|
-
|
27
19
|
extensions: []
|
28
|
-
|
29
20
|
extra_rdoc_files: []
|
30
|
-
|
31
|
-
|
32
|
-
- .
|
21
|
+
files:
|
22
|
+
- ".gitignore"
|
23
|
+
- CHANGELOG.md
|
33
24
|
- Gemfile
|
34
25
|
- README.md
|
35
26
|
- Rakefile
|
@@ -38,39 +29,27 @@ files:
|
|
38
29
|
- lib/rails_db_dump/tasks.rb
|
39
30
|
- lib/rails_db_dump/version.rb
|
40
31
|
- rails_db_dump.gemspec
|
41
|
-
has_rdoc: true
|
42
32
|
homepage: https://github.com/leonid-shevtsov/rails_db_dump
|
43
33
|
licenses: []
|
44
|
-
|
34
|
+
metadata: {}
|
45
35
|
post_install_message:
|
46
36
|
rdoc_options: []
|
47
|
-
|
48
|
-
require_paths:
|
37
|
+
require_paths:
|
49
38
|
- lib
|
50
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
-
|
52
|
-
requirements:
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
53
41
|
- - ">="
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
version: "0"
|
59
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
-
none: false
|
61
|
-
requirements:
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
62
46
|
- - ">="
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
|
65
|
-
segments:
|
66
|
-
- 0
|
67
|
-
version: "0"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
68
49
|
requirements: []
|
69
|
-
|
70
50
|
rubyforge_project:
|
71
|
-
rubygems_version:
|
51
|
+
rubygems_version: 2.4.5
|
72
52
|
signing_key:
|
73
|
-
specification_version:
|
53
|
+
specification_version: 4
|
74
54
|
summary: dump your Rails database with a simple rake task
|
75
55
|
test_files: []
|
76
|
-
|