secondbase 2.1.0 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 78a47d016139857a1c9b4167e4b2960dd833ba78
4
- data.tar.gz: 7bf629b8e5bb03a805c67ffc04daee46d4635be2
3
+ metadata.gz: c9047584f31fb714c9dac5282322e77e7fe2e4d7
4
+ data.tar.gz: 7c83ddd5bc20695794e5545b98ebf04364effbc3
5
5
  SHA512:
6
- metadata.gz: e300a7436d8528aa1342b4b5a9aa14a0d129668b38dace6a9c27bb1cd4bf4272fb8e6d2f899eead5c2fc8afd1b0b47aab80b46af49d56b8237b8fd223e40409b
7
- data.tar.gz: 78f37cc71147a09b0fcac2f6582a0ce5d36f30286a68ce7b549b436b6d161dceea51b0b8a3a0fe3e715d0f388a7b212c8a4c601ffaed42d11921ec0f9dde5e71
6
+ metadata.gz: 5c700cbdea52c4a0a0488bb27f3649d752155157a7f941d9d37c80f343fb1c30ed8d315b67178d91ad6d234114c10fa80fe312185321f1edfbfc7e21b1a56148
7
+ data.tar.gz: ca9ed021048b0f5fdb6404673702595b32423cdfc737c609f14a1a2fa1c0ee3b0f4aafaf7cc5baedf0f82cd98bd65d22a4ddf0f82ab2025ebfbd0bb82a1138c3
@@ -1,8 +1,6 @@
1
1
  sudo: false
2
2
  cache: bundler
3
3
  rvm:
4
- - 2.0
5
- - 2.1
6
4
  - 2.2.2
7
5
  - 2.3.1
8
6
  gemfile:
@@ -16,9 +14,3 @@ install:
16
14
  - bundle install
17
15
  script:
18
16
  - 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/Appraisals CHANGED
@@ -14,6 +14,6 @@ appraise 'rails42' do
14
14
  end
15
15
 
16
16
  appraise 'rails50' do
17
- gem 'rails', '~> 5.0.0.rc1'
17
+ gem 'rails', '~> 5.0.0'
18
18
  gem 'mysql2'
19
19
  end
@@ -1,8 +1,39 @@
1
-
2
1
  # Change Log
3
2
 
4
3
  Please follow the format set down in http://keepachangelog.com
5
4
 
