tol 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/tol/database.rb +12 -9
  2. data/lib/tol/version.rb +1 -1
  3. metadata +2 -2
data/lib/tol/database.rb CHANGED
@@ -47,27 +47,30 @@ class Database
47
47
  puts "-> drop old database"
48
48
  dropdb = "dropdb"
49
49
  dropdb += " -h #{@settings['host']}" if @settings["host"]
50
- dropdb += " -U #{@settings['user']}" if @settings["user"]
51
- dropdb += " -P #{@settings['password']}" if @settings["password"]
50
+ dropdb += " -U #{@settings['username']}" if @settings["username"]
51
+ dropdb = "PGPASSWORD=#{@settings['password']} " +
52
+ dropdb if @settings["password"]
52
53
  dropdb += " #{@settings['database']}"
53
- drop = `#{dropdb}`
54
+ drop = `/bin/bash -c '#{dropdb}'`
54
55
 
55
56
  puts "-> recreate old database"
56
57
  createdb = "createdb"
57
58
  createdb += " -h #{@settings['host']}" if @settings["host"]
58
- createdb += " -U #{@settings['user']}" if @settings["user"]
59
- createdb += " -P #{@settings['password']}" if @settings["password"]
59
+ createdb += " -U #{@settings['username']}" if @settings["username"]
60
+ createdb = "PGPASSWORD=#{@settings['password']} " +
61
+ createdb if @settings["password"]
60
62
  createdb += " #{@settings['database']}"
61
- create = `#{createdb}`
63
+ create = `/bin/bash -c '#{createdb}'`
62
64
 
63
65
  puts "-> restore from file"
64
66
  restore_command = "pg_restore --verbose --clean --no-acl --no-owner"
65
67
  restore_command += " -d #{@settings['database']}"
66
68
  restore_command += " -h #{@settings['host']}" if @settings["host"]
67
- restore_command += " -U #{@settings['user']}" if @settings["user"]
68
- restore_command += " -P #{@settings['password']}" if @settings["password"]
69
+ restore_command += " -U #{@settings['username']}" if @settings["username"]
70
+ restore_command = "PGPASSWORD=#{@settings['password']} " +
71
+ restore_command if @settings["password"]
69
72
  restore_command += " /tmp/#{heroku_app}.dump > /dev/null 2>&1"
70
- restore = `#{restore_command}`
73
+ restore = `/bin/bash -c '#{restore_command}'`
71
74
 
72
75
  puts "5. Cleaning up.".foreground(:yellow)
73
76
  clean_up = `rm /tmp/#{heroku_app}.dump`
data/lib/tol/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tol
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tol
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-26 00:00:00.000000000 Z
12
+ date: 2013-05-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pry