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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e8fe6f4abc884584f39529539d8ee833d02097d8
4
- data.tar.gz: d28f5183228c3e25f34625ebbf69996e775e684d
3
+ metadata.gz: 3f0771dc85b23d24f5ac04731bcf5bd2015451c4
4
+ data.tar.gz: 223115b9a78af266e8c4d196d8455fcbc0f4f7b6
5
5
  SHA512:
6
- metadata.gz: 0116ddd306c9a4ddf39852b96e0af8d79a94419dcfed64274be55e22da39e9513969f5f5af29626e24e8d95b856fbfeca3ac9adf1956ebfc7b12ff3d4df1c027
7
- data.tar.gz: 25d6203f82a9c803b2c8043908815617fb9a460bd316cad32841d175e6d0d099b866ec26b7dc9cf4aa86e06623c3f01dbc45fbfda5a032131511f33b4ece4874
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
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'h2ocube_rails_tasks'
6
- s.version = '0.0.7'
6
+ s.version = '0.0.8'
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ['Ben']
9
9
  s.email = ['ben@h2ocube.com']
@@ -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
- db = config['database']
5
- host = config['host']
6
- FileUtils.mkdir_p Rails.root.join('mysql')
4
+ if config['adapter'] == 'mysql2'
5
+ db = config['database']
6
+ host = config['host']
7
+ FileUtils.mkdir_p Rails.root.join('mysql')
7
8
 
8
- backup = "mysqldump -h #{host} #{db} > #{Rails.root}/mysql/dump.sql"
9
- desc backup
10
- task :dump do
11
- zfben_rails_rake_system backup
12
- end
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
- restore = "mysql -h #{host} #{db} < #{Rails.root}/mysql/dump.sql"
15
- desc restore
16
- task :restore => 'db:create' do
17
- zfben_rails_rake_system restore
18
- end
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
- backup_all = "mysqldump -h #{host} --all-databases > #{Rails.root}/mysql/dump_all.sql"
21
- desc backup_all
22
- task :dump_all do
23
- zfben_rails_rake_system backup_all
24
- end
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
- restore_all = "mysql -h #{host} < #{Rails.root}/mysql/dump_all.sql"
27
- desc restore_all
28
- task :restore_all => 'db:create' do
29
- zfben_rails_rake_system restore_all
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.7
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-17 00:00:00.000000000 Z
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.0.5
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: