multi_config 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -2,4 +2,6 @@ language: ruby
2
2
  rvm:
3
3
  - 1.8.7
4
4
  - 1.9.2
5
- - 1.9.3
5
+ - 1.9.3
6
+ - ruby-head
7
+ - ree
data/CHANGELOG.md CHANGED
@@ -1,8 +1,12 @@
1
- Unreleased ([changes](https://github.com/shadabahmed/multi_config/v0.1.8...master))
1
+ Unreleased ([changes](https://github.com/shadabahmed/multi_config/v0.1.9...master))
2
2
  -------------------
3
3
  **Note: Not implemented yet**
4
4
  * Add generators for migrations
5
5
 
6
+ v0.1.9, 2012-09-18 ([changes](https://github.com/shadabahmed/multi_config/compare/v0.1.8...v0.1.9))
7
+ -------------------
8
+ * Refactored class variables
9
+
6
10
  v0.1.8, 2012-09-10 ([changes](https://github.com/shadabahmed/multi_config/compare/v0.1.6...v0.1.8))
7
11
  -------------------
8
12
  * Test for initializers added. Coverage results now 100%
@@ -8,8 +8,8 @@ module MultiConfig
8
8
  # Calls mod.extend with param ClassMethods so that methods in ClassMethods module become class methods of the class.
9
9
  def self.included(mod)
10
10
  mod.extend ClassMethods
11
- # Setting @@db_configs in the including class. This will help us keep track of database configuration files already included
12
- mod.send(:class_variable_set, :'@@db_configs', Hash.new { |h, k| h[k] = [] })
11
+ # Setting @@_multi_config_db_configs in the including class. This will help us keep track of database configuration files already included
12
+ mod.send(:class_variable_set, :'@@_multi_config_db_configs', Hash.new { |h, k| h[k] = [] })
13
13
  end
14
14
 
15
15
  # This `acts_as` style extension provides the capabilities for using multiple database configuration files. Any
@@ -55,7 +55,7 @@ module MultiConfig
55
55
  # same namespace. For .e.g. Models A and B specify config file 'other_db', then other_db.yml will be read only once.
56
56
  def add_db_config(file_name, namespace)
57
57
  # Read class var from the including class
58
- db_configs = class_variable_get(:'@@db_configs')
58
+ db_configs = class_variable_get(:'@@_multi_config_db_configs')
59
59
 
60
60
  # Don't do anything if the namespace has already been added
61
61
  unless db_configs.include?(namespace)
@@ -85,7 +85,8 @@ module MultiConfig
85
85
  hash["#{namespace}_#{k}"]=v
86
86
  hash
87
87
  end
88
- rescue Exception => exc
88
+ # ruby 1.9 raises SyntaxError exception which is not subclass of
89
+ rescue StandardError, SyntaxError
89
90
  raise "File #{path file_name} does not exist in config" unless File.exists?(path(file_name))
90
91
  raise "Invalid config file #{path file_name}"
91
92
  end
@@ -1,4 +1,4 @@
1
1
  module MultiConfig
2
2
  # Gem version
3
- VERSION = "0.1.8"
3
+ VERSION = "0.1.9"
4
4
  end
@@ -24,12 +24,12 @@ describe MultiConfig::ORMs::ActiveRecord::ClassMethods do
24
24
  end
25
25
  end
26
26
 
27
- describe "modifies class variable @@db_configs" do
27
+ describe "modifies class variable @@_multi_config_db_configs" do
28
28
  before do
29
- test_class.send(:class_variable_get, '@@db_configs').should == {}
29
+ test_class.send(:class_variable_get, '@@_multi_config_db_configs').should == {}
30
30
  test_class.config_file = 'other'
31
31
  end
32
- subject { test_class.send(:class_variable_get, '@@db_configs') }
32
+ subject { test_class.send(:class_variable_get, '@@_multi_config_db_configs') }
33
33
  it { should == {"other" => ["test_class"]} }
34
34
  end
35
35
 
@@ -14,7 +14,7 @@ describe ActiveRecord::Base, "methods" do
14
14
  end
15
15
 
16
16
  it "should have @@db_config class variable set" do
17
- ActiveRecord::Base.send(:class_variable_get, '@@db_configs').should == {}
17
+ ActiveRecord::Base.send(:class_variable_get, '@@_multi_config_db_configs').should == {}
18
18
  end
19
19
 
20
20
  end
@@ -10,7 +10,7 @@ describe UsesOtherYml do
10
10
  UsesOtherYml.connection.instance_variable_get(:@config)[:database].split('/').last.should == "other_db"
11
11
  end
12
12
 
13
- it "the @@db_configs should have entry for this class" do
14
- UsesOtherYml.send(:class_variable_get, :'@@db_configs').should == {"other" => ["UsesOtherYml"]}
13
+ it "the @@_multi_config_db_configs should have entry for this class" do
14
+ UsesOtherYml.send(:class_variable_get, :'@@_multi_config_db_configs').should == {"other" => ["UsesOtherYml"]}
15
15
  end
16
16
  end
metadata CHANGED
@@ -1,136 +1,135 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: multi_config
3
- version: !ruby/object:Gem::Version
4
- hash: 11
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.9
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 8
10
- version: 0.1.8
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Shadab Ahmed
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-09-10 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-09-18 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: rails
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 7
29
- segments:
30
- - 3
31
- - 0
32
- version: "3.0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '3.0'
33
22
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: bundler
37
23
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '3.0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: bundler
32
+ requirement: !ruby/object:Gem::Requirement
39
33
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 23
44
- segments:
45
- - 1
46
- - 0
47
- - 0
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
48
37
  version: 1.0.0
49
38
  type: :development
50
- version_requirements: *id002
51
- - !ruby/object:Gem::Dependency
52
- name: rails
53
39
  prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
55
41
  none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: 7
60
- segments:
61
- - 3
62
- - 0
63
- version: "3.0"
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 1.0.0
46
+ - !ruby/object:Gem::Dependency
47
+ name: rails
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '3.0'
64
54
  type: :development
65
- version_requirements: *id003
66
- - !ruby/object:Gem::Dependency
67
- name: activerecord
68
55
  prerelease: false
69
- requirement: &id004 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: activerecord
64
+ requirement: !ruby/object:Gem::Requirement
70
65
  none: false
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- hash: 7
75
- segments:
76
- - 3
77
- - 0
78
- version: "3.0"
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '3.0'
79
70
  type: :development
80
- version_requirements: *id004
81
- - !ruby/object:Gem::Dependency
82
- name: autotest
83
71
  prerelease: false
84
- requirement: &id005 !ruby/object:Gem::Requirement
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '3.0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: autotest
80
+ requirement: !ruby/object:Gem::Requirement
85
81
  none: false
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- hash: 27
90
- segments:
91
- - 4
92
- - 0
93
- version: "4.0"
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '4.0'
94
86
  type: :development
95
- version_requirements: *id005
96
- - !ruby/object:Gem::Dependency
97
- name: rdoc
98
87
  prerelease: false
99
- requirement: &id006 !ruby/object:Gem::Requirement
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '4.0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: rdoc
96
+ requirement: !ruby/object:Gem::Requirement
100
97
  none: false
101
- requirements:
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- hash: 3
105
- segments:
106
- - 0
107
- version: "0"
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
108
102
  type: :development
109
- version_requirements: *id006
110
- - !ruby/object:Gem::Dependency
111
- name: sqlite3
112
103
  prerelease: false
113
- requirement: &id007 !ruby/object:Gem::Requirement
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: sqlite3
112
+ requirement: !ruby/object:Gem::Requirement
114
113
  none: false
115
- requirements:
116
- - - ">="
117
- - !ruby/object:Gem::Version
118
- hash: 3
119
- segments:
120
- - 0
121
- version: "0"
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
122
118
  type: :development
123
- version_requirements: *id007
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
124
126
  description: This gem lets you specify different config file for an ActiveRecord Model
125
- email:
126
- - ""
127
+ email:
128
+ - ''
127
129
  executables: []
128
-
129
130
  extensions: []
130
-
131
131
  extra_rdoc_files: []
132
-
133
- files:
132
+ files:
134
133
  - .gitignore
135
134
  - .rspec
136
135
  - .travis.yml
@@ -161,38 +160,29 @@ files:
161
160
  - spec/support/rails_config.rb
162
161
  homepage: https://github.com/shadabahmed/multi_config
163
162
  licenses: []
164
-
165
163
  post_install_message:
166
164
  rdoc_options: []
167
-
168
- require_paths:
165
+ require_paths:
169
166
  - lib
170
- required_ruby_version: !ruby/object:Gem::Requirement
167
+ required_ruby_version: !ruby/object:Gem::Requirement
171
168
  none: false
172
- requirements:
173
- - - ">="
174
- - !ruby/object:Gem::Version
175
- hash: 3
176
- segments:
177
- - 0
178
- version: "0"
179
- required_rubygems_version: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - ! '>='
171
+ - !ruby/object:Gem::Version
172
+ version: '0'
173
+ required_rubygems_version: !ruby/object:Gem::Requirement
180
174
  none: false
181
- requirements:
182
- - - ">="
183
- - !ruby/object:Gem::Version
184
- hash: 3
185
- segments:
186
- - 0
187
- version: "0"
175
+ requirements:
176
+ - - ! '>='
177
+ - !ruby/object:Gem::Version
178
+ version: '0'
188
179
  requirements: []
189
-
190
180
  rubyforge_project:
191
- rubygems_version: 1.8.24
181
+ rubygems_version: 1.8.23
192
182
  signing_key:
193
183
  specification_version: 3
194
184
  summary: Use this gem to use multiple db config files
195
- test_files:
185
+ test_files:
196
186
  - spec/active_record/class_methods_spec.rb
197
187
  - spec/active_record/config_spec.rb
198
188
  - spec/active_record_spec.rb