h2ocube_rails_tasks 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/h2ocube_rails_tasks.gemspec +1 -1
- data/lib/h2ocube_rails_tasks/tasks/mysql.rb +24 -22
- data/lib/h2ocube_rails_tasks/tasks/postgresql.rb +24 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f0771dc85b23d24f5ac04731bcf5bd2015451c4
|
4
|
+
data.tar.gz: 223115b9a78af266e8c4d196d8455fcbc0f4f7b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df514c8b72d9f8427acd55c05991c8f30b600e5ce15dc3aa629b929bf169c897cd897fc73f1fd5ea08abc6315fb53ea9ea243b80bbf9754b79dfa8cd2fbea173
|
7
|
+
data.tar.gz: cfaf2b39b985a8688befdcd140b2e31a5f71207ea7c3b453e4fd15b09a21bce56267fdc57e79f7ec1f9da8e9738873d1201328a6983f59a223f23ae159c360e0
|
data/README.md
CHANGED
@@ -47,6 +47,9 @@ Or install it yourself as:
|
|
47
47
|
rake mysql:dump_all # mysqldump
|
48
48
|
rake mysql:restore_all # restore mysql with dump data
|
49
49
|
|
50
|
+
rake postgresql:dump # pg_dump
|
51
|
+
rake postgresql:restore # pg_restore
|
52
|
+
|
50
53
|
# has config/mongoid.yml
|
51
54
|
rake mongodb:dump # mongodump
|
52
55
|
rake mongodb:restore # mongorestore
|
data/h2ocube_rails_tasks.gemspec
CHANGED
@@ -1,32 +1,34 @@
|
|
1
1
|
if File.exist? Rails.root.join('config/database.yml')
|
2
2
|
namespace :mysql do
|
3
3
|
config = YAML.load(File.read(Rails.root.join('config/database.yml')))[Rails.env.to_s]
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
if config['adapter'] == 'mysql2'
|
5
|
+
db = config['database']
|
6
|
+
host = config['host']
|
7
|
+
FileUtils.mkdir_p Rails.root.join('mysql')
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
backup = "mysqldump -h #{host} #{db} > #{Rails.root}/mysql/dump.sql"
|
10
|
+
desc backup
|
11
|
+
task :dump do
|
12
|
+
zfben_rails_rake_system backup
|
13
|
+
end
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
restore = "mysql -h #{host} #{db} < #{Rails.root}/mysql/dump.sql"
|
16
|
+
desc restore
|
17
|
+
task :restore => 'db:create' do
|
18
|
+
zfben_rails_rake_system restore
|
19
|
+
end
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
backup_all = "mysqldump -h #{host} --all-databases > #{Rails.root}/mysql/dump_all.sql"
|
22
|
+
desc backup_all
|
23
|
+
task :dump_all do
|
24
|
+
zfben_rails_rake_system backup_all
|
25
|
+
end
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
restore_all = "mysql -h #{host} < #{Rails.root}/mysql/dump_all.sql"
|
28
|
+
desc restore_all
|
29
|
+
task :restore_all => 'db:create' do
|
30
|
+
zfben_rails_rake_system restore_all
|
31
|
+
end
|
30
32
|
end
|
31
33
|
end
|
32
34
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
if File.exist? Rails.root.join('config/database.yml')
|
2
|
+
namespace :postgresql do
|
3
|
+
config = YAML.load(File.read(Rails.root.join('config/database.yml')))[Rails.env.to_s]
|
4
|
+
if config['adapter'] == 'postgresql'
|
5
|
+
db = config['database']
|
6
|
+
host = config['host']
|
7
|
+
user = config['username']
|
8
|
+
password = config['password']
|
9
|
+
FileUtils.mkdir_p Rails.root.join('postgresql')
|
10
|
+
|
11
|
+
backup = "pg_dump -h #{host} -d #{db} -U #{user} -F t -f #{Rails.root}/postgresql/dump.tar"
|
12
|
+
desc backup
|
13
|
+
task :dump do
|
14
|
+
zfben_rails_rake_system backup
|
15
|
+
end
|
16
|
+
|
17
|
+
restore = "pg_restore -h #{host} -U #{user} -c -f #{Rails.root}/postgresql/dump.tar"
|
18
|
+
desc restore
|
19
|
+
task :restore => 'db:create' do
|
20
|
+
zfben_rails_rake_system restore
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: h2ocube_rails_tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|
@@ -44,6 +44,7 @@ files:
|
|
44
44
|
- lib/h2ocube_rails_tasks/tasks/locales.rb
|
45
45
|
- lib/h2ocube_rails_tasks/tasks/mongodb.rb
|
46
46
|
- lib/h2ocube_rails_tasks/tasks/mysql.rb
|
47
|
+
- lib/h2ocube_rails_tasks/tasks/postgresql.rb
|
47
48
|
- lib/h2ocube_rails_tasks/tasks/puma.rb
|
48
49
|
- lib/h2ocube_rails_tasks/tasks/rainbows.rb
|
49
50
|
- lib/h2ocube_rails_tasks/tasks/resque.rb
|
@@ -68,9 +69,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
69
|
version: '0'
|
69
70
|
requirements: []
|
70
71
|
rubyforge_project:
|
71
|
-
rubygems_version: 2.
|
72
|
+
rubygems_version: 2.1.9
|
72
73
|
signing_key:
|
73
74
|
specification_version: 4
|
74
75
|
summary: This is a plugin to add some useful tasks to rails.
|
75
76
|
test_files: []
|
76
|
-
has_rdoc:
|