thirdbase 2.1.1 → 2.1.2
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.
- checksums.yaml +4 -4
- data/README.md +9 -9
- data/VERSION +1 -1
- data/lib/rails/{second_base → third_base}/generators/migration_generator.rb +0 -0
- data/test/cases/dbtask_test.rb +1 -1
- data/test/dummy_apps/rails_five/init.rb +2 -2
- data/test/dummy_apps/rails_four/init.rb +2 -2
- data/test/test_helpers/dummy_app_helpers.rb +1 -1
- data/thirdbase-2.1.1.gem +0 -0
- data/thirdbase.gemspec +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0594242540d00735088b9bdf9c4184c606e8024
|
4
|
+
data.tar.gz: 423aa4a442d9ec84383ee46479ede56eff0765ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eaeb979a59b82bb9b3b15607b99b098cad9b30aa504ed2150619a6f9c3beaf76b57201f4888d3964afee7dc92c65c9ce00dfa55f7f088def3bb33d6bee1cbcd2
|
7
|
+
data.tar.gz: 83cbfa1900740828e302fddd2643e97d47ae04d98ed514c6a64f15ed973965c385a94ab660a1565f834b3f943f3132c4e0644e9f13bced01bf15bb6b25139065
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|

|
3
3
|
<hr>
|
4
|
-
Seamless
|
4
|
+
Seamless third database integration for Rails. ThirdBase provides support for Rails to manage dual databases by extending ActiveRecord tasks that create, migrate, and test your databases.
|
5
5
|
|
6
6
|
* [Using ThirdBase To Provide Some Level Of Sanity](http://technology.customink.com/blog/2016/01/10/two-headed-cat-using-thirdbase-to-provide-some-level-of-sanity-in-a-two-database-rails-application/)
|
7
7
|
* [Rails Multi-Database Best Practices Roundup](http://technology.customink.com/blog/2015/06/22/rails-multi-database-best-practices-roundup/)
|
@@ -12,7 +12,7 @@ Seamless second database integration for Rails. ThirdBase provides support for R
|
|
12
12
|
|
13
13
|
## Usage
|
14
14
|
|
15
|
-
To get started with your new
|
15
|
+
To get started with your new third database, update your database.yml to include a `thirdbase` config key. All ThirdBase configurations per Rails environment go under this config key.
|
16
16
|
|
17
17
|
```yaml
|
18
18
|
# Default configurations:
|
@@ -40,7 +40,7 @@ ThirdBase aims to work seamlessly within your Rails application. When it makes s
|
|
40
40
|
$ rake db:create
|
41
41
|
```
|
42
42
|
|
43
|
-
This will not only create your base development database, but it will also create your
|
43
|
+
This will not only create your base development database, but it will also create your third database as specified by the configuration within the `:thirdbase` section of your database.yml. Below is a complete list of `:db` tasks that automatically run a mirrored `:db:third_base` task. Some private or over lapping tasks, like schema dump/loading or `db:setup`, are not listed.
|
44
44
|
|
45
45
|
* db:create
|
46
46
|
* db:create:all
|
@@ -76,7 +76,7 @@ $ rails generate third_base:migration AddTitleBodyToPost title:string body:text
|
|
76
76
|
|
77
77
|
#### Models
|
78
78
|
|
79
|
-
Any model who's table resides in your
|
79
|
+
Any model who's table resides in your third database needs to inherit from `ThirdBase::Base`. ActiveRecord associations will still work between your base ActiveRecord and ThirdBase models!
|
80
80
|
|
81
81
|
```ruby
|
82
82
|
class Widget < ThirdBase::Base
|
@@ -143,12 +143,12 @@ production:
|
|
143
143
|
thirdbase:
|
144
144
|
development:
|
145
145
|
database: encom-mysql_development
|
146
|
-
url: <%= ENV.fetch('
|
146
|
+
url: <%= ENV.fetch('DATABASE_URL_THIRDBASE') %>
|
147
147
|
test:
|
148
148
|
database: encom-mysql_test
|
149
|
-
url: <%= ENV.fetch('
|
149
|
+
url: <%= ENV.fetch('DATABASE_URL_THIRDBASE') %>
|
150
150
|
production:
|
151
|
-
url: <%= ENV.fetch('
|
151
|
+
url: <%= ENV.fetch('DATABASE_URL_THIRDBASE') %>
|
152
152
|
```
|
153
153
|
|
154
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.
|
@@ -159,9 +159,9 @@ Rails only knows about your base connection for the Rack-based query cache. In o
|
|
159
159
|
|
160
160
|
```ruby
|
161
161
|
class ApplicationController < ActionController::Base
|
162
|
-
around_filter :
|
162
|
+
around_filter :query_cache_thirdBase
|
163
163
|
private
|
164
|
-
def
|
164
|
+
def query_cache_thirdBase
|
165
165
|
ThirdBase::Base.connection.cache { yield }
|
166
166
|
end
|
167
167
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.1.
|
1
|
+
2.1.2
|
File without changes
|
data/test/cases/dbtask_test.rb
CHANGED
@@ -66,7 +66,7 @@ class DbTaskTest < ThirdBase::TestCase
|
|
66
66
|
assert_match %r{create_table "posts"}, schema
|
67
67
|
refute_match %r{create_table "comments"}, schema
|
68
68
|
assert_connection_tables ActiveRecord::Base, ['users', 'posts']
|
69
|
-
#
|
69
|
+
# Third database and schema.
|
70
70
|
thirdbase_schema = File.read(dummy_thirdbase_schema)
|
71
71
|
assert_match %r{version: 20151202075826}, thirdbase_schema
|
72
72
|
refute_match %r{create_table "users"}, thirdbase_schema
|
@@ -33,8 +33,8 @@ module Dummy
|
|
33
33
|
|
34
34
|
config.active_record.schema_format = ENV['SCHEMA_FORMAT'] ? :sql : :ruby
|
35
35
|
|
36
|
-
if ENV['
|
37
|
-
config.third_base.run_with_db_tasks = ENV['
|
36
|
+
if ENV['WITH_THIRDBASE_TASKS'].present?
|
37
|
+
config.third_base.run_with_db_tasks = ENV['WITH_THIRDBASE_TASKS'] == 'true'
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
@@ -33,8 +33,8 @@ module Dummy
|
|
33
33
|
|
34
34
|
config.active_record.schema_format = ENV['SCHEMA_FORMAT'] ? :sql : :ruby
|
35
35
|
|
36
|
-
if ENV['
|
37
|
-
config.third_base.run_with_db_tasks = ENV['
|
36
|
+
if ENV['WITH_THIRDBASE_TASKS'].present?
|
37
|
+
config.third_base.run_with_db_tasks = ENV['WITH_THIRDBASE_TASKS'] == 'true'
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
@@ -68,7 +68,7 @@ module ThirdBase
|
|
68
68
|
|
69
69
|
def run_db(args, stream=:stdout, with_thirdbase_tasks=true)
|
70
70
|
capture(stream) do
|
71
|
-
Dir.chdir(dummy_root) { Kernel.system "env
|
71
|
+
Dir.chdir(dummy_root) { Kernel.system "env WITH_THIRDBASE_TASKS=#{with_thirdbase_tasks} #{run_cmd} db:#{args}" }
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
data/thirdbase-2.1.1.gem
ADDED
Binary file
|
data/thirdbase.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.authors = ['Karle Durante', 'Hunter Madison', 'Ken Collins']
|
9
9
|
s.email = ['kdurante@customink.com', 'hunterglenmadison@icloud.com', 'ken@metaskills.net']
|
10
10
|
s.homepage = 'http://github.com/customink/thirdbase'
|
11
|
-
s.summary = 'Seamless
|
11
|
+
s.summary = 'Seamless third database integration for Rails.'
|
12
12
|
s.description = "ThirdBase provides support for Rails to manage dual databases by extending ActiveRecord tasks that create, migrate, and test your databases."
|
13
13
|
s.files = `git ls-files`.split("\n")
|
14
14
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thirdbase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karle Durante
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-10-
|
13
|
+
date: 2016-10-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -120,7 +120,7 @@ files:
|
|
120
120
|
- gemfiles/rails41.gemfile
|
121
121
|
- gemfiles/rails42.gemfile
|
122
122
|
- gemfiles/rails50.gemfile
|
123
|
-
- lib/rails/
|
123
|
+
- lib/rails/third_base/generators/migration_generator.rb
|
124
124
|
- lib/third_base.rb
|
125
125
|
- lib/third_base/base.rb
|
126
126
|
- lib/third_base/databases.rake
|
@@ -175,6 +175,7 @@ files:
|
|
175
175
|
- test/test_helpers/dummy_app_helpers.rb
|
176
176
|
- test/test_helpers/rails_version_helpers.rb
|
177
177
|
- test/test_helpers/stream_helpers.rb
|
178
|
+
- thirdbase-2.1.1.gem
|
178
179
|
- thirdbase.gemspec
|
179
180
|
homepage: http://github.com/customink/thirdbase
|
180
181
|
licenses:
|
@@ -197,10 +198,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
198
|
version: '0'
|
198
199
|
requirements: []
|
199
200
|
rubyforge_project:
|
200
|
-
rubygems_version: 2.
|
201
|
+
rubygems_version: 2.5.1
|
201
202
|
signing_key:
|
202
203
|
specification_version: 4
|
203
|
-
summary: Seamless
|
204
|
+
summary: Seamless third database integration for Rails.
|
204
205
|
test_files:
|
205
206
|
- test/cases/dbtask_test.rb
|
206
207
|
- test/cases/forced_test.rb
|