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 +4 -4
- data/lib/tasks/db_refresher.rake +7 -3
- data/refresher.gemspec +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8427bd9701c790f821c50c2a36c8febcbd28d22
|
4
|
+
data.tar.gz: ec631b98cdedd330bc8652f7890afd982ac854b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56e8b2eb193061935677cc7bacb29d2420a621e0ae7bdee7f5622ef9934879f5ca52b5e951fd6dc8890ee6f58cca2000173cbbda49e41a35917fbe10c25cdf58
|
7
|
+
data.tar.gz: 783127bf1f4cf868024ff2eff41d5b2227d2083718c8fd3eb45f56e00132ad037c9e75a91c4d3c897f12d72dd84b519f96492d0946a84833e1442b5104eb27dc
|
data/lib/tasks/db_refresher.rake
CHANGED
@@ -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
|
-
|
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 <
|
35
|
+
system("sudo -u postgres psql < #{file_name}")
|
32
36
|
end
|
33
37
|
|
34
38
|
|
data/refresher.gemspec
CHANGED
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.
|
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-
|
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:
|