tidy_reset 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/tidy_reset.rb +8 -5
- data/tidy_reset.gemspec +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee3b2f4de00346cb4d31fe33d07923462f021ffb
|
4
|
+
data.tar.gz: f22b8181daff87cace62ea5b6f0070a13edfda45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a27f20e94423bfd79d304efd266ac515deb599d2af4faadb3d6d84ccfd39533666214c00bc05431d6f86fc03794ec17f763c27a754ef3ab9848119fe88d67cc
|
7
|
+
data.tar.gz: 80de73d3dadc5073d950882733a99a9968c47568bdde2a63d1dd1c0e3b9d339f33c9bdba4f31a328b18f85d935f2af2db235bb9832c183752ec2e35e3bb96499
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.7
|
data/lib/tidy_reset.rb
CHANGED
@@ -30,10 +30,13 @@ module TidyReset
|
|
30
30
|
begin
|
31
31
|
encoding = configuration.database_encoding
|
32
32
|
ActiveRecord::Base.remove_connection
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
|
34
|
+
activerecord_import_exists = ActiveRecord::Base.respond_to?(:establish_connection_without_activerecord_import)
|
35
|
+
establish_connection_method = activerecord_import_exists ? :establish_connection_without_activerecord_import : :establish_connection
|
36
|
+
pool = ActiveRecord::Base.send(establish_connection_method, db_config.merge(
|
37
|
+
'database' => 'postgres',
|
38
|
+
'schema_search_path' => 'public'
|
39
|
+
))
|
37
40
|
if pool.is_a?(Array)
|
38
41
|
raise RuntimeError, "Pool an array size #{pool.size}. First: #{pool.first}"
|
39
42
|
end
|
@@ -42,7 +45,7 @@ module TidyReset
|
|
42
45
|
master_connection.drop_database(db_config['database'])
|
43
46
|
master_connection.create_database(db_config['database'], db_config.merge('encoding' => encoding))
|
44
47
|
ActiveRecord::Base.remove_connection
|
45
|
-
ActiveRecord::Base.
|
48
|
+
ActiveRecord::Base.send(establish_connection_method, db_config).connection.execute("CREATE EXTENSION IF NOT EXISTS postgis")
|
46
49
|
rescue ActiveRecord::StatementInvalid => error
|
47
50
|
if /database .* already exists/ === error.message
|
48
51
|
raise DatabaseAlreadyExists
|
data/tidy_reset.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: tidy_reset 0.1.
|
5
|
+
# stub: tidy_reset 0.1.7 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "tidy_reset"
|
9
|
-
s.version = "0.1.
|
9
|
+
s.version = "0.1.7"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|