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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e9439bb71b65acce644e235a1ebde4f5dc04f90
4
- data.tar.gz: c59d1390e7efaab9e974f32476ac6dd449040ca5
3
+ metadata.gz: ee3b2f4de00346cb4d31fe33d07923462f021ffb
4
+ data.tar.gz: f22b8181daff87cace62ea5b6f0070a13edfda45
5
5
  SHA512:
6
- metadata.gz: fa4ec703b853b63ace18e701a60a9eae39ce2c0185d814b9b7e050a802ac76fe670c3fd40a4904cd99c44d5175ccdde3116b447c36f4d9d1103691717f69fe3c
7
- data.tar.gz: f4a8807038b540e0d6460fe3becee71cbf65f01442f70079d5531a20f630633008b8f78966cb0a937e038906afc7bf537fe03396a0399451e6711d3531391e07
6
+ metadata.gz: 5a27f20e94423bfd79d304efd266ac515deb599d2af4faadb3d6d84ccfd39533666214c00bc05431d6f86fc03794ec17f763c27a754ef3ab9848119fe88d67cc
7
+ data.tar.gz: 80de73d3dadc5073d950882733a99a9968c47568bdde2a63d1dd1c0e3b9d339f33c9bdba4f31a328b18f85d935f2af2db235bb9832c183752ec2e35e3bb96499
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.6
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
- pool = ActiveRecord::Base.establish_connection_without_activerecord_import(db_config.merge(
34
- 'database' => 'postgres',
35
- 'schema_search_path' => 'public'
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.establish_connection_without_activerecord_import(db_config).connection.execute("CREATE EXTENSION IF NOT EXISTS postgis")
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.6 ruby lib
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.6"
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"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tidy_reset
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thinknear