fourthbase 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.travis.yml +24 -0
- data/.yardopts +1 -0
- data/Appraisals +19 -0
- data/CHANGELOG.md +37 -0
- data/Gemfile +2 -0
- data/LICENSE.txt +21 -0
- data/README.md +191 -0
- data/Rakefile +24 -0
- data/VERSION +1 -0
- data/fourthbase.gemspec +25 -0
- data/gemfiles/rails40.gemfile +8 -0
- data/gemfiles/rails41.gemfile +8 -0
- data/gemfiles/rails42.gemfile +8 -0
- data/gemfiles/rails50.gemfile +8 -0
- data/lib/fourth_base.rb +20 -0
- data/lib/fourth_base/base.rb +8 -0
- data/lib/fourth_base/databases.rake +121 -0
- data/lib/fourth_base/databases_rails_five.rake +22 -0
- data/lib/fourth_base/databases_rails_four.rake +22 -0
- data/lib/fourth_base/forced.rb +21 -0
- data/lib/fourth_base/on_base.rb +36 -0
- data/lib/fourth_base/railtie.rb +52 -0
- data/lib/fourth_base/test_help.rb +11 -0
- data/lib/fourth_base/version.rb +3 -0
- data/lib/fourthbase.rb +1 -0
- data/lib/rails/fourth_base/generators/migration_generator.rb +25 -0
- data/test/cases/dbtask_test.rb +248 -0
- data/test/cases/forced_test.rb +49 -0
- data/test/cases/generator_test.rb +64 -0
- data/test/cases/on_base_test.rb +35 -0
- data/test/cases/railtie_test.rb +31 -0
- data/test/cases/rake_test.rb +0 -0
- data/test/dummy_apps/rails_five/Rakefile +2 -0
- data/test/dummy_apps/rails_five/app/controllers/application_controller.rb +7 -0
- data/test/dummy_apps/rails_five/app/helpers/application_helper.rb +3 -0
- data/test/dummy_apps/rails_five/app/models/application_record.rb +3 -0
- data/test/dummy_apps/rails_five/app/models/comment.rb +6 -0
- data/test/dummy_apps/rails_five/app/models/comment_forced.rb +6 -0
- data/test/dummy_apps/rails_five/app/models/post.rb +7 -0
- data/test/dummy_apps/rails_five/app/models/user.rb +6 -0
- data/test/dummy_apps/rails_five/bin/rails +5 -0
- data/test/dummy_apps/rails_five/config/database.yml +13 -0
- data/test/dummy_apps/rails_five/config/routes.rb +3 -0
- data/test/dummy_apps/rails_five/db/migrate/20141209165002_create_users.rb +11 -0
- data/test/dummy_apps/rails_five/db/migrate/20141214142700_create_posts.rb +12 -0
- data/test/dummy_apps/rails_five/db/secondbase/migrate/20151202075826_create_comments.rb +11 -0
- data/test/dummy_apps/rails_five/init.rb +42 -0
- data/test/dummy_apps/rails_five/log/.keep +0 -0
- data/test/dummy_apps/rails_five/tmp/.keep +0 -0
- data/test/dummy_apps/rails_four/Rakefile +2 -0
- data/test/dummy_apps/rails_four/app/controllers/application_controller.rb +7 -0
- data/test/dummy_apps/rails_four/app/helpers/application_helper.rb +3 -0
- data/test/dummy_apps/rails_four/app/models/comment.rb +6 -0
- data/test/dummy_apps/rails_four/app/models/comment_forced.rb +6 -0
- data/test/dummy_apps/rails_four/app/models/post.rb +7 -0
- data/test/dummy_apps/rails_four/app/models/user.rb +6 -0
- data/test/dummy_apps/rails_four/bin/rails +5 -0
- data/test/dummy_apps/rails_four/config/database.yml +14 -0
- data/test/dummy_apps/rails_four/config/routes.rb +3 -0
- data/test/dummy_apps/rails_four/db/migrate/20141209165002_create_users.rb +11 -0
- data/test/dummy_apps/rails_four/db/migrate/20141214142700_create_posts.rb +12 -0
- data/test/dummy_apps/rails_four/db/secondbase/migrate/20151202075826_create_comments.rb +11 -0
- data/test/dummy_apps/rails_four/init.rb +42 -0
- data/test/dummy_apps/rails_four/log/.keep +0 -0
- data/test/dummy_apps/rails_four/tmp/.keep +0 -0
- data/test/test_helper.rb +46 -0
- data/test/test_helpers/dummy_app_helpers.rb +94 -0
- data/test/test_helpers/rails_version_helpers.rb +29 -0
- data/test/test_helpers/stream_helpers.rb +40 -0
- data/thirdbase-2.1.1.gem +0 -0
- data/thirdbase-2.1.2.gem +0 -0
- metadata +206 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bd2be60c1af12221277dfb4b05e54f06cfd84b8f
|
4
|
+
data.tar.gz: 420abbcb178d8ae078f5d11695fe8779f018c9aa
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9f678a82670b1a1c8884b88601bce4b3b90e94d4306c6b4db46b1a8984ca936c85fc3aa777ccb546e305678cd3779ca2c0e315e006114e43d46d887807e12956
|
7
|
+
data.tar.gz: 84ed1db17d83f2074da8dee51ace04c151c7089e161f8289ee20efef7e68826927c39b9a1c36663e575e7598398ae7ee4beab41d8fa92e4402964939f134cbd3
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
sudo: false
|
2
|
+
cache: bundler
|
3
|
+
rvm:
|
4
|
+
- 2.0
|
5
|
+
- 2.1
|
6
|
+
- 2.2.2
|
7
|
+
- 2.3.1
|
8
|
+
gemfile:
|
9
|
+
- gemfiles/rails40.gemfile
|
10
|
+
- gemfiles/rails41.gemfile
|
11
|
+
- gemfiles/rails42.gemfile
|
12
|
+
- gemfiles/rails50.gemfile
|
13
|
+
install:
|
14
|
+
- gem install bundler
|
15
|
+
- bundle --version
|
16
|
+
- bundle install
|
17
|
+
script:
|
18
|
+
- bundle exec rake test
|
19
|
+
matrix:
|
20
|
+
exclude:
|
21
|
+
- rvm: 2.0
|
22
|
+
gemfile: gemfiles/rails50.gemfile
|
23
|
+
- rvm: 2.1
|
24
|
+
gemfile: gemfiles/rails50.gemfile
|
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--exclude test/**/*.rb
|
data/Appraisals
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
appraise 'rails40' do
|
2
|
+
gem 'rails', '~> 4.0.0'
|
3
|
+
gem 'mysql'
|
4
|
+
end
|
5
|
+
|
6
|
+
appraise 'rails41' do
|
7
|
+
gem 'rails', '~> 4.1.0'
|
8
|
+
gem 'mysql'
|
9
|
+
end
|
10
|
+
|
11
|
+
appraise 'rails42' do
|
12
|
+
gem 'rails', '~> 4.2.0'
|
13
|
+
gem 'mysql'
|
14
|
+
end
|
15
|
+
|
16
|
+
appraise 'rails50' do
|
17
|
+
gem 'rails', '~> 5.0.0.rc2'
|
18
|
+
gem 'mysql2'
|
19
|
+
end
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
Please follow the format set down in http://keepachangelog.com
|
4
|
+
|
5
|
+
## 2.1.1
|
6
|
+
|
7
|
+
Test updates to track rails 5 rc2.
|
8
|
+
|
9
|
+
## 2.1.0
|
10
|
+
|
11
|
+
Added the ability to disable the database task patching (thanks [@agrberg](https://github.com/agrberg))
|
12
|
+
|
13
|
+
## 2.0.0
|
14
|
+
|
15
|
+
Added Rails 5 support.
|
16
|
+
|
17
|
+
## v1.0.1
|
18
|
+
|
19
|
+
#### Fixed
|
20
|
+
|
21
|
+
* Fix base Rails migration generator. Fixes #25.
|
22
|
+
|
23
|
+
|
24
|
+
## v1.0
|
25
|
+
|
26
|
+
Initial re-write supporting Rails 4.x. Please see README.md for full details.
|
27
|
+
|
28
|
+
|
29
|
+
## v0.6
|
30
|
+
|
31
|
+
Support for Rails 3.x. For 2.x support, check out the branch `rails_2_3` or version v0.5 of the gem.
|
32
|
+
|
33
|
+
#### Fixed
|
34
|
+
|
35
|
+
* The `has_and_belongs_to_many` associations, for FourthBase models.
|
36
|
+
* Patched `ActiveRecord::TestFixtures` so that transactional fixture support is respected for the FourthBase.
|
37
|
+
* Reorganized monkey patches to make it easier to work in fixes for different versions of Rails.
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Copyright (c) 2010 Karle Durante
|
2
|
+
Copyright (c) 2016 CustomInk.com
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,191 @@
|
|
1
|
+
|
2
|
+
![FourthBase Logo](https://cloud.githubusercontent.com/assets/2381/12219457/5a5aab4e-b712-11e5-92e1-de6487aa0809.png)
|
3
|
+
<hr>
|
4
|
+
Seamless fourth database integration for Rails. FourthBase provides support for Rails to manage dual databases by extending ActiveRecord tasks that create, migrate, and test your databases.
|
5
|
+
|
6
|
+
* [Using FourthBase To Provide Some Level Of Sanity](http://technology.customink.com/blog/2016/01/10/two-headed-cat-using-secondbase-to-provide-some-level-of-sanity-in-a-two-database-rails-application/)
|
7
|
+
* [Rails Multi-Database Best Practices Roundup](http://technology.customink.com/blog/2015/06/22/rails-multi-database-best-practices-roundup/)
|
8
|
+
|
9
|
+
[![Gem Version](https://badge.fury.io/rb/secondbase.png)](http://badge.fury.io/rb/secondbase)
|
10
|
+
[![Build Status](https://travis-ci.org/customink/secondbase.svg?branch=master)](https://travis-ci.org/customink/secondbase)
|
11
|
+
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
To get started with your new fourth database, update your database.yml to include a `fourthbase` config key. All FourthBase configurations per Rails environment go under this config key.
|
16
|
+
|
17
|
+
```yaml
|
18
|
+
# Default configurations:
|
19
|
+
development:
|
20
|
+
adapter: sqlserver
|
21
|
+
database: myapp_development
|
22
|
+
test:
|
23
|
+
adapter: sqlserver
|
24
|
+
database: myapp_test
|
25
|
+
# FourthBase configurations:
|
26
|
+
fourthbase:
|
27
|
+
development:
|
28
|
+
adapter: mysql
|
29
|
+
database: myapp_development
|
30
|
+
test:
|
31
|
+
adapter: mysql
|
32
|
+
database: myapp_test
|
33
|
+
```
|
34
|
+
|
35
|
+
#### Database Tasks
|
36
|
+
|
37
|
+
FourthBase aims to work seamlessly within your Rails application. When it makes sense, we run a mirrored `db:fourth_base` task for matching ActiveRecord base database task. These can all be deactivated by setting `config.fourth_base.run_with_db_tasks = false` in your Application's configuration. For example:
|
38
|
+
|
39
|
+
```shell
|
40
|
+
$ rake db:create
|
41
|
+
```
|
42
|
+
|
43
|
+
This will not only create your base development database, but it will also create your fourth database as specified by the configuration within the `:fourthbase` section of your database.yml. Below is a complete list of `:db` tasks that automatically run a mirrored `:db:fourth_base` task. Some private or over lapping tasks, like schema dump/loading or `db:setup`, are not listed.
|
44
|
+
|
45
|
+
* db:create
|
46
|
+
* db:create:all
|
47
|
+
* db:drop
|
48
|
+
* db:drop:all
|
49
|
+
* db:purge
|
50
|
+
* db:purge:all
|
51
|
+
* db:migrate
|
52
|
+
* db:test:purge
|
53
|
+
* db:test:prepare
|
54
|
+
|
55
|
+
Not all base database tasks make sense to run a mirrored FourthBase task. These include tasks that move a single migration up/down, reporting on your database's current status/version, and others. These tasks have to be run explicitly and only operate on your FourthBase database. Each support any feature that their matching `:db` task has. For example, using `VERSION=123` to target a specific migration.
|
56
|
+
|
57
|
+
* db:fourth_base:migrate:up
|
58
|
+
* db:fourth_base:migrate:down
|
59
|
+
* db:fourth_base:migrate:reset
|
60
|
+
* db:fourth_base:migrate:redo
|
61
|
+
* db:fourth_base:migrate:status
|
62
|
+
* db:fourth_base:rollback
|
63
|
+
* db:fourth_base:forward
|
64
|
+
* db:fourth_base:version
|
65
|
+
|
66
|
+
#### Migration Generator
|
67
|
+
|
68
|
+
FourthBase migrations are stored in your application's `db/fourthbase/migrate` directory. Likewise, FourthBase will also dump your schema/structure file into the `db/fourthbase` directory. Full support for ActiveRecord's schema format being set to either `:ruby` or `:sql` is supported.
|
69
|
+
|
70
|
+
Migrations can be generated using the `fourth_base:migration` name. Our generator is a subclass of ActiveRecord's. This means the FourthBase migration generator supports whatever features and arguments are supported by your current Rails version. For example:
|
71
|
+
|
72
|
+
```shell
|
73
|
+
$ rails generate fourth_base:migration CreateWidgetsTable
|
74
|
+
$ rails generate fourth_base:migration AddTitleBodyToPost title:string body:text
|
75
|
+
```
|
76
|
+
|
77
|
+
#### Models
|
78
|
+
|
79
|
+
Any model who's table resides in your fourth database needs to inherit from `FourthBase::Base`. ActiveRecord associations will still work between your base ActiveRecord and FourthBase models!
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
class Widget < FourthBase::Base
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
class User < ActiveRecord::Base
|
87
|
+
has_many :widgets
|
88
|
+
end
|
89
|
+
```
|
90
|
+
|
91
|
+
#### Forced Connections
|
92
|
+
|
93
|
+
Sometimes you want to force a model that inherits from `ActiveRecord::Base` to use the `FourthBase::Base` connection. Using the `FourthBase::Forced` module is a great way to accomplish this. By using this module, we do all the work to ensure the connection, management, and pool are properly freedom patched.
|
94
|
+
|
95
|
+
We recomend forcing modules using a Rails initializer. This example below forces both the [DelayedJob ActiveRecord Backend](https://github.com/collectiveidea/delayed_job_active_record) and ActiveRecord session store to use your FourthBase database.
|
96
|
+
|
97
|
+
```ruby
|
98
|
+
# In config/initializers/fourth_base.rb
|
99
|
+
Delayed::Backend::ActiveRecord::Job.extend FourthBase::Forced
|
100
|
+
ActiveRecord::SessionStore::Session.extend FourthBase::Forced
|
101
|
+
```
|
102
|
+
|
103
|
+
#### Testing & DB Synchronization
|
104
|
+
|
105
|
+
Rails 4.2 brought about a new way to keep your test database in sync by checking schema migrations. Where previously forcing a full test database schema load, Rails 4.2 and up is able to run your tests much faster. In order for FourthBase to take advantage of this, you will need to include our test help file directly following the Rails one. Open your `test_helper.rb` and add our `fourth_base/test_help` after `rails/test_help`.
|
106
|
+
|
107
|
+
```ruby
|
108
|
+
ENV["RAILS_ENV"] = "test"
|
109
|
+
require File.expand_path('../../config/environment', __FILE__)
|
110
|
+
require 'rails/test_help'
|
111
|
+
require 'fourth_base/test_help'
|
112
|
+
```
|
113
|
+
|
114
|
+
#### Configurations
|
115
|
+
|
116
|
+
All FourthBase railtie settings are best done in a `config/application.rb` file. We support the following configurations:
|
117
|
+
|
118
|
+
```ruby
|
119
|
+
config.fourth_base.path # Default: 'db/fourthbase'
|
120
|
+
config.fourth_base.config_key # Default: 'fourthbase'
|
121
|
+
```
|
122
|
+
|
123
|
+
* `path` - Used as location for migrations & schema. Path is relative to application root.
|
124
|
+
* `config_key` - The key to in database.yml/configurations to search for FourthBase configs.
|
125
|
+
|
126
|
+
|
127
|
+
## Advanced Usage
|
128
|
+
|
129
|
+
#### Twelve-Factor & DATABASE_URL
|
130
|
+
|
131
|
+
We love the [Twelve Factors](http://12factor.net) principals and using tools like Dotenv with Rails. Using FourthBase does not mean you have to abandon these best practices. You will however need to take advantage of a [new feature](https://github.com/rails/rails/pull/14633) in Rails 4.1 and upward that allows database.yml configurations to leverage a `:url` key that will resolve and merge the same connection string format consumed by `DATABASE_URL`. For example:
|
132
|
+
|
133
|
+
```yaml
|
134
|
+
development:
|
135
|
+
database: encom-pg_development
|
136
|
+
url: <%= ENV.fetch('DATABASE_URL') %>
|
137
|
+
test:
|
138
|
+
database: encom-pg_test
|
139
|
+
url: <%= ENV.fetch('DATABASE_URL') %>
|
140
|
+
production:
|
141
|
+
url: <%= ENV.fetch('DATABASE_URL') %>
|
142
|
+
|
143
|
+
fourthbase:
|
144
|
+
development:
|
145
|
+
database: encom-mysql_development
|
146
|
+
url: <%= ENV.fetch('DATABASE_URL_FOURTHBASE') %>
|
147
|
+
test:
|
148
|
+
database: encom-mysql_test
|
149
|
+
url: <%= ENV.fetch('DATABASE_URL_FOURTHBASE') %>
|
150
|
+
production:
|
151
|
+
url: <%= ENV.fetch('DATABASE_URL_FOURTHBASE') %>
|
152
|
+
```
|
153
|
+
|
154
|
+
There are many ways to use Dotenv and enviornment variables. This is only one example and we hope it helps you decide on which is best for you.
|
155
|
+
|
156
|
+
#### The ActiveRecord Query Cache
|
157
|
+
|
158
|
+
Rails only knows about your base connection for the Rack-based query cache. In order to take advantage of this feature for your FourthBase, you will need to set an arround filter in your controller.
|
159
|
+
|
160
|
+
```ruby
|
161
|
+
class ApplicationController < ActionController::Base
|
162
|
+
around_filter :query_cache_fourthBase
|
163
|
+
private
|
164
|
+
def query_cache_fourthBase
|
165
|
+
FourthBase::Base.connection.cache { yield }
|
166
|
+
end
|
167
|
+
end
|
168
|
+
```
|
169
|
+
|
170
|
+
|
171
|
+
## Versions
|
172
|
+
|
173
|
+
The current master branch is for Rails v4.0.0 and up and. We have older work in previous v1.0 releases which partial work for Rails 3.2 or lower. These old versions are feature incomplete and are not supported.
|
174
|
+
|
175
|
+
|
176
|
+
## Contributing
|
177
|
+
|
178
|
+
We use the [Appraisal](https://github.com/thoughtbot/appraisal) gem from Thoughtbot to help us test different versions of Rails. The `rake appraisal test` command actually runs our test suite against all Rails versions in our `Appraisal` file. So after cloning the repo, running the following commands.
|
179
|
+
|
180
|
+
```shell
|
181
|
+
$ bundle install
|
182
|
+
$ bundle exec appraisal update
|
183
|
+
$ bundle exec appraisal rake test
|
184
|
+
```
|
185
|
+
|
186
|
+
If you want to run the tests for a specific Rails version, use one of the appraisal names found in our `Appraisals` file. For example, the following will run our tests suite for Rails 4.1.x.
|
187
|
+
|
188
|
+
```shell
|
189
|
+
$ bundle exec appraisal rails41 rake test
|
190
|
+
```
|
191
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rake/testtask'
|
3
|
+
|
4
|
+
Rake::TestTask.new do |t|
|
5
|
+
t.libs = ['lib','test']
|
6
|
+
t.test_files = FileList['test/**/*_test.rb']
|
7
|
+
t.verbose = true
|
8
|
+
end
|
9
|
+
|
10
|
+
desc "Bootstrap development/test DB setup."
|
11
|
+
task :bootstrap do
|
12
|
+
# ENV['DATBASE_URL'] = 'mysql://root@localhost/fourthbase_url'
|
13
|
+
require_relative './test/dummy_app/init'
|
14
|
+
require_relative './test/test_helpers/dummy_app_helpers'
|
15
|
+
include FourthBase::DummyAppHelpers
|
16
|
+
# dummy_root = File.expand_path "#{__dir__}/test/dummy_app"
|
17
|
+
Dir.chdir(dummy_root) { `rake db:create` }
|
18
|
+
delete_dummy_files
|
19
|
+
end
|
20
|
+
|
21
|
+
task :default do
|
22
|
+
Kernel.system 'appraisal update'
|
23
|
+
Kernel.system 'appraisal rake test'
|
24
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.1.2
|
data/fourthbase.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
$:.push File.expand_path('../lib', __FILE__)
|
2
|
+
require 'fourth_base/version'
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'fourthbase'
|
6
|
+
s.version = FourthBase::VERSION
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = ['Karle Durante', 'Hunter Madison', 'Ken Collins']
|
9
|
+
s.email = ['kdurante@customink.com', 'hunterglenmadison@icloud.com', 'ken@metaskills.net']
|
10
|
+
s.homepage = 'http://github.com/tommyalvarez/fourthbase'
|
11
|
+
s.summary = 'Seamless fourth database integration for Rails.'
|
12
|
+
s.description = "FourthBase provides support for Rails to manage dual databases by extending ActiveRecord tasks that create, migrate, and test your databases."
|
13
|
+
s.files = `git ls-files`.split("\n")
|
14
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
15
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
16
|
+
s.require_paths = ['lib']
|
17
|
+
s.rdoc_options = ['--charset=UTF-8']
|
18
|
+
s.license = 'MIT'
|
19
|
+
s.add_runtime_dependency 'rails', '>= 4.0'
|
20
|
+
s.add_development_dependency 'appraisal'
|
21
|
+
s.add_development_dependency 'pry'
|
22
|
+
s.add_development_dependency 'rake'
|
23
|
+
s.add_development_dependency 'sqlite3'
|
24
|
+
s.add_development_dependency 'yard'
|
25
|
+
end
|
data/lib/fourth_base.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rails'
|
2
|
+
require 'active_record'
|
3
|
+
require 'active_record/railtie'
|
4
|
+
require 'fourth_base/version'
|
5
|
+
require 'fourth_base/railtie'
|
6
|
+
require 'fourth_base/on_base'
|
7
|
+
require 'fourth_base/forced'
|
8
|
+
|
9
|
+
module FourthBase
|
10
|
+
|
11
|
+
extend ActiveSupport::Autoload
|
12
|
+
|
13
|
+
autoload :Base
|
14
|
+
|
15
|
+
def self.config(env = nil)
|
16
|
+
config = ActiveRecord::Base.configurations[Railtie.config_key]
|
17
|
+
config ? config[env || Rails.env] : nil
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|