scenic-mysql_adapter 1.0.0 → 1.0.1

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: bbe954472899fc9a6d5c8dbb08885ad71ea52e52
4
- data.tar.gz: 8bb87cad49d599246c5ca6b71639bae7b19ec048
3
+ metadata.gz: d6f0744e97155966fa7ce57be4b5a54af87f87df
4
+ data.tar.gz: c4e85b7b3f4ddd1515c0c18dc41137fc477ad4a8
5
5
  SHA512:
6
- metadata.gz: 6c70a9e38ac2d9554e3a5d80bd444cf451fba938e22036f21726a764cd0196bb121c705ea64ecd929017ea640db2ab977ea02fdfb1ced068b08d07cc6adc52e5
7
- data.tar.gz: c8032f98be27836836bed9fc7c2c2ac6526fc2f53d71b3b7e5c0253837013945de04120dde1e481f5993241d22203072c5f3b3faefd801310e54ce60583fd52c
6
+ metadata.gz: e6ca4956ad189e565a7abeea03fa71092aa4010b9147cc3c9315e51d7d150d1b57897992b186ddcb331594d2a49c0d7e9778fe2fa6cac6d68b00e8a0d1634f3a
7
+ data.tar.gz: 18ee7349eeaa535d474a57d47eba3ed0e429ce177e858a75767d233d30f7e1a17de6c92db4805dd18a951b0eff55ea5aaa77a9553a75f8dcd07545e28f04bd19
@@ -12,4 +12,5 @@ jobs:
12
12
  steps:
13
13
  - checkout
14
14
  - run: bin/setup