5
+ ## v2.1.2
6
+
7
+ #### Changed
8
+
9
+ * Tested w Rails 5.0 release.
10
+
11
+ #### Added
12
+
13
+ * Support for schema cache. Fixes #40
14
+
15
+
16
+ ## v2.1.1
17
+
18
+ #### Changed
19
+
20
+ * Test updates to track rails 5 rc2.
21
+
22
+
23
+ ## v2.1.0
24
+
25
+ #### Added
26
+
27
+ * Ability to disable the database task patching (thanks [@agrberg](https://github.com/agrberg))
28
+
29
+
30
+ ## v2.0.0
31
+
32
+ #### Added
33
+
34
+ * Rails 5 support.
35
+
36
+
6
37
  ## v1.0.1
7
38
 
8
39
  #### Fixed
data/README.md CHANGED
@@ -51,6 +51,7 @@ This will not only create your base development database, but it will also creat
51
51
  * db:migrate
52
52
  * db:test:purge
53
53
  * db:test:prepare
54
+ * db:schema:cache:dump
54
55
 
55
56
  Not all base database tasks make sense to run a mirrored SecondBase 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 SecondBase database. Each support any feature that their matching `:db` task has. For example, using `VERSION=123` to target a specific migration.
56
57
 
@@ -113,7 +114,7 @@ require 'second_base/test_help'
113
114
 
114
115
  #### Configurations
115
116
 
116
- All SecondBase railtie settings are best done in a `config/initializers/secondbase.rb` file. We support the following configurations:
117
+ All SecondBase railtie settings are best done in a `config/application.rb` file. We support the following configurations:
117
118
 
118
119
  ```ruby
119
120
  config.second_base.path # Default: 'db/secondbase'
@@ -167,7 +168,6 @@ class ApplicationController < ActionController::Base
167
168
  end
168
169
  ```
169
170
 
170
-
171
171
  ## Versions
172
172
 
173
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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.0
1
+ 2.1.2
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "rails", "~> 5.0.0.rc1"
5
+ gem "rails", "~> 5.0.0"
6
6
  gem "mysql2"
7
7
 
8
8
  gemspec :path => "../"
@@ -73,6 +73,14 @@ namespace :db do
73
73
  SecondBase.on_base { Rake::Task['db:schema:load'].execute }
74
74
  end
75
75
 
76
+ namespace :cache do
77
+
78
+ task :dump do
79
+ SecondBase.on_base { Rake::Task['db:schema:cache:dump'].execute }
80
+ end
81
+
82
+ end
83
+
76
84
  end
77
85
 
78
86
  namespace :structure do
@@ -109,7 +117,7 @@ end
109
117
  %w{
110
118
  create:all create drop:all purge:all purge
111
119
  migrate migrate:status abort_if_pending_migrations
112
- schema:load structure:load
120
+ schema:load schema:cache:dump structure:load
113
121
  test:purge test:load_schema test:load_structure test:prepare
114
122
  }.each do |name|
115
123
  task = Rake::Task["db:#{name}"] rescue nil
@@ -31,6 +31,15 @@ module SecondBase
31
31
  config.watchable_files.concat ["#{secondbase_dir}/schema.rb", "#{secondbase_dir}/structure.sql"]
32
32
  end
33
33
 
34
+ initializer 'second_base.check_schema_cache_dump', after: 'active_record.check_schema_cache_dump' do |app|
35
+ use_cache = config.active_record.use_schema_cache_dump
36
+ cache_file = app.root.join(config.second_base.path, 'schema_cache.dump')
37
+ if use_cache && File.file?(cache_file)
38
+ cache = Marshal.load File.binread(cache_file)
39
+ SecondBase::Base.connection.schema_cache = cache
40
+ end
41
+ end
42
+
34
43
  def config_path
35
44
  config.second_base.path
36
45
  end
@@ -176,6 +176,22 @@ class DbTaskTest < SecondBase::TestCase
176
176
  assert_connection_tables SecondBase::Base, ['comments']
177
177
  end
178
178
 
179
+ def test_db_test_schema_cache_dump
180
+ run_db :create
181
+ run_db :migrate
182
+ assert_dummy_databases
183
+ Dir.chdir(dummy_root) { `rake db:schema:cache:dump` }
184
+ assert File.file?(dummy_schema_cache), 'dummy schema cache does not exist'
185
+ assert File.file?(dummy_secondbase_schema_cache), 'dummy secondbase schema cache does not exist'
186
+ cache1 = Marshal.load(File.binread(dummy_schema_cache))
187
+ cache2 = Marshal.load(File.binread(dummy_secondbase_schema_cache))
188
+ source_method = rails_50_up? ? :data_sources : :tables
189
+ assert cache1.send(source_method, 'posts'), 'base should have posts table in cache'
190
+ refute cache1.send(source_method, 'comments'), 'base should not have comments table in cache'
191
+ refute cache2.send(source_method, 'posts'), 'secondbase should not have posts table in cache'
192
+ assert cache2.send(source_method, 'comments'), 'secondbase should have comments table in cache'
193
+ end
194
+
179
195
  def test_abort_if_pending
180
196
  run_db :create
181
197
  run_db :migrate
@@ -29,10 +29,18 @@ module SecondBase
29
29
  dummy_db.join 'schema.rb'
30
30
  end
31
31
 
32
+ def dummy_schema_cache
33
+ dummy_db.join 'schema_cache.dump'
34
+ end
35
+
32
36
  def dummy_secondbase_schema
33
37
  dummy_db.join('secondbase', 'schema.rb')
34
38
  end
35
39
 
40
+ def dummy_secondbase_schema_cache
41
+ dummy_db.join('secondbase', 'schema_cache.dump')
42
+ end
43
+
36
44
  def dummy_database_sqlite
37
45
  Dir.chdir(dummy_db){ Dir['*.sqlite3'] }.first
38
46
  end
@@ -54,6 +62,8 @@ module SecondBase
54
62
  def delete_dummy_files
55
63
  FileUtils.rm_rf dummy_schema
56
64
  FileUtils.rm_rf dummy_secondbase_schema
65
+ FileUtils.rm_rf dummy_schema_cache
66
+ FileUtils.rm_rf dummy_secondbase_schema_cache
57
67
  Dir.chdir(dummy_db) { Dir['**/structure.sql'].each { |structure| FileUtils.rm_rf(structure) } }
58
68
  Dir.chdir(dummy_db) { FileUtils.rm_rf(dummy_database_sqlite) } if dummy_database_sqlite
59
69
  FileUtils.rm_rf(dummy_migration[:file]) if defined?(@dummy_migration) && @dummy_migration
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: secondbase
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
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-05-14 00:00:00.000000000 Z
13
+ date: 2017-01-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
197
  version: '0'
198
198
  requirements: []
199
199
  rubyforge_project:
200
- rubygems_version: 2.4.5.1
200
+ rubygems_version: 2.6.4
201
201
  signing_key:
202
202
  specification_version: 4
203
203
  summary: Seamless second database integration for Rails.