multi_config 0.1.6 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +8 -3
- data/README.md +6 -2
- data/lib/multi_config/orms/active_record.rb +3 -0
- data/lib/multi_config/version.rb +1 -1
- data/lib/multi_config.rb +2 -0
- data/spec/active_record/class_methods_spec.rb +107 -0
- data/spec/active_record/config_spec.rb +30 -0
- data/spec/models/uses_other_yml_spec.rb +1 -1
- data/spec/multi_config_spec.rb +23 -115
- data/spec/spec_helper.rb +3 -3
- data/spec/support/active_record_config.rb +1 -1
- data/spec/support/config_helper.rb +1 -1
- metadata +126 -112
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,14 @@
|
|
1
|
-
Unreleased ([changes](https://github.com/shadabahmed/multi_config/v0.1.
|
1
|
+
Unreleased ([changes](https://github.com/shadabahmed/multi_config/v0.1.8...master))
|
2
2
|
-------------------
|
3
3
|
**Note: Not implemented yet**
|
4
|
+
* Add generators for migrations
|
4
5
|
|
5
|
-
|
6
|
-
|
6
|
+
v0.1.8, 2012-09-10 ([changes](https://github.com/shadabahmed/multi_config/compare/v0.1.6...v0.1.8))
|
7
|
+
-------------------
|
8
|
+
* Test for initializers added. Coverage results now 100%
|
9
|
+
* Refactoring of spec
|
10
|
+
* More documentation
|
11
|
+
* 100% rdoc documentation coverage
|
7
12
|
|
8
13
|
v0.1.6, 2012-09-09 ([changes](https://github.com/shadabahmed/multi_config/compare/v0.1.1...v0.1.6))
|
9
14
|
-------------------
|
data/README.md
CHANGED
@@ -31,7 +31,6 @@ Or, from the command line:
|
|
31
31
|
test:
|
32
32
|
<<: *development
|
33
33
|
|
34
|
-
|
35
34
|
## Notes
|
36
35
|
All database config files should be similar to the database.yml. You need to specify configuration for all the environments
|
37
36
|
in use like you would specify in database.yml.
|
@@ -45,7 +44,6 @@ If you need to create migrations for the other db, then you will have to make mo
|
|
45
44
|
[guide](http://stackoverflow.com/questions/1404620/using-rails-migration-on-different-database-than-standard-production-or-devel) on
|
46
45
|
how to do that. The parameter for `establish_connection` would be the namespaced key for you config.
|
47
46
|
|
48
|
-
|
49
47
|
## Versions
|
50
48
|
All versions require Rails 3.0.x and higher.
|
51
49
|
|
@@ -62,8 +60,14 @@ All versions require Rails 3.0.x and higher.
|
|
62
60
|
- Start a feature/bugfix branch
|
63
61
|
- Commit and push until you are happy with your contribution
|
64
62
|
- Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
63
|
+
- Send me a pull request
|
65
64
|
- Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
66
65
|
|
66
|
+
## Development
|
67
|
+
- Run tests - `rake`
|
68
|
+
- Generate test coverage report - `rake coverage`. Coverage report path - coverage/index.html
|
69
|
+
- Generate documentation - `rake rdoc`
|
70
|
+
|
67
71
|
## Copyright
|
68
72
|
|
69
73
|
Copyright (c) 2012 Shadab Ahmed, released under the MIT license
|
@@ -3,6 +3,9 @@ module MultiConfig
|
|
3
3
|
module ORMs
|
4
4
|
# Implementation for the ActiveRecord ORM
|
5
5
|
module ActiveRecord
|
6
|
+
# Method called when the module is included.
|
7
|
+
# * +mod+ - Name of the class including this module.
|
8
|
+
# Calls mod.extend with param ClassMethods so that methods in ClassMethods module become class methods of the class.
|
6
9
|
def self.included(mod)
|
7
10
|
mod.extend ClassMethods
|
8
11
|
# Setting @@db_configs in the including class. This will help us keep track of database configuration files already included
|
data/lib/multi_config/version.rb
CHANGED
data/lib/multi_config.rb
CHANGED
@@ -5,6 +5,8 @@ module MultiConfig
|
|
5
5
|
# Checking if Rails::Railtie exists. Only then loca this railtie
|
6
6
|
if defined? Rails::Railtie
|
7
7
|
require 'rails'
|
8
|
+
# Railtie class for the gem. Initialization magic happens here. Inherits from Rails::Railtie so that initializer
|
9
|
+
# methods are available to it
|
8
10
|
class Railtie < Rails::Railtie
|
9
11
|
# Railtie initializer method
|
10
12
|
initializer 'multi_config.active_record' do
|
@@ -0,0 +1,107 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MultiConfig::ORMs::ActiveRecord::ClassMethods do
|
4
|
+
let!(:db_config) { load_namespaced_config('database.yml') }
|
5
|
+
let!(:other_config) { load_namespaced_config('other.yml') }
|
6
|
+
let!(:erb_config) { load_namespaced_config('erb.yml') }
|
7
|
+
|
8
|
+
before(:each) do
|
9
|
+
@test_class = Class.new
|
10
|
+
@test_class.stub_chain(:name).and_return('test_class')
|
11
|
+
@test_class.stub(:configurations).and_return({})
|
12
|
+
@test_class.stub(:establish_connection)
|
13
|
+
@test_class.send(:include, MultiConfig::ORMs::ActiveRecord)
|
14
|
+
end
|
15
|
+
let(:test_class) { @test_class }
|
16
|
+
|
17
|
+
describe "#config_file=" do
|
18
|
+
describe "setting config_file in unspecified environment" do
|
19
|
+
before do
|
20
|
+
Rails.stub(:env).and_return('unknown')
|
21
|
+
end
|
22
|
+
it "should through error when I specify a config file with environment not defined" do
|
23
|
+
lambda { test_class.config_file = 'other' }.should raise_error
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "modifies class variable @@db_configs" do
|
28
|
+
before do
|
29
|
+
test_class.send(:class_variable_get, '@@db_configs').should == {}
|
30
|
+
test_class.config_file = 'other'
|
31
|
+
end
|
32
|
+
subject { test_class.send(:class_variable_get, '@@db_configs') }
|
33
|
+
it { should == {"other" => ["test_class"]} }
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "modifies .configurations" do
|
37
|
+
before do
|
38
|
+
test_class.should_receive(:establish_connection).once.with('other_test')
|
39
|
+
expect {
|
40
|
+
test_class.config_file = 'other'
|
41
|
+
}.to change(test_class, :configurations).from({}).to(other_config)
|
42
|
+
end
|
43
|
+
subject { test_class.configurations }
|
44
|
+
it { should include 'other_development' }
|
45
|
+
it { should include 'other_test' }
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "works as expected when filename without extension .yml is specified" do
|
49
|
+
before do
|
50
|
+
test_class.should_receive(:establish_connection).once.with('other_test')
|
51
|
+
expect {
|
52
|
+
test_class.config_file = 'other'
|
53
|
+
}.to change(test_class, :configurations).from({}).to(other_config)
|
54
|
+
end
|
55
|
+
subject { test_class.configurations.keys }
|
56
|
+
it { should include 'other_development' }
|
57
|
+
it { should include 'other_test' }
|
58
|
+
end
|
59
|
+
|
60
|
+
describe "works as expected when filename with extension .yml is specified" do
|
61
|
+
before do
|
62
|
+
test_class.should_receive(:establish_connection).once.with('other_test')
|
63
|
+
expect {
|
64
|
+
test_class.config_file = 'other.yml'
|
65
|
+
}.to change(test_class, :configurations).from({}).to(other_config)
|
66
|
+
end
|
67
|
+
subject { test_class.configurations.keys }
|
68
|
+
it { should include 'other_development' }
|
69
|
+
it { should include 'other_test' }
|
70
|
+
end
|
71
|
+
|
72
|
+
describe "multiple calls for config_file= in different models modify configurations only once" do
|
73
|
+
let(:first_test_class) { Class.new(test_class) }
|
74
|
+
let(:second_test_class) { Class.new(test_class) }
|
75
|
+
before do
|
76
|
+
first_test_class.should_receive(:establish_connection).once.with('other_test')
|
77
|
+
expect {
|
78
|
+
first_test_class.config_file = 'other.yml'
|
79
|
+
}.to change(test_class, :configurations).from({}).to(other_config)
|
80
|
+
|
81
|
+
second_test_class.should_receive(:establish_connection).once.with('other_test')
|
82
|
+
expect {
|
83
|
+
second_test_class.config_file = 'other'
|
84
|
+
}.not_to change(test_class, :configurations)
|
85
|
+
|
86
|
+
end
|
87
|
+
subject { second_test_class.configurations.keys }
|
88
|
+
it { should include 'other_development' }
|
89
|
+
it { should include 'other_test' }
|
90
|
+
end
|
91
|
+
|
92
|
+
describe "does nothing if database.yml specified" do
|
93
|
+
before do
|
94
|
+
test_class.should_not_receive(:establish_connection)
|
95
|
+
test_class.should_not_receive(:add_db_config)
|
96
|
+
MultiConfig::ORMs::ActiveRecord::Config.should_not_receive(:path)
|
97
|
+
MultiConfig::ORMs::ActiveRecord::Config.should_not_receive(:load)
|
98
|
+
expect {
|
99
|
+
test_class.config_file = 'database'
|
100
|
+
}.not_to change(test_class, :configurations)
|
101
|
+
end
|
102
|
+
subject { test_class.configurations.keys }
|
103
|
+
it { should_not include 'database_development' }
|
104
|
+
it { should_not include 'database_test' }
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MultiConfig::ORMs::ActiveRecord::Config do
|
4
|
+
describe '#path' do
|
5
|
+
before do
|
6
|
+
Rails.stub(:root).and_return('/')
|
7
|
+
end
|
8
|
+
subject { MultiConfig::ORMs::ActiveRecord::Config.path('other_db.yml') }
|
9
|
+
it { should == '/config/other_db.yml' }
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '#load' do
|
13
|
+
let!(:db_config) { load_namespaced_config('database.yml') }
|
14
|
+
let!(:other_config) { load_namespaced_config('other.yml') }
|
15
|
+
let!(:erb_config) { load_namespaced_config('erb.yml') }
|
16
|
+
|
17
|
+
it "should load yaml and erb/yaml files correctly" do
|
18
|
+
MultiConfig::ORMs::ActiveRecord::Config.load('other.yml', 'other').should == other_config
|
19
|
+
MultiConfig::ORMs::ActiveRecord::Config.load('erb.yml', 'erb').should == erb_config
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should raise an error if file is not in present" do
|
23
|
+
lambda { MultiConfig::ORMs::ActiveRecord::Config.load('none.yml', 'none') }.should raise_error(RuntimeError)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should raise an error when I specify invalid config file" do
|
27
|
+
lambda { MultiConfig::ORMs::ActiveRecord::Config.load('invalid.yml', 'invalid') }.should raise_error(RuntimeError)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -11,6 +11,6 @@ describe UsesOtherYml do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
it "the @@db_configs should have entry for this class" do
|
14
|
-
UsesOtherYml.send(:class_variable_get
|
14
|
+
UsesOtherYml.send(:class_variable_get, :'@@db_configs').should == {"other" => ["UsesOtherYml"]}
|
15
15
|
end
|
16
16
|
end
|
data/spec/multi_config_spec.rb
CHANGED
@@ -1,123 +1,31 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
@test_class.stub(:establish_connection)
|
14
|
-
@test_class.send(:include, MultiConfig::ORMs::ActiveRecord)
|
2
|
+
require 'rails/railtie'
|
3
|
+
|
4
|
+
describe MultiConfig::Railtie do
|
5
|
+
describe "railtie initialization" do
|
6
|
+
before do
|
7
|
+
# Stub the initializer method and store the block to run later
|
8
|
+
Rails::Railtie.stub(:initializer) { |initializer_name, &block| @railtie_initializer_block = block }
|
9
|
+
# Stub onload to yield directly
|
10
|
+
ActiveSupport.stub(:on_load).and_yield
|
11
|
+
# Remove the class definition
|
12
|
+
MultiConfig.send(:remove_const, :Railtie)
|
15
13
|
end
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
describe "should raise error in unspecified environment" do
|
25
|
-
before do
|
26
|
-
Rails.stub(:env).and_return('unknown')
|
27
|
-
end
|
28
|
-
it "should through error when I specify a config file with environment not defined" do
|
29
|
-
lambda { test_class.config_file = 'other' }.should raise_error
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should through error when I specify invalid config file" do
|
34
|
-
lambda { test_class.config_file = 'invalid' }.should raise_error
|
35
|
-
end
|
36
|
-
|
37
|
-
describe "should modify class variable @@db_configs" do
|
38
|
-
before do
|
39
|
-
test_class.send(:class_variable_get, '@@db_configs').should == {}
|
40
|
-
test_class.config_file = 'other'
|
41
|
-
end
|
42
|
-
subject { test_class.send(:class_variable_get, '@@db_configs') }
|
43
|
-
it { should == {"other" => ["test_class"]} }
|
44
|
-
end
|
45
|
-
|
46
|
-
describe "should modify .configurations" do
|
47
|
-
before do
|
48
|
-
test_class.should_receive(:establish_connection).once.with('other_test')
|
49
|
-
expect {
|
50
|
-
test_class.config_file = 'other'
|
51
|
-
}.to change(test_class, :configurations).from({}).to(other_config)
|
52
|
-
end
|
53
|
-
subject { test_class.configurations }
|
54
|
-
it { should include 'other_development' }
|
55
|
-
it { should include 'other_test' }
|
56
|
-
end
|
57
|
-
|
58
|
-
describe "should work as expected when filename with extension .yml is specified" do
|
59
|
-
before do
|
60
|
-
test_class.should_receive(:establish_connection).once.with('other_test')
|
61
|
-
expect {
|
62
|
-
test_class.config_file = 'other.yml'
|
63
|
-
}.to change(test_class, :configurations).from({}).to(other_config)
|
64
|
-
end
|
65
|
-
subject { test_class.configurations.keys }
|
66
|
-
it { should include 'other_development' }
|
67
|
-
it { should include 'other_test' }
|
68
|
-
end
|
69
|
-
|
70
|
-
describe "multiple calls for config_file= in different models should modify configurations only once" do
|
71
|
-
let(:first_test_class) { Class.new(test_class) }
|
72
|
-
let(:second_test_class) { Class.new(test_class) }
|
73
|
-
before do
|
74
|
-
first_test_class.should_receive(:establish_connection).once.with('other_test')
|
75
|
-
expect {
|
76
|
-
first_test_class.config_file = 'other.yml'
|
77
|
-
}.to change(test_class, :configurations).from({}).to(other_config)
|
78
|
-
|
79
|
-
second_test_class.should_receive(:establish_connection).once.with('other_test')
|
80
|
-
expect {
|
81
|
-
second_test_class.config_file = 'other'
|
82
|
-
}.not_to change(test_class, :configurations)
|
83
|
-
|
84
|
-
end
|
85
|
-
subject { second_test_class.configurations.keys }
|
86
|
-
it { should include 'other_development' }
|
87
|
-
it { should include 'other_test' }
|
88
|
-
end
|
89
|
-
|
90
|
-
describe "should not do anything if database.yml specified" do
|
91
|
-
before do
|
92
|
-
test_class.should_not_receive(:establish_connection)
|
93
|
-
test_class.should_not_receive(:add_db_config)
|
94
|
-
MultiConfig::ORMs::ActiveRecord::Config.should_not_receive(:path)
|
95
|
-
MultiConfig::ORMs::ActiveRecord::Config.should_not_receive(:load)
|
96
|
-
expect {
|
97
|
-
test_class.config_file = 'database'
|
98
|
-
}.not_to change(test_class, :configurations)
|
99
|
-
end
|
100
|
-
subject { test_class.configurations.keys }
|
101
|
-
it { should_not include 'database_development' }
|
102
|
-
it { should_not include 'database_test' }
|
103
|
-
end
|
14
|
+
it "should call Railtie Insert when hook is executed" do
|
15
|
+
# Reload class definition so that class in instantiated and Railitie.initializer is called
|
16
|
+
load 'multi_config.rb'
|
17
|
+
MultiConfig::Railtie.should_receive(:insert).once()
|
18
|
+
# Call the initializer block we stored earlier. We wait so that the file is completely loaded and method Railitie.insert
|
19
|
+
# to be defined first. If we do not wait and yield directly from initializer, it would raise method not found exception
|
20
|
+
# for Railtie.insert since we removed the constant
|
21
|
+
@railtie_initializer_block.call
|
104
22
|
end
|
105
23
|
end
|
106
24
|
|
107
|
-
describe
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
end
|
112
|
-
subject { MultiConfig::ORMs::ActiveRecord::Config.path('other_db.yml') }
|
113
|
-
it { should == '/config/other_db.yml' }
|
114
|
-
end
|
115
|
-
|
116
|
-
describe '#load' do
|
117
|
-
it "should load yaml and erb/yaml files correctly" do
|
118
|
-
MultiConfig::ORMs::ActiveRecord::Config.load('other.yml','other').should == other_config
|
119
|
-
MultiConfig::ORMs::ActiveRecord::Config.load('erb.yml','erb').should == erb_config
|
120
|
-
end
|
25
|
+
describe '#insert' do
|
26
|
+
it "should call ActiveRecord::Base.include" do
|
27
|
+
ActiveRecord::Base.should_receive(:send).with(:include, MultiConfig::ORMs::ActiveRecord).once()
|
28
|
+
MultiConfig::Railtie.insert
|
121
29
|
end
|
122
30
|
end
|
123
31
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -6,12 +6,12 @@ if ENV['COVERAGE']
|
|
6
6
|
SimpleCov.start do
|
7
7
|
# Remove the spec folder from coverage. By default all code files are included. For more config options see
|
8
8
|
# https://github.com/colszowka/simplecov
|
9
|
-
add_filter File.expand_path('../../spec',__FILE__)
|
9
|
+
add_filter File.expand_path('../../spec', __FILE__)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
# Modify load path so you can require 'multi_config' directly.
|
14
|
-
$LOAD_PATH.unshift(File.expand_path('../../lib',__FILE__))
|
14
|
+
$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
|
15
15
|
|
16
16
|
require 'rubygems'
|
17
17
|
# Loads bundler setup tasks. Now if I run spec without installing gems then it would say gem not installed and
|
@@ -30,7 +30,7 @@ require 'rspec/autorun'
|
|
30
30
|
|
31
31
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
32
32
|
# in spec/support/ and its subdirectories.
|
33
|
-
Dir[File.join(File.dirname(__FILE__), "support/**/*.rb")].each {|f| require f}
|
33
|
+
Dir[File.join(File.dirname(__FILE__), "support/**/*.rb")].each { |f| require f }
|
34
34
|
|
35
35
|
# Set Rails environment as test
|
36
36
|
ENV['RAILS_ENV'] = 'test'
|
@@ -1,4 +1,4 @@
|
|
1
1
|
# Setting default Active Record configs
|
2
2
|
ActiveRecord::Base.logger = Logger.new(StringIO.new)
|
3
|
-
ActiveRecord::Base.configurations = YAML.load_file(ERB.new(File.expand_path("../config/database.yml",__FILE__)).result)
|
3
|
+
ActiveRecord::Base.configurations = YAML.load_file(ERB.new(File.expand_path("../config/database.yml", __FILE__)).result)
|
4
4
|
|
@@ -2,5 +2,5 @@
|
|
2
2
|
def load_namespaced_config(file)
|
3
3
|
namespace = File.basename(file, File.extname(file))
|
4
4
|
config = YAML.load(ERB.new(IO.read(File.expand_path("../config/#{file}", __FILE__))).result)
|
5
|
-
config.inject({}){|h,(k,v)| h["#{namespace}_#{k}"]=v;h}
|
5
|
+
config.inject({}) { |h, (k, v)| h["#{namespace}_#{k}"]=v; h }
|
6
6
|
end
|
metadata
CHANGED
@@ -1,135 +1,136 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: multi_config
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 8
|
10
|
+
version: 0.1.8
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Shadab Ahmed
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2012-09-10 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: rails
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '3.0'
|
22
|
-
type: :runtime
|
23
22
|
prerelease: false
|
24
|
-
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
24
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 7
|
29
|
+
segments:
|
30
|
+
- 3
|
31
|
+
- 0
|
32
|
+
version: "3.0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
31
36
|
name: bundler
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ! '>='
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: 1.0.0
|
38
|
-
type: :development
|
39
37
|
prerelease: false
|
40
|
-
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
39
|
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 23
|
44
|
+
segments:
|
45
|
+
- 1
|
46
|
+
- 0
|
47
|
+
- 0
|
45
48
|
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
49
|
type: :development
|
50
|
+
version_requirements: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
name: rails
|
55
53
|
prerelease: false
|
56
|
-
|
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
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
65
55
|
none: false
|
66
|
-
requirements:
|
67
|
-
- -
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 7
|
60
|
+
segments:
|
61
|
+
- 3
|
62
|
+
- 0
|
63
|
+
version: "3.0"
|
70
64
|
type: :development
|
65
|
+
version_requirements: *id003
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
name: activerecord
|
71
68
|
prerelease: false
|
72
|
-
|
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
|
69
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
81
70
|
none: false
|
82
|
-
requirements:
|
83
|
-
- -
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
hash: 7
|
75
|
+
segments:
|
76
|
+
- 3
|
77
|
+
- 0
|
78
|
+
version: "3.0"
|
86
79
|
type: :development
|
80
|
+
version_requirements: *id004
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: autotest
|
87
83
|
prerelease: false
|
88
|
-
|
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
|
84
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
97
85
|
none: false
|
98
|
-
requirements:
|
99
|
-
- -
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
hash: 27
|
90
|
+
segments:
|
91
|
+
- 4
|
92
|
+
- 0
|
93
|
+
version: "4.0"
|
102
94
|
type: :development
|
95
|
+
version_requirements: *id005
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: rdoc
|
103
98
|
prerelease: false
|
104
|
-
|
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
|
99
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
113
100
|
none: false
|
114
|
-
requirements:
|
115
|
-
- -
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
hash: 3
|
105
|
+
segments:
|
106
|
+
- 0
|
107
|
+
version: "0"
|
118
108
|
type: :development
|
109
|
+
version_requirements: *id006
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: sqlite3
|
119
112
|
prerelease: false
|
120
|
-
|
113
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
121
114
|
none: false
|
122
|
-
requirements:
|
123
|
-
- -
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
hash: 3
|
119
|
+
segments:
|
120
|
+
- 0
|
121
|
+
version: "0"
|
122
|
+
type: :development
|
123
|
+
version_requirements: *id007
|
126
124
|
description: This gem lets you specify different config file for an ActiveRecord Model
|
127
|
-
email:
|
128
|
-
-
|
125
|
+
email:
|
126
|
+
- ""
|
129
127
|
executables: []
|
128
|
+
|
130
129
|
extensions: []
|
130
|
+
|
131
131
|
extra_rdoc_files: []
|
132
|
-
|
132
|
+
|
133
|
+
files:
|
133
134
|
- .gitignore
|
134
135
|
- .rspec
|
135
136
|
- .travis.yml
|
@@ -142,6 +143,8 @@ files:
|
|
142
143
|
- lib/multi_config/orms/active_record.rb
|
143
144
|
- lib/multi_config/version.rb
|
144
145
|
- multi_config.gemspec
|
146
|
+
- spec/active_record/class_methods_spec.rb
|
147
|
+
- spec/active_record/config_spec.rb
|
145
148
|
- spec/active_record_spec.rb
|
146
149
|
- spec/models/uses_database_yml_spec.rb
|
147
150
|
- spec/models/uses_other_yml_spec.rb
|
@@ -158,29 +161,40 @@ files:
|
|
158
161
|
- spec/support/rails_config.rb
|
159
162
|
homepage: https://github.com/shadabahmed/multi_config
|
160
163
|
licenses: []
|
164
|
+
|
161
165
|
post_install_message:
|
162
166
|
rdoc_options: []
|
163
|
-
|
167
|
+
|
168
|
+
require_paths:
|
164
169
|
- lib
|
165
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
170
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
166
171
|
none: false
|
167
|
-
requirements:
|
168
|
-
- -
|
169
|
-
- !ruby/object:Gem::Version
|
170
|
-
|
171
|
-
|
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
|
172
180
|
none: false
|
173
|
-
requirements:
|
174
|
-
- -
|
175
|
-
- !ruby/object:Gem::Version
|
176
|
-
|
181
|
+
requirements:
|
182
|
+
- - ">="
|
183
|
+
- !ruby/object:Gem::Version
|
184
|
+
hash: 3
|
185
|
+
segments:
|
186
|
+
- 0
|
187
|
+
version: "0"
|
177
188
|
requirements: []
|
189
|
+
|
178
190
|
rubyforge_project:
|
179
|
-
rubygems_version: 1.8.
|
191
|
+
rubygems_version: 1.8.24
|
180
192
|
signing_key:
|
181
193
|
specification_version: 3
|
182
194
|
summary: Use this gem to use multiple db config files
|
183
|
-
test_files:
|
195
|
+
test_files:
|
196
|
+
- spec/active_record/class_methods_spec.rb
|
197
|
+
- spec/active_record/config_spec.rb
|
184
198
|
- spec/active_record_spec.rb
|
185
199
|
- spec/models/uses_database_yml_spec.rb
|
186
200
|
- spec/models/uses_other_yml_spec.rb
|