dbhijacker 0.5.0 → 0.5.1
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.
- data/hijacker.gemspec +1 -1
- data/lib/hijacker.rb +7 -12
- metadata +3 -3
data/hijacker.gemspec
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{dbhijacker}
|
5
5
|
s.homepage = "https://github.com/crystalcommerce/hijacker"
|
6
|
-
s.version = "0.5.
|
6
|
+
s.version = "0.5.1"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
9
|
s.authors = ["Michael Xavier", "Donald Plummer", "Woody Peterson"]
|
data/lib/hijacker.rb
CHANGED
@@ -86,21 +86,16 @@ module Hijacker
|
|
86
86
|
return true unless defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter) && ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters::Mysql2Adapter)
|
87
87
|
|
88
88
|
@host_connections ||= {}
|
89
|
-
current_host = Host.connection.config['host']
|
90
89
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
acc << row['Database']
|
96
|
-
end
|
97
|
-
acc
|
90
|
+
existing_dbs = Host.all.inject(Set.new) do |acc, host|
|
91
|
+
@host_connections[host.hostname] ||= Mysql2::Client.new(root_config.merge('host' => host.hostname))
|
92
|
+
@host_connections[host.hostname].query("SHOW DATABASES").each do |row|
|
93
|
+
acc << row['Database']
|
98
94
|
end
|
99
|
-
|
100
|
-
existing_dbs.include?(database_name)
|
101
|
-
ensure
|
102
|
-
Host.establish_connection(root_config.merge('host' => current_host))
|
95
|
+
acc
|
103
96
|
end
|
97
|
+
|
98
|
+
existing_dbs.include?(database_name)
|
104
99
|
end
|
105
100
|
|
106
101
|
# very small chance this will raise, but if it does, we will still handle it the
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dbhijacker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 1
|
10
|
+
version: 0.5.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael Xavier
|