glebpom-db-charmer 1.3.0 → 1.4.0

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/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.0
1
+ 1.4.0
data/db-charmer.gemspec CHANGED
@@ -1,58 +1,84 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
- # -*- encoding: utf-8 -*-
1
+ --- !ruby/object:Gem::Specification
2
+ name: glebpom-db-charmer
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.4.0
5
+ platform: ruby
6
+ authors:
7
+ - Alexey Kovyrin
8
+ - Gleb Pomykalov
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
5
12
 
6
- Gem::Specification.new do |s|
7
- s.name = %q{db-charmer}
8
- s.version = "1.3.0"
13
+ date: 2009-09-28 00:00:00 +04:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rails
18
+ type: :runtime
19
+ version_requirement:
20
+ version_requirements: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: 2.2.0
25
+ version:
26
+ description: ActiveRecord Connections Magic (slaves, multiple connections, etc)
27
+ email: gleb.pomykalov@qik.com
28
+ executables: []
9
29
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Alexey Kovyrin", "Gleb Pomykalov"]
12
- s.date = %q{2009-09-25}
13
- s.description = %q{ActiveRecord Connections Magic (slaves, multiple connections, etc)}
14
- s.email = %q{gleb.pomykalov@qik.com}
15
- s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README.rdoc"
18
- ]
19
- s.files = [
20
- ".gitignore",
21
- "LICENSE",
22
- "Makefile",
23
- "README.rdoc",
24
- "Rakefile",
25
- "VERSION",
26
- "db-charmer.gemspec",
27
- "init.rb",
28
- "lib/db_charmer.rb",
29
- "lib/db_charmer/action_controller_extensions.rb",
30
- "lib/db_charmer/active_record_extensions.rb",
31
- "lib/db_charmer/association_proxy.rb",
32
- "lib/db_charmer/connection_factory.rb",
33
- "lib/db_charmer/connection_proxy.rb",
34
- "lib/db_charmer/connection_switch.rb",
35
- "lib/db_charmer/db_magic.rb",
36
- "lib/db_charmer/finder_overrides.rb",
37
- "lib/db_charmer/multi_db_migrations.rb",
38
- "lib/db_charmer/multi_db_proxy.rb"
39
- ]
40
- s.homepage = %q{http://github.com/glebpom/db-charmer}
41
- s.rdoc_options = ["--charset=UTF-8"]
42
- s.require_paths = ["lib"]
43
- s.rubygems_version = %q{1.3.5}
44
- s.summary = %q{ActiveRecord Connections Magic (qik.com version)}
30
+ extensions: []
45
31
 
46
- if s.respond_to? :specification_version then
47
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
48
- s.specification_version = 3
32
+ extra_rdoc_files:
33
+ - LICENSE
34
+ - README.rdoc
35
+ files:
36
+ - .gitignore
37
+ - LICENSE
38
+ - Makefile
39
+ - README.rdoc
40
+ - Rakefile
41
+ - VERSION
42
+ - db-charmer.gemspec
43
+ - init.rb
44
+ - lib/db_charmer.rb
45
+ - lib/db_charmer/action_controller_extensions.rb
46
+ - lib/db_charmer/active_record_extensions.rb
47
+ - lib/db_charmer/association_proxy.rb
48
+ - lib/db_charmer/connection_factory.rb
49
+ - lib/db_charmer/connection_proxy.rb
50
+ - lib/db_charmer/connection_switch.rb
51
+ - lib/db_charmer/db_magic.rb
52
+ - lib/db_charmer/finder_overrides.rb
53
+ - lib/db_charmer/multi_db_migrations.rb
54
+ - lib/db_charmer/multi_db_proxy.rb
55
+ has_rdoc: true
56
+ homepage: http://github.com/glebpom/db-charmer
57
+ licenses: []
58
+
59
+ post_install_message:
60
+ rdoc_options:
61
+ - --charset=UTF-8
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: "0"
69
+ version:
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: "0"
75
+ version:
76
+ requirements: []
77
+
78
+ rubyforge_project:
79
+ rubygems_version: 1.3.5
80
+ signing_key:
81
+ specification_version: 3
82
+ summary: ActiveRecord Connections Magic (qik.com version)
83
+ test_files: []
49
84
 
50
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
51
- s.add_runtime_dependency(%q<rails>, [">= 2.2.0"])
52
- else
53
- s.add_dependency(%q<rails>, [">= 2.2.0"])
54
- end
55
- else
56
- s.add_dependency(%q<rails>, [">= 2.2.0"])
57
- end
58
- end
@@ -2,7 +2,7 @@ module DbCharmer
2
2
  module ConnectionSwitch
3
3
  module ClassMethods
4
4
  def coerce_to_connection_proxy(conn, should_exist = true)
5
- return nil if conn.nil?
5
+ return nil if conn.nil? || !DbCharmer.switch_connections?
6
6
 
7
7
  if conn.kind_of?(Symbol) || conn.kind_of?(String)
8
8
  return DbCharmer::ConnectionFactory.connect(conn, should_exist)
data/lib/db_charmer.rb CHANGED
@@ -14,7 +14,14 @@ module DbCharmer
14
14
  def self.connections_should_exist?
15
15
  !! connections_should_exist
16
16
  end
17
-
17
+
18
+ @@switch_connections = true
19
+ mattr_accessor :switch_connections
20
+
21
+ def self.switch_connections?
22
+ !! switch_connections
23
+ end
24
+
18
25
  def self.logger
19
26
  return Rails.logger if defined?(Rails)
20
27
  @logger ||= Logger.new(STDERR)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glebpom-db-charmer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Kovyrin
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-09-25 00:00:00 -07:00
13
+ date: 2009-09-28 00:00:00 +04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -52,9 +52,10 @@ files:
52
52
  - lib/db_charmer/finder_overrides.rb
53
53
  - lib/db_charmer/multi_db_migrations.rb
54
54
  - lib/db_charmer/multi_db_proxy.rb
55
- has_rdoc: false
55
+ has_rdoc: true
56
56
  homepage: http://github.com/glebpom/db-charmer
57
- licenses:
57
+ licenses: []
58
+
58
59
  post_install_message:
59
60
  rdoc_options:
60
61
  - --charset=UTF-8