15
- - run: rake test
15
+ - run: appraisal install
16
+ - run: appraisal rake test
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ /gemfiles/*.lock
@@ -0,0 +1,29 @@
1
+ appraise "rails-42" do
2
+ gem "mysql2", "0.4.4"
3
+ gem "activerecord", "~> 4.2", "< 5.0"
4
+ gem "activemodel", "~> 4.2", "< 5.0"
5
+ gem "actionpack", "~> 4.2", "< 5.0"
6
+ gem "activesupport", "~> 4.2", "< 5.0"
7
+ end
8
+
9
+ appraise "rails-50" do
10
+ gem "activerecord", "~> 5.0", "< 5.1"
11
+ gem "activemodel", "~> 5.0", "< 5.1"
12
+ gem "actionpack", "~> 5.0", "< 5.1"
13
+ gem "activesupport", "~> 5.0", "< 5.1"
14
+ end
15
+
16
+ appraise "rails-51" do
17
+ gem "mysql2", "0.4.4"
18
+ gem "activerecord", "~> 5.1", "< 5.2"
19
+ gem "activemodel", "~> 5.1", "< 5.2"
20
+ gem "actionpack", "~> 5.1", "< 5.2"
21
+ gem "activesupport", "~> 5.1", "< 5.2"
22
+ end
23
+
24
+ appraise "rails-52" do
25
+ gem "activerecord", "~> 5.2"
26
+ gem "activemodel", "~> 5.2"
27
+ gem "actionpack", "~> 5.2"
28
+ gem "activesupport", "~> 5.2"
29
+ end
data/README.md CHANGED
@@ -22,7 +22,7 @@ Then create the following file:
22
22
  # config/initializers/scenic.rb
23
23
 
24
24
  Scenic.configure do |config|
25
- config.database = Scenic::MySQL::Adapter
25
+ config.database = Scenic::Adapters::MySQL.new
26
26
  end
27
27
  ```
28
28
 
@@ -0,0 +1,2 @@
1
+ ---
2
+ BUNDLE_RETRY: "1"
@@ -0,0 +1,11 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "mysql2", "0.4.4"
6
+ gem "activerecord", "~> 4.2", "< 5.0"
7
+ gem "activemodel", "~> 4.2", "< 5.0"
8
+ gem "actionpack", "~> 4.2", "< 5.0"
9
+ gem "activesupport", "~> 4.2", "< 5.0"
10
+
11
+ gemspec path: "../"
@@ -0,0 +1,10 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord", "~> 5.0", "< 5.1"
6
+ gem "activemodel", "~> 5.0", "< 5.1"
7
+ gem "actionpack", "~> 5.0", "< 5.1"
8
+ gem "activesupport", "~> 5.0", "< 5.1"
9
+
10
+ gemspec path: "../"
@@ -0,0 +1,11 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "mysql2", "0.4.4"
6
+ gem "activerecord", "~> 5.1", "< 5.2"
7
+ gem "activemodel", "~> 5.1", "< 5.2"
8
+ gem "actionpack", "~> 5.1", "< 5.2"
9
+ gem "activesupport", "~> 5.1", "< 5.2"
10
+
11
+ gemspec path: "../"
@@ -0,0 +1,10 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord", "~> 5.2"
6
+ gem "activemodel", "~> 5.2"
7
+ gem "actionpack", "~> 5.2"
8
+ gem "activesupport", "~> 5.2"
9
+
10
+ gemspec path: "../"
@@ -0,0 +1,16 @@
1
+ require "rails/railtie"
2
+ require 'active_record/connection_adapters/abstract_mysql_adapter'
3
+ require_relative '../mysql_adapter/schema_dumper'
4
+
5
+ module Scenic
6
+ module Adapters
7
+ class MySqlRailtie < Rails::Railtie
8
+ ActiveSupport.on_load :active_record do
9
+ unless ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter.respond_to?(:views)
10
+ # Versions of Rails < 5 need this patch to avoid listing views as tables in schema.rb
11
+ ActiveRecord::SchemaDumper.prepend Scenic::Adapters::MySql::SchemaDumper
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -2,3 +2,4 @@ require 'active_record'
2
2
  require 'scenic'
3
3
  require_relative 'adapters/my_sql'
4
4
  require_relative 'mysql_adapter/version'
5
+ require_relative 'adapters/railtie' if defined?(Rails)
@@ -0,0 +1,42 @@
1
+ # This code is needed to support SQL views in MySQL in Rails < 5.1
2
+ # if you want to continue using 'db/schema.rb' instead of migrating to
3
+ # the SQL version 'db/structure.sql'.
4
+ #
5
+ # The problem is that, when you execute "SHOW TABLES" in MySQL, any
6
+ # view that you hava created also shows in that list.
7
+ #
8
+ # So when you create a view, when the 'db/schema.rb' file is updated,
9
+ # the view appears twice: first as a table, then as a view.
10
+ #
11
+ # As of this writing, the latest 5.x versions of Rails filter out
12
+ # views when providing the list of tables, so this problem doesn't
13
+ # appear. But for previous versions it's still there.
14
+ #
15
+ # This code patches the method SchemaDumper#table which is in charge
16
+ # of dumping a table to the 'db/schema.rb' file when it's being updated
17
+ # and does nothing when the supplied table is actually a view.
18
+ #
19
+ # This module needs to be prepended to ActiveRecord::SchemaDumper for
20
+ # the patch to work. See 'adapters/railtie.rb'
21
+
22
+ require "rails"
23
+ require_relative '../adapters/my_sql'
24
+
25
+ module Scenic
26
+ module Adapters
27
+ module MySql
28
+ module SchemaDumper
29
+ def table(table, stream)
30
+ return if defined_views.any? { |v| v.name == table } # Ignore tables that are views
31
+ super
32
+ end
33
+
34
+ private
35
+
36
+ def defined_views
37
+ @defined_views ||= Scenic.database.views
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -1,5 +1,5 @@
1
1
  module Scenic
2
2
  module MysqlAdapter
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
@@ -34,4 +34,5 @@ Gem::Specification.new do |spec|
34
34
  spec.add_development_dependency "bundler", "~> 1.15"
35
35
  spec.add_development_dependency "rake", "~> 10.0"
36
36
  spec.add_development_dependency "minitest", "~> 5.0"
37
+ spec.add_development_dependency "appraisal"
37
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scenic-mysql_adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lance Ivy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-17 00:00:00.000000000 Z
11
+ date: 2018-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: scenic
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '5.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: appraisal
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  description:
84
98
  email:
85
99
  - lance@cainlevy.net
@@ -89,14 +103,22 @@ extra_rdoc_files: []
89
103
  files:
90
104
  - ".circleci/config.yml"
91
105
  - ".gitignore"
106
+ - Appraisals
92
107
  - CODE_OF_CONDUCT.md
93
108
  - Gemfile
94
109
  - README.md
95
110
  - Rakefile
96
111
  - bin/console
97
112
  - bin/setup
113
+ - gemfiles/.bundle/config
114
+ - gemfiles/rails_42.gemfile
115
+ - gemfiles/rails_50.gemfile
116
+ - gemfiles/rails_51.gemfile
117
+ - gemfiles/rails_52.gemfile
98
118
  - lib/scenic/adapters/my_sql.rb
119
+ - lib/scenic/adapters/railtie.rb
99
120
  - lib/scenic/mysql_adapter.rb
121
+ - lib/scenic/mysql_adapter/schema_dumper.rb
100
122
  - lib/scenic/mysql_adapter/version.rb
101
123
  - lib/scenic/mysql_adapter/views.rb
102
124
  - scenic-mysql_adapter.gemspec