refresher 0.1.0 → 0.1.1

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: c0d02ca1b94a9af4aa2786669ed85345e5d6bdf0
4
- data.tar.gz: 66199016383e6878e09621c8b3cf46d79aa12a50
3
+ metadata.gz: b8427bd9701c790f821c50c2a36c8febcbd28d22
4
+ data.tar.gz: ec631b98cdedd330bc8652f7890afd982ac854b6
5
5
  SHA512:
6
- metadata.gz: fa59a2eaa73d0dd0daddf6da814906f275fca293e0c9760ad443a7cf5797ae9f263e3ad7e1d082459d4feeb600c444c8437548169a237a377b87e23fb536164e
7
- data.tar.gz: 007b3b89459a793eb7714ecd1ed6ce424556128c78b20e102d00076af2e77087f4cfa1292b7985b364c0d95922979df335252555564ceaa0a3c690dd8253f3f2
6
+ metadata.gz: 56e8b2eb193061935677cc7bacb29d2420a621e0ae7bdee7f5622ef9934879f5ca52b5e951fd6dc8890ee6f58cca2000173cbbda49e41a35917fbe10c25cdf58
7
+ data.tar.gz: 783127bf1f4cf868024ff2eff41d5b2227d2083718c8fd3eb45f56e00132ad037c9e75a91c4d3c897f12d72dd84b519f96492d0946a84833e1442b5104eb27dc
@@ -12,7 +12,9 @@ namespace :db_refresher do
12
12
  use_safe = true
13
13
  sql = ActiveRecord::Base.send(:sanitize_sql_array, safe_schema_head_sql)
14
14
  conn.execute(sql)
15
- rescue ActiveRecord::NoDatabaseError
15
+ rescue ActiveRecord::NoDatabaseError, PG::ConnectionBad => e
16
+ puts "Woops: #{e.message}"
17
+
16
18
  safe_schema_head_sql = File.read(File.join(File.dirname(__FILE__), '..', 'sql', 'postgres_head.sql'))
17
19
 
18
20
  config = Rails.configuration.database_configuration[Rails.env]
@@ -26,9 +28,11 @@ namespace :db_refresher do
26
28
  safe_schema_head_sql = safe_schema_head_sql.gsub("s{#{key}}", value)
27
29
  end
28
30
 
29
- File.write('/tmp/refresh_db.sql', safe_schema_head_sql)
31
+ file_name = "/tmp/refresh_db-#{Time.now.to_i}.sql"
32
+
33
+ File.write(file_name, safe_schema_head_sql)
30
34
 
31
- system("sudo -u postgres psql < /tmp/refresh_db.sql")
35
+ system("sudo -u postgres psql < #{file_name}")
32
36
  end
33
37
 
34
38
 
@@ -1,8 +1,8 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'refresher'
4
- s.version = '0.1.0'
5
- s.date = '2016-03-27'
4
+ s.version = '0.1.1'
5
+ s.date = '2016-06-05'
6
6
  s.summary = "db-refresher"
7
7
  s.description = "Fast database prototyping with Rails"
8
8
  s.authors = ["Mufid Afif"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refresher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mufid Afif
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-27 00:00:00.000000000 Z
11
+ date: 2016-06-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Fast database prototyping with Rails
14
14
  email: mufid@outlook.com
@@ -46,3 +46,4 @@ signing_key:
46
46
  specification_version: 4
47
47
  summary: db-refresher
48
48
  test_files: []
49
+ has_rdoc: