multi_config 0.2.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d5e5124120474df6d6ce4d75df99e77f2ba79b28
4
+ data.tar.gz: ef8798a1fb9f7211ae016e0ede02b33de28f9c8d
5
+ SHA512:
6
+ metadata.gz: 7fd2db5a4078533d5ff26c49ebc684459d92480c614850042616a7970b1dd48d7599253c227f9465b9141c1f62fb7a1147818b1fe592e536363c9ab44954544f
7
+ data.tar.gz: 318083c9d2665686bf809b11d9d971636d4ad84720f9c65dc400898e81a438c246f7754a68dac17edc9aec6f57d0ee095fb28340da572779e34c0f809d8dfad1
@@ -2,10 +2,13 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
+ - 2.1.0
6
+ - 2.2.0
5
7
 
6
8
  env:
9
+ - "RAILS_VERSION=4.2"
10
+ - "RAILS_VERSION=4.1"
7
11
  - "RAILS_VERSION=4.0"
8
12
  - "RAILS_VERSION=3.2"
9
13
  - "RAILS_VERSION=3.1"
10
14
  - "RAILS_VERSION=3.0"
11
-
data/Gemfile CHANGED
@@ -6,9 +6,7 @@ gemspec
6
6
  group :test do
7
7
  gem 'rake'
8
8
  gem 'rspec'
9
- gem 'autotest', :require => false
10
- gem 'simplecov', :platforms => :mri_19, :require => false
11
- gem 'rcov', :platforms => :mri_18
9
+ gem 'simplecov'
12
10
  gem 'rails', "~> #{ENV["RAILS_VERSION"] || "3.2.0"}"
13
11
  gem 'sqlite3'
14
12
  end
data/README.md CHANGED
@@ -45,12 +45,11 @@ If you need to create migrations for the other db, then you will have to make mo
45
45
  how to do that. The parameter for `establish_connection` would be the namespaced key for you config.
46
46
 
47
47
  ## Versions
48
- All versions require Rails 3.0.x and higher.
48
+ All versions require Rails 3.0.x and higher. Tested for Rails 4
49
49
 
50
50
  ## Roadmap
51
51
 
52
52
  1. Add support for generators where you can specify which db file to use in the rails generate command. Would mitigate the need to manually modify migrations.
53
- 2. Support for Rails 4
54
53
 
55
54
  ## Contributing to `multi_config`
56
55
 
@@ -70,4 +69,4 @@ All versions require Rails 3.0.x and higher.
70
69
 
71
70
  ## Copyright
72
71
 
73
- Copyright (c) 2012 Shadab Ahmed, released under the MIT license
72
+ Copyright (c) 2012 Shadab Ahmed, released under the MIT license
@@ -43,7 +43,7 @@ module MultiConfig
43
43
  # Raise error if the config file does not have the current environment
44
44
  raise "Configuration for #{::Rails.env} environment not defined in #{Config.path file_name}" unless configurations.include? "#{namespace}_#{::Rails.env}"
45
45
  # Establish connection. This is the only way I found to different database config. Will try to find alternative
46
- establish_connection "#{namespace}_#{::Rails.env}"
46
+ establish_connection :"#{namespace}_#{::Rails.env}"
47
47
  end
48
48
  end
49
49
 
@@ -82,7 +82,7 @@ module MultiConfig
82
82
  begin
83
83
  require 'erb'
84
84
  YAML.load(ERB.new(IO.read(path(file_name))).result).inject({}) do |hash, (k, v)|
85
- hash["#{namespace}_#{k}"]=v
85
+ hash["#{namespace}_#{k}"] = v
86
86
  hash
87
87
  end
88
88
  # ruby 1.9 raises SyntaxError exception which is not subclass of
@@ -94,4 +94,4 @@ module MultiConfig
94
94
  end
95
95
  end
96
96
  end
97
- end
97
+ end
@@ -1,4 +1,4 @@
1
1
  module MultiConfig
2
2
  # Gem version
3
- VERSION = "0.2.2"
3
+ VERSION = "1.0.0"
4
4
  end
@@ -25,9 +25,6 @@ Gem::Specification.new do |gem|
25
25
 
26
26
  # Added dependencies for development/test
27
27
  gem.add_development_dependency("bundler", [">= 1.0.0"])
28
- gem.add_development_dependency("rails", [">= 3.0"])
29
28
  gem.add_development_dependency("activerecord", [">= 3.0"])
30
- gem.add_development_dependency("autotest", [">= 4.0"])
31
29
  gem.add_development_dependency("rdoc")
32
- gem.add_development_dependency("sqlite3")
33
30
  end
@@ -30,12 +30,12 @@ describe MultiConfig::ORMs::ActiveRecord::ClassMethods do
30
30
  test_class.config_file = 'other'
31
31
  end
32
32
  subject { test_class.send(:class_variable_get, '@@_multi_config_db_configs') }
33
- it { should == {"other" => ["test_class"]} }
33
+ it { should == {"other" => ['test_class']} }
34
34
  end
35
35
 
36
36
  context "modifies .configurations" do
37
37
  before do
38
- test_class.should_receive(:establish_connection).once.with('other_test')
38
+ test_class.should_receive(:establish_connection).once.with(:other_test)
39
39
  expect {
40
40
  test_class.config_file = 'other'
41
41
  }.to change(test_class, :configurations).from({}).to(other_config)
@@ -47,7 +47,7 @@ describe MultiConfig::ORMs::ActiveRecord::ClassMethods do
47
47
 
48
48
  context "filename without extension .yml is specified" do
49
49
  before do
50
- test_class.should_receive(:establish_connection).once.with('other_test')
50
+ test_class.should_receive(:establish_connection).once.with(:other_test)
51
51
  expect {
52
52
  test_class.config_file = 'other'
53
53
  }.to change(test_class, :configurations).from({}).to(other_config)
@@ -59,7 +59,7 @@ describe MultiConfig::ORMs::ActiveRecord::ClassMethods do
59
59
 
60
60
  context "filename with extension .yml is specified" do
61
61
  before do
62
- test_class.should_receive(:establish_connection).once.with('other_test')
62
+ test_class.should_receive(:establish_connection).once.with(:other_test)
63
63
  expect {
64
64
  test_class.config_file = 'other.yml'
65
65
  }.to change(test_class, :configurations).from({}).to(other_config)
@@ -73,12 +73,12 @@ describe MultiConfig::ORMs::ActiveRecord::ClassMethods do
73
73
  let(:first_test_class) { Class.new(test_class) }
74
74
  let(:second_test_class) { Class.new(test_class) }
75
75
  before do
76
- first_test_class.should_receive(:establish_connection).once.with('other_test')
76
+ first_test_class.should_receive(:establish_connection).once.with(:other_test)
77
77
  expect {
78
78
  first_test_class.config_file = 'other.yml'
79
79
  }.to change(test_class, :configurations).from({}).to(other_config)
80
80
 
81
- second_test_class.should_receive(:establish_connection).once.with('other_test')
81
+ second_test_class.should_receive(:establish_connection).once.with(:other_test)
82
82
  expect {
83
83
  second_test_class.config_file = 'other'
84
84
  }.not_to change(test_class, :configurations)
metadata CHANGED
@@ -1,126 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multi_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
5
- prerelease:
4
+ version: 1.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Shadab Ahmed
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-07-07 00:00:00.000000000 Z
11
+ date: 2015-10-05 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rails
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '3.0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '3.0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: bundler
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: 1.0.0
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  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'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '3.0'
62
41
  - !ruby/object:Gem::Dependency
63
42
  name: activerecord
64
43
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
44
  requirements:
67
- - - ! '>='
45
+ - - ">="
68
46
  - !ruby/object:Gem::Version
69
47
  version: '3.0'
70
48
  type: :development
71
49
  prerelease: false
72
50
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
51
  requirements:
75
- - - ! '>='
52
+ - - ">="
76
53
  - !ruby/object:Gem::Version
77
54
  version: '3.0'
78
- - !ruby/object:Gem::Dependency
79
- name: autotest
80
- requirement: !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
83
- - - ! '>='
84
- - !ruby/object:Gem::Version
85
- version: '4.0'
86
- type: :development
87
- prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ! '>='
92
- - !ruby/object:Gem::Version
93
- version: '4.0'
94
55
  - !ruby/object:Gem::Dependency
95
56
  name: rdoc
96
57
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
- requirements:
99
- - - ! '>='
100
- - !ruby/object:Gem::Version
101
- version: '0'
102
- type: :development
103
- prerelease: false
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
113
- none: false
114
58
  requirements:
115
- - - ! '>='
59
+ - - ">="
116
60
  - !ruby/object:Gem::Version
117
61
  version: '0'
118
62
  type: :development
119
63
  prerelease: false
120
64
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
65
  requirements:
123
- - - ! '>='
66
+ - - ">="
124
67
  - !ruby/object:Gem::Version
125
68
  version: '0'
126
69
  description: This gem lets you specify different config file for an ActiveRecord Model
@@ -130,9 +73,9 @@ executables: []
130
73
  extensions: []
131
74
  extra_rdoc_files: []
132
75
  files:
133
- - .gitignore
134
- - .rspec
135
- - .travis.yml
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - ".travis.yml"
136
79
  - CHANGELOG.md
137
80
  - Gemfile
138
81
  - LICENSE.txt
@@ -160,33 +103,26 @@ files:
160
103
  - spec/support/rails_config.rb
161
104
  homepage: https://github.com/shadabahmed/multi_config
162
105
  licenses: []
106
+ metadata: {}
163
107
  post_install_message:
164
108
  rdoc_options: []
165
109
  require_paths:
166
110
  - lib
167
111
  required_ruby_version: !ruby/object:Gem::Requirement
168
- none: false
169
112
  requirements:
170
- - - ! '>='
113
+ - - ">="
171
114
  - !ruby/object:Gem::Version
172
115
  version: '0'
173
- segments:
174
- - 0
175
- hash: 2167256864668362762
176
116
  required_rubygems_version: !ruby/object:Gem::Requirement
177
- none: false
178
117
  requirements:
179
- - - ! '>='
118
+ - - ">="
180
119
  - !ruby/object:Gem::Version
181
120
  version: '0'
182
- segments:
183
- - 0
184
- hash: 2167256864668362762
185
121
  requirements: []
186
122
  rubyforge_project:
187
- rubygems_version: 1.8.25
123
+ rubygems_version: 2.4.8
188
124
  signing_key:
189
- specification_version: 3
125
+ specification_version: 4
190
126
  summary: Use this gem to use multiple db config files
191
127
  test_files:
192
128
  - spec/active_record/class_methods_spec.rb