tidy_reset 0.1.12 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/tidy_reset.rb +23 -15
- data/tidy_reset.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe315012fd76fed565ec642b41aaccd8c4d51dae
|
4
|
+
data.tar.gz: 0704497370a0bbd0538a3980db2b9123618f2107
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 993878166be13bb37b0c93d8040e40ebd030ea31ea611724ee3bde0ddd85b8819610b9313d05da2c12f3724d1f427b836a28c8f4b0fbeec32bbd0ee2117723fb
|
7
|
+
data.tar.gz: ca974b7b162700741f04bd2b5a38fa7a7d15db22b2637ab1d7bb5ca884d7afdb6d55595db53e1b30edc0c86388fc356759747e939c8d7b953affd161b9b04271
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.14
|
data/lib/tidy_reset.rb
CHANGED
@@ -26,28 +26,33 @@ module TidyReset
|
|
26
26
|
"#{configuration.app}-#{postfix}"
|
27
27
|
end
|
28
28
|
|
29
|
-
def
|
30
|
-
|
31
|
-
ActiveRecord::Base.
|
29
|
+
def master_connection_from_db_config(db_config)
|
30
|
+
# Get connection to master/maintenance database 'postgres'
|
31
|
+
pool = ActiveRecord::Base.send(establish_connection_method, db_config.merge(
|
32
|
+
'database' => 'postgres',
|
33
|
+
'schema_search_path' => 'public'
|
34
|
+
))
|
35
|
+
if pool.is_a?(Array)
|
36
|
+
raise RuntimeError, "Pool an array size #{pool.size}. First: #{pool.first}"
|
37
|
+
end
|
38
|
+
pool.connection
|
39
|
+
end
|
32
40
|
|
41
|
+
def establish_connection_method
|
33
42
|
# Choose proper connection method when ActiveRecord uses activerecord-import
|
34
43
|
if ActiveRecord::Base.respond_to?(:establish_connection_without_activerecord_import)
|
35
|
-
|
44
|
+
:establish_connection_without_activerecord_import
|
36
45
|
else
|
37
|
-
|
46
|
+
:establish_connection
|
38
47
|
end
|
48
|
+
end
|
39
49
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
'database' => 'postgres',
|
44
|
-
'schema_search_path' => 'public'
|
45
|
-
))
|
46
|
-
if pool.is_a?(Array)
|
47
|
-
raise RuntimeError, "Pool an array size #{pool.size}. First: #{pool.first}"
|
48
|
-
end
|
49
|
-
master_connection = pool.connection
|
50
|
+
def database_purge(db_config)
|
51
|
+
encoding = configuration.database_encoding
|
52
|
+
ActiveRecord::Base.remove_connection
|
50
53
|
|
54
|
+
begin
|
55
|
+
master_connection = master_connection_from_db_config(db_config)
|
51
56
|
# Test connection
|
52
57
|
master_connection.select_all("SELECT 1;")
|
53
58
|
|
@@ -80,6 +85,9 @@ module TidyReset
|
|
80
85
|
else
|
81
86
|
raise
|
82
87
|
end
|
88
|
+
ensure
|
89
|
+
master_connection = master_connection_from_db_config(db_config)
|
90
|
+
master_connection.select_all("ALTER DATABASE #{db_config['database']} CONNECTION LIMIT -1;")
|
83
91
|
end
|
84
92
|
end
|
85
93
|
end
|
data/tidy_reset.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
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.14 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.14"
|
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"]
|
13
13
|
s.authors = ["Thinknear"]
|
14
|
-
s.date = "2014-08-
|
14
|
+
s.date = "2014-08-21"
|
15
15
|
s.description = "Reset dynos, environment variables, deploys master git branch, and purges the database."
|
16
16
|
s.email = "software@thinknear.com"
|
17
17
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tidy_reset
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thinknear
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|