dbhijacker 0.7.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/hijacker.gemspec +1 -1
  2. data/lib/hijacker.rb +0 -23
  3. 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.7.1"
6
+ s.version = "0.7.2"
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
@@ -40,10 +40,6 @@ module Hijacker
40
40
  target_name = target_name.downcase
41
41
  sister_name = sister_name.downcase unless sister_name.nil?
42
42
 
43
- unless database_exists?(target_name)
44
- raise InvalidDatabase, 'database does not exist'
45
- end
46
-
47
43
  if already_connected?(target_name, sister_name)
48
44
  return "Already connected to #{target_name}"
49
45
  end
@@ -82,25 +78,6 @@ module Hijacker
82
78
  end
83
79
  end
84
80
 
85
- def self.database_exists?(database_name)
86
- return true unless defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter) && ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters::Mysql2Adapter)
87
-
88
- @host_connections ||= {}
89
-
90
- aliases = Hijacker::Alias.all(:select => :name).map(&:name)
91
-
92
- existing_dbs = Host.all.inject(Set.new(aliases)) do |acc, host|
93
- @host_connections[host.hostname] ||= Mysql2::Client.new(root_config.merge('host' => host.hostname,
94
- 'database' => nil))
95
- @host_connections[host.hostname].query("SHOW DATABASES").each do |row|
96
- acc << row['Database']
97
- end
98
- acc
99
- end
100
-
101
- existing_dbs.include?(database_name)
102
- end
103
-
104
81
  # very small chance this will raise, but if it does, we will still handle it the
105
82
  # same as +Hijacker.connect+ so we don't lock up the app.
106
83
  #
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: 1
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 1
10
- version: 0.7.1
9
+ - 2
10
+ version: 0.7.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Xavier