schema_plus 1.7.0 → 1.7.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: 0c07ea7e4ac89f46fb3d3d27047c2cc2d2cbd5c0
4
- data.tar.gz: 4db11b2d422195c298c344b9b150b7bac21d83a3
3
+ metadata.gz: b4482f0825b25fe83cd40a915432b6ad80ffd7ba
4
+ data.tar.gz: 91a6a499ca49d9a76ee33be36ab3e25e9d94369d
5
5
  SHA512:
6
- metadata.gz: 5c2363444635b39dc4f9bc2bc5542d670774da07fd5af5653278d7b2cf94151346594154d8161af5e727e91385f6bd66423cff05b1f6b4dc22d3bc4124929f72
7
- data.tar.gz: ba2d12964f4a6ccbd02775ab2795ff94f6a93e9f0fe6a97f9e4c4a2f8c33985e629ba87f6bb47bd937b7bc626e5804c017cd42039458c10386652ab992038c50
6
+ metadata.gz: 654b22739dde19ab529e5e1517e61f60b6d1ecb9d15a76e5d9baf1b5c50eccf975410409512a0c35327bb4a1dea164a8838fcb137e38e18c596a3284aef938a4
7
+ data.tar.gz: 6e3f70498af24d967fe475dfadc9ee85f96731002eadd44eef5857314b5e136660c4f9e2ae7dea5d9cd57a8a6aef33d09efb011ddb5d2490374b782a1dd4a07c
data/.gitignore CHANGED
@@ -20,6 +20,7 @@ tmtags
20
20
  coverage
21
21
  rdoc
22
22
  pkg
23
+ tmp
23
24
 
24
25
  ## PROJECT::SPECIFIC
25
26
  .rvmrc
@@ -1,47 +1,46 @@
1
+ # This file was auto-generated by the schema_dev tool, based on the data in
2
+ # ./schema_dev.yml
3
+ # Please do not edit this file; any changes will be overwritten next time
4
+ # schema_dev gets run.
5
+ ---
1
6
  rvm:
2
- - 1.9.3
3
- - 2.1.3
4
- - jruby
7
+ - 1.9.3
8
+ - 2.1.3
9
+ - jruby
5
10
  gemfile:
6
- - gemfiles/rails-3.2/Gemfile.postgresql
7
- - gemfiles/rails-3.2/Gemfile.sqlite3
8
- - gemfiles/rails-3.2/Gemfile.mysql
9
- - gemfiles/rails-3.2/Gemfile.mysql2
10
- - gemfiles/rails-4.0/Gemfile.postgresql
11
- - gemfiles/rails-4.0/Gemfile.sqlite3
12
- - gemfiles/rails-4.0/Gemfile.mysql2
13
- - gemfiles/rails-4.1/Gemfile.postgresql
14
- - gemfiles/rails-4.1/Gemfile.sqlite3
15
- - gemfiles/rails-4.1/Gemfile.mysql2
16
- before_script:
17
- - rake create_databases
18
- after_script:
19
- - rake drop_databases
20
- env: 'POSTGRESQL_DB_USER=postgres MYSQL_DB_USER="travis"'
21
- notifications:
22
- recipients:
23
- - michal.lomnicki@gmail.com
24
- - ronen@barzel.org
11
+ - gemfiles/rails-3.2/Gemfile.mysql
12
+ - gemfiles/rails-3.2/Gemfile.mysql2
13
+ - gemfiles/rails-3.2/Gemfile.postgresql
14
+ - gemfiles/rails-3.2/Gemfile.sqlite3
15
+ - gemfiles/rails-4.0/Gemfile.mysql2
16
+ - gemfiles/rails-4.0/Gemfile.postgresql
17
+ - gemfiles/rails-4.0/Gemfile.sqlite3
18
+ - gemfiles/rails-4.1/Gemfile.mysql2
19
+ - gemfiles/rails-4.1/Gemfile.postgresql
20
+ - gemfiles/rails-4.1/Gemfile.sqlite3
21
+ before_script: bundle exec rake create_databases
22
+ after_script: bundle exec rake drop_databases
23
+ env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER="travis"
25
24
  matrix:
26
25
  exclude:
27
- - rvm: jruby
28
- gemfile: gemfiles/rails-3.2/Gemfile.sqlite3
29
- env: 'POSTGRESQL_DB_USER=postgres MYSQL_DB_USER="travis"'
30
- - rvm: jruby
31
- gemfile: gemfiles/rails-4.0/Gemfile.postgresql
32
- env: 'POSTGRESQL_DB_USER=postgres MYSQL_DB_USER="travis"'
33
- - rvm: jruby
34
- gemfile: gemfiles/rails-4.0/Gemfile.sqlite3
35
- env: 'POSTGRESQL_DB_USER=postgres MYSQL_DB_USER="travis"'
36
- - rvm: jruby
37
- gemfile: gemfiles/rails-4.0/Gemfile.mysql2
38
- env: 'POSTGRESQL_DB_USER=postgres MYSQL_DB_USER="travis"'
39
- - rvm: jruby
40
- gemfile: gemfiles/rails-4.1/Gemfile.postgresql
41
- env: 'POSTGRESQL_DB_USER=postgres MYSQL_DB_USER="travis"'
42
- - rvm: jruby
43
- gemfile: gemfiles/rails-4.1/Gemfile.sqlite3
44
- env: 'POSTGRESQL_DB_USER=postgres MYSQL_DB_USER="travis"'
45
- - rvm: jruby
46
- gemfile: gemfiles/rails-4.1/Gemfile.mysql2
47
- env: 'POSTGRESQL_DB_USER=postgres MYSQL_DB_USER="travis"'
26
+ - rvm: jruby
27
+ gemfile: gemfiles/rails-3.2/Gemfile.sqlite3
28
+ env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER="travis"
29
+ - rvm: jruby
30
+ gemfile: gemfiles/rails-4.0/Gemfile.mysql2
31
+ env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER="travis"
32
+ - rvm: jruby
33
+ gemfile: gemfiles/rails-4.0/Gemfile.postgresql
34
+ env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER="travis"
35
+ - rvm: jruby
36
+ gemfile: gemfiles/rails-4.0/Gemfile.sqlite3
37
+ env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER="travis"
38
+ - rvm: jruby
39
+ gemfile: gemfiles/rails-4.1/Gemfile.mysql2
40
+ env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER="travis"
41
+ - rvm: jruby
42
+ gemfile: gemfiles/rails-4.1/Gemfile.postgresql
43
+ env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER="travis"
44
+ - rvm: jruby
45
+ gemfile: gemfiles/rails-4.1/Gemfile.sqlite3
46
+ env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER="travis"
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## Change Log
4
4
 
5
+ ### 1.7.1
6
+
7
+ * Eliminate warnings when ruby is in verbose mode
8
+ * Internal: Now using schema_dev matrix test framework.
9
+
5
10
  ### 1.7.0
6
11
 
7
12
  * Added Postgresql index operator support (issue #184)
data/README.md CHANGED
@@ -331,52 +331,8 @@ of foreign key constraints, you can re-enable it:
331
331
 
332
332
  Are you interested in contributing to schema_plus? Thanks!
333
333
 
334
- Schema_plus has a full set of rspec tests. [travis-ci](http://travis-ci.org/SchemaPlus/schema_plus) runs the tests on the full matrix of supported versions of ruby, rails, and db adapters. But you can also test all or some part of the matrix locally before you push your changes. Here's what you need to know:
334
+ Schema_plus has a full set of rspec tests. [travis-ci](http://travis-ci.org/SchemaPlus/schema_plus) runs the tests on the full matrix of supported versions of ruby, rails, and db adapters. But you can also test all or some part of the matrix locally before you push your changes, using
335
335
 
336
- #### Required environment:
336
+ $ schema_dev rspec
337
337
 
338
- * You must have one of [chruby](https://github.com/postmodern/chruby),) [rbenv](https://github.com/sstephenson/rbenv) or [rvm](http://rvm.io) installed and working. Within it, have available whichever ruby versions you want to test. The default set is MRI 1.9.3, 2.1.3, and jruby
339
-
340
- * Of course you must have installed whichever databases you want to test. The default set is: PostgreSQL, MySQL, and SQLite3.
341
-
342
- * For PostgreSQL and MySQL the tests need a db user with permissions to create and access databases: The default username used by the specs is 'schema_plus' for both PostgreSQL and MySQL; you can change them via:
343
-
344
- $ export POSTGRESQL_DB_USER = pgusername
345
- $ export MYSQL_DB_USER = mysqlusername
346
-
347
- * For PostgreSQL and MySQL you must explicitly create the databases used by the tests:
348
-
349
- $ rake create_databases # creates both postgresql & mysql
350
- OR
351
- $ rake postgresql:create_databases
352
- $ rake mysql:create_databases
353
-
354
- #### Running the tests
355
-
356
- The tests are run via a script in the repo root. Its args are documented by
357
-
358
- $ ./runspecs --help
359
-
360
- By default it runs on a matrix of postgresql, mysql2, and sqlite3, for all rubies and all versions of rails. But the matrix options `--db`, `--ruby`, and `--rails` options let you limit those. The `--quick` option runs on just one set: postgresql, rails 4.1 and ruby 2.1.0. The `--full` option adds the mysql adapter to the set (in addition to mysql2 adapter).
361
-
362
- * Install gem dependencies for the sets you'll be testing:
363
-
364
- $ ./runspecs [matrix options] --install # runs 'bundle install' for all sets
365
- e.g.
366
- $ ./runspecs --db 'posgresql' --ruby '2.1.0' --rails '4.0 4.1' --install
367
-
368
- * Run all the tests:
369
-
370
- $ ./runspecs [matrix options] # runs rspec for each set in the matrix
371
- e.g.
372
- $ ./runspecs --db 'posgresql' --ruby '2.1.0' --rails '4.0 4.1'
373
-
374
- Code coverage information will be in coverage/index.html -- it should be at 100% coverage if you're running against all databases.
375
-
376
- * To run rspec on just a limited set of specs, you can do:
377
-
378
- $ ./runspecs [matrix options] --rspec -- [rspec args]
379
- e.g.
380
- $ ./runspecs --quick --rspec -- spec/migration_spec.rb -e 'default name'
381
-
382
- Contributions to making the testing process itself easier and better will also be gratefully accepted!
338
+ For more details, see the [schema_dev](https://github.com/SchemaPlus/schema_dev) README.
data/Rakefile CHANGED
@@ -1,16 +1,9 @@
1
1
  require 'bundler'
2
2
  Bundler::GemHelper.install_tasks
3
3
 
4
- task :default => :spec
4
+ require 'schema_dev/tasks'
5
5
 
6
- desc 'Run test for adapter whose name is suffix of current Gemfile'
7
- task :spec do
8
- gemfile = ENV['BUNDLE_GEMFILE']
9
- fail "BUNDLE_GEMFILE environment variable not set" unless gemfile
10
- adapter = File.extname(gemfile).sub(/^[.]/, '')
11
- fail "BUNDLE_GEMFILE filename does not end with .db adapter name" if adapter.empty?
12
- Rake::Task["#{adapter}:spec"].invoke
13
- end
6
+ task :default => :spec
14
7
 
15
8
  # work around a bug in rake 10.0.3 with ruby 1.9.2
16
9
  unless RUBY_VERSION == "1.9.2"
@@ -26,59 +19,4 @@ unless RUBY_VERSION == "1.9.2"
26
19
  end
27
20
 
28
21
  require 'rspec/core/rake_task'
29
- %w[postgresql mysql mysql2 sqlite3].each do |adapter|
30
- namespace adapter do
31
- RSpec::Core::RakeTask.new(:spec) do |spec|
32
- spec.rspec_opts = "-Ispec/connections/#{adapter}"
33
- spec.fail_on_error = true
34
- end
35
- end
36
- end
37
-
38
- DATABASES = %w[schema_plus_test]
39
- [
40
- { namespace: :postgresql, uservar: 'POSTGRESQL_DB_USER', defaultuser: 'schema_plus', create: "createdb -U '%{user}' %{dbname}", drop: "dropdb -U '%{user}' %{dbname}" },
41
- { namespace: :mysql, uservar: 'MYSQL_DB_USER', defaultuser: 'schema_plus', create: "mysqladmin -u '%{user}' create %{dbname}", drop: "mysqladmin -u '%{user}' -f drop %{dbname}" }
42
- ].each do |db|
43
- namespace db[:namespace] do
44
- user = ENV.fetch db[:uservar], db[:defaultuser]
45
- task :create_databases do
46
- DATABASES.each do |dbname|
47
- system(db[:create] % {user: user, dbname: dbname})
48
- end
49
- end
50
- task :drop_databases do
51
- DATABASES.each do |dbname|
52
- system(db[:drop] % {user: user, dbname: dbname})
53
- end
54
- end
55
- end
56
- end
57
-
58
- desc 'Run postgresql, mysql, mysql2 and sqlite3 tests'
59
- task :specs do
60
- invoke_multiple(%w[postgresql mysql mysql2 sqlite3], "spec")
61
- end
62
-
63
- desc 'Create test databases'
64
- task :create_databases do
65
- invoke_multiple(%w[postgresql mysql], "create_databases")
66
- end
67
-
68
- desc 'Drop test databases'
69
- task :drop_databases do
70
- invoke_multiple(%w[postgresql mysql], "drop_databases")
71
- end
72
-
73
- def invoke_multiple(namespaces, task)
74
- failed = namespaces.reject { |adapter|
75
- begin
76
- Rake::Task["#{adapter}:#{task}"].invoke
77
- true
78
- rescue => e
79
- warn "\n#{e}\n"
80
- false
81
- end
82
- }
83
- fail "Failure in: #{failed.join(', ')}" if failed.any?
84
- end
22
+ RSpec::Core::RakeTask.new(:spec)
@@ -21,7 +21,7 @@ module SchemaPlus
21
21
 
22
22
  def columns_with_schema_plus #:nodoc:
23
23
  columns = columns_without_schema_plus
24
- columns.each do |column| column.model = self end unless @schema_plus_extended_columns
24
+ columns.each do |column| column.model = self end unless (@schema_plus_extended_columns ||= false)
25
25
  columns
26
26
  end
27
27
 
@@ -1,3 +1,3 @@
1
1
  module SchemaPlus
2
- VERSION = "1.7.0"
2
+ VERSION = "1.7.1"
3
3
  end
@@ -0,0 +1,29 @@
1
+ ruby:
2
+ - jruby
3
+ - 1.9.3
4
+ - 2.1.3
5
+ rails:
6
+ - 3.2
7
+ - 4.0
8
+ - 4.1
9
+ db:
10
+ - mysql
11
+ - mysql2
12
+ - sqlite3
13
+ - postgresql
14
+ exclude:
15
+ -
16
+ rails: 4.0
17
+ db: mysql
18
+ -
19
+ rails: 4.1
20
+ db: mysql
21
+ -
22
+ ruby: jruby
23
+ rails: 4.0
24
+ -
25
+ ruby: jruby
26
+ rails: 4.1
27
+ -
28
+ ruby: jruby
29
+ db: sqlite3
@@ -24,10 +24,12 @@ Gem::Specification.new do |s|
24
24
  s.add_dependency("activerecord", ">= 3.2")
25
25
  s.add_dependency("valuable")
26
26
 
27
+ s.add_development_dependency("schema_dev", "~> 0.1")
27
28
  s.add_development_dependency("rake")
28
29
  s.add_development_dependency("rspec", "~> 3.0.0")
29
30
  s.add_development_dependency("rdoc")
30
31
  s.add_development_dependency("simplecov")
31
32
  s.add_development_dependency("simplecov-gem-profile")
33
+ s.add_development_dependency("its-it")
32
34
  end
33
35
 
@@ -4,7 +4,7 @@ describe "Connection" do
4
4
 
5
5
  it "should re-open without failure" do
6
6
  expect {
7
- ActiveRecord::Base.establish_connection :schema_plus
7
+ ActiveRecord::Base.establish_connection :schema_dev
8
8
  }.to_not raise_error
9
9
  end
10
10
  end
@@ -89,7 +89,7 @@ describe "Foreign Key" do
89
89
  end
90
90
 
91
91
  after(:each) do
92
- fk = Post.foreign_keys.detect { |fk| fk.column_names == %w[author_id] }
92
+ fk = Post.foreign_keys.detect(&its.column_names == %w[author_id])
93
93
  remove_foreign_key(:posts, fk.name)
94
94
  end
95
95
 
@@ -117,7 +117,7 @@ describe "Foreign Key" do
117
117
 
118
118
  context "when is dropped", "comments(post_id)" do
119
119
 
120
- let(:foreign_key_name) { fk = Comment.foreign_keys.detect { |definition| definition.column_names == %w[post_id] } and fk.name }
120
+ let(:foreign_key_name) { fk = Comment.foreign_keys.detect(&its.column_names == %w[post_id]) and fk.name }
121
121
 
122
122
  before(:each) do
123
123
  remove_foreign_key(:comments, foreign_key_name)
@@ -77,7 +77,7 @@ describe "Index definition" do
77
77
  quotes += [
78
78
  ["single-quoted", "'"],
79
79
  ["back-quoted", '`']
80
- ] if SchemaPlusHelpers.sqlite3?
80
+ ] if SchemaDev::Rspec::Helpers.sqlite3?
81
81
 
82
82
  quotes.each do |quotename, quote|
83
83
  it "index definition includes orders for #{quotename} columns" do
@@ -37,7 +37,7 @@ describe "index" do
37
37
 
38
38
  after(:each) do
39
39
  migration.suppress_messages do
40
- migration.remove_index(:users, :name => @index.name) if @index
40
+ migration.remove_index(:users, :name => @index.name) if (@index ||= nil)
41
41
  end
42
42
  end
43
43
 
@@ -780,12 +780,12 @@ describe ActiveRecord::Migration do
780
780
  end
781
781
 
782
782
  it "should rename rails-named indexes" do
783
- index = ActiveRecord::Base.connection.indexes(:newname).find{|index| index.columns == ['xyz']}
783
+ index = ActiveRecord::Base.connection.indexes(:newname).find(&its.columns == ['xyz'])
784
784
  expect(index.name).to match(/^index_newname_on/)
785
785
  end
786
786
 
787
787
  it "should rename fk indexes" do
788
- index = ActiveRecord::Base.connection.indexes(:newname).find{|index| index.columns == ['user_id']}
788
+ index = ActiveRecord::Base.connection.indexes(:newname).find(&its.columns == ['user_id'])
789
789
  expect(index.name).to match(/^fk__newname_/)
790
790
  end
791
791
 
@@ -131,7 +131,7 @@ describe "with multiple schemas" do
131
131
  create_table "schema_plus_test2.groups", :force => true do |t|
132
132
  end
133
133
  create_table "schema_plus_test2.members", :force => true do |t|
134
- t.integer :item_id, :foreign_key => true unless SchemaPlusHelpers.mysql?
134
+ t.integer :item_id, :foreign_key => true unless SchemaDev::Rspec::Helpers.mysql?
135
135
  t.integer :group_id, :foreign_key => { references: "schema_plus_test2.groups" }
136
136
  end
137
137
  end
@@ -174,7 +174,7 @@ describe "with multiple schemas" do
174
174
 
175
175
  it "should include the schema in the constraint name" do
176
176
  expected_names = ["fk_schema_plus_test2_members_group_id"]
177
- expected_names << "fk_schema_plus_test2_members_item_id" unless SchemaPlusHelpers.mysql?
177
+ expected_names << "fk_schema_plus_test2_members_item_id" unless SchemaDev::Rspec::Helpers.mysql?
178
178
  expect(Member.foreign_keys.map(&:name).sort).to match_array(expected_names.sort)
179
179
  end
180
180
  end
@@ -55,7 +55,7 @@ describe "Schema dump" do
55
55
 
56
56
  it "should include foreign_key name" do
57
57
  with_foreign_key Post, :user_id, :users, :id, :name => "yippee" do
58
- expect(dump_posts).to match /foreign_key.*user_id.*users.*id.*:name => "yippee"/
58
+ expect(dump_posts).to match(/foreign_key.*user_id.*users.*id.*:name => "yippee"/)
59
59
  end
60
60
  end
61
61
 
@@ -80,8 +80,8 @@ describe "Schema dump" do
80
80
  it "should handle regexp in ignore_tables" do
81
81
  with_foreign_key Comment, :post_id, :posts, :id do
82
82
  dump = dump_schema(:ignore => /post/)
83
- expect(dump).to match /create_table "comments"/
84
- expect(dump).not_to match /create_table "posts"/
83
+ expect(dump).to match(/create_table "comments"/)
84
+ expect(dump).not_to match(/create_table "posts"/)
85
85
  end
86
86
  end
87
87
 
@@ -22,7 +22,7 @@ describe ActiveRecord::Schema do
22
22
 
23
23
  it "should create only explicity added indexes" do
24
24
  do_schema
25
- expected = SchemaPlusHelpers.mysql? ? 2 : 1
25
+ expected = SchemaDev::Rspec::Helpers.mysql? ? 2 : 1
26
26
  expect(connection.tables.collect { |table| connection.indexes(table) }.flatten.size).to eq(expected)
27
27
  end
28
28
 
@@ -10,19 +10,17 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
10
10
  require 'rspec'
11
11
  require 'active_record'
12
12
  require 'schema_plus'
13
- require 'connection'
13
+ require 'schema_dev/rspec'
14
+ require 'its-it'
15
+
16
+ SchemaDev::Rspec.setup_db
14
17
 
15
18
  Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f}
16
19
 
17
20
  RSpec.configure do |config|
18
21
  config.include(SchemaPlusMatchers)
19
22
  config.include(SchemaPlusHelpers)
20
- config.filter_run_excluding :postgresql => :only unless SchemaPlusHelpers.postgresql?
21
- config.filter_run_excluding :postgresql => :skip if SchemaPlusHelpers.postgresql?
22
- config.filter_run_excluding :mysql => :only unless SchemaPlusHelpers.mysql?
23
- config.filter_run_excluding :mysql => :skip if SchemaPlusHelpers.mysql?
24
- config.filter_run_excluding :sqlite3 => :only unless SchemaPlusHelpers.sqlite3?
25
- config.filter_run_excluding :sqlite3 => :skip if SchemaPlusHelpers.sqlite3?
23
+ config.warnings = true
26
24
  end
27
25
 
28
26
  def with_fk_config(opts, &block)
@@ -1,18 +1,6 @@
1
1
  module SchemaPlusHelpers
2
2
  extend self
3
3
 
4
- def mysql?
5
- ActiveRecord::Base.connection.adapter_name =~ /^mysql/i
6
- end
7
-
8
- def postgresql?
9
- ActiveRecord::Base.connection.adapter_name =~ /^postgresql/i
10
- end
11
-
12
- def sqlite3?
13
- ActiveRecord::Base.connection.adapter_name =~ /^sqlite/i
14
- end
15
-
16
4
  def suppress_messages
17
5
  ActiveRecord::Migration.suppress_messages { yield }
18
6
  end
@@ -2,7 +2,7 @@ module SchemaPlusMatchers
2
2
 
3
3
  class Reference
4
4
  def initialize(expected)
5
- @column_names = nil
5
+ @column_names = @on_update = @on_delete = @deferrable = @name = @references_table_name = @references_column_names = nil
6
6
  unless expected.empty?
7
7
  @references_column_names = Array(expected).collect(&:to_s)
8
8
  @references_table_name = @references_column_names.shift
@@ -68,7 +68,7 @@ describe ActiveRecord do
68
68
  # when in the (say) development database, but then uses it to
69
69
  # initialize the test database when testing. this meant that the
70
70
  # test database had views into the development database.
71
- db = connection.respond_to?(:current_database)? connection.current_database : ActiveRecord::Base.configurations['schema_plus'][:database]
71
+ db = connection.respond_to?(:current_database)? connection.current_database : SchemaDev::Rspec.db_configuration[:database]
72
72
  expect(dump).not_to match(%r{#{connection.quote_table_name(db)}[.]})
73
73
  end
74
74
 
@@ -161,7 +161,7 @@ describe ActiveRecord do
161
161
 
162
162
  create_view :a_ones, Item.select('b, s').where(:a => 1)
163
163
  create_view :ab_ones, "select s from a_ones where b = 1"
164
- create_view :pg_dummy_internal, "select 1" if SchemaPlusHelpers.postgresql?
164
+ create_view :pg_dummy_internal, "select 1" if SchemaDev::Rspec::Helpers.postgresql?
165
165
  end
166
166
  end
167
167
  connection.execute "insert into items (a, b, s) values (1, 1, 'one_one')"
@@ -177,7 +177,7 @@ describe ActiveRecord do
177
177
  drop_view "ab_ones"
178
178
  drop_view "a_ones"
179
179
  drop_table "items"
180
- drop_view :pg_dummy_internal if SchemaPlusHelpers.postgresql?
180
+ drop_view :pg_dummy_internal if SchemaDev::Rspec::Helpers.postgresql?
181
181
  end
182
182
  end
183
183
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schema_plus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ronen Barzel
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-11-19 00:00:00.000000000 Z
12
+ date: 2014-12-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -39,6 +39,20 @@ dependencies:
39
39
  - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: schema_dev
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '0.1'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '0.1'
42
56
  - !ruby/object:Gem::Dependency
43
57
  name: rake
44
58
  requirement: !ruby/object:Gem::Requirement
@@ -109,6 +123,20 @@ dependencies:
109
123
  - - ">="
110
124
  - !ruby/object:Gem::Version
111
125
  version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: its-it
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
112
140
  description: 'SchemaPlus is an ActiveRecord extension that provides enhanced capabilities
113
141
  for schema definition and querying, including: enhanced and more DRY index capabilities,
114
142
  support and automation for foreign key constraints, and support for views.'
@@ -166,15 +194,11 @@ files:
166
194
  - lib/schema_plus/active_record/schema_dumper.rb
167
195
  - lib/schema_plus/railtie.rb
168
196
  - lib/schema_plus/version.rb
169
- - runspecs
197
+ - schema_dev.yml
170
198
  - schema_plus.gemspec
171
199
  - spec/column_default_spec.rb
172
200
  - spec/column_spec.rb
173
201
  - spec/connection_spec.rb
174
- - spec/connections/mysql/connection.rb
175
- - spec/connections/mysql2/connection.rb
176
- - spec/connections/postgresql/connection.rb
177
- - spec/connections/sqlite3/connection.rb
178
202
  - spec/enum_spec.rb
179
203
  - spec/foreign_key_definition_spec.rb
180
204
  - spec/foreign_key_spec.rb
@@ -221,10 +245,6 @@ test_files:
221
245
  - spec/column_default_spec.rb
222
246
  - spec/column_spec.rb
223
247
  - spec/connection_spec.rb
224
- - spec/connections/mysql/connection.rb
225
- - spec/connections/mysql2/connection.rb
226
- - spec/connections/postgresql/connection.rb
227
- - spec/connections/sqlite3/connection.rb
228
248
  - spec/enum_spec.rb
229
249
  - spec/foreign_key_definition_spec.rb
230
250
  - spec/foreign_key_spec.rb
data/runspecs DELETED
@@ -1,142 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'optparse'
4
- require 'ostruct'
5
- require 'shellwords'
6
- require 'tempfile'
7
-
8
- RUBY_VERSIONS = %W[jruby 1.9.3 2.1.3]
9
- RAILS_VERSIONS = %W[3.2 4.0 4.1]
10
- DB_ADAPTERS = %W[postgresql mysql mysql2 sqlite3]
11
-
12
- o = OpenStruct.new
13
- o.ruby_versions = RUBY_VERSIONS
14
- o.rails_versions = RAILS_VERSIONS
15
- o.db_adapters = DB_ADAPTERS - ["mysql"]
16
-
17
- OptionParser.new do |opts|
18
- opts.banner = "Usage: #{$0} [options]"
19
-
20
- opts.on("-n", "--dry-run", "Do a dry run without executing actions") do |v|
21
- o.dry_run = true
22
- end
23
-
24
- opts.on("--update", "Update gem dependencies") do |v|
25
- o.update = v
26
- end
27
-
28
- opts.on("--install", "Install gem dependencies") do |v|
29
- o.install = v
30
- end
31
-
32
- opts.on("--db adapter", String, "Choose which db adapter(s) to run. Default is: #{o.db_adapters.join(' ')}" ) do |adapter|
33
- o.db_adapters = adapter.split
34
- end
35
-
36
- opts.on("--ruby version", String, "Choose which version(s) of ruby to run. Default is: #{o.ruby_versions.join(' ')}") do |ruby|
37
- o.ruby_versions = ruby.split(' ')
38
- end
39
-
40
- opts.on("--rails version", String, "Choose which version(s) of rails to run. Default is: #{o.rails_versions.join(' ')}") do |rails|
41
- o.rails_versions = rails.split(' ')
42
- end
43
-
44
- opts.on("--full", "run complete matrix of ruby, rails, and db") do
45
- o.ruby_versions = RUBY_VERSIONS
46
- o.rails_versions = RAILS_VERSIONS
47
- o.db_adapters = DB_ADAPTERS
48
- end
49
-
50
- opts.on("--quick", "quick run on PostgreSQL, ruby #{RUBY_VERSIONS.last} and rails #{RAILS_VERSIONS.last}") do
51
- o.ruby_versions = [RUBY_VERSIONS.last]
52
- o.rails_versions = [RAILS_VERSIONS.last]
53
- o.db_adapters = ["postgresql"]
54
- end
55
-
56
- opts.on("--rspec", "run rspec rather than rake") do |v|
57
- o.rspec = v
58
- end
59
-
60
- end.parse!
61
-
62
-
63
- Combo = Struct.new(:ruby, :rails, :db_adapter)
64
-
65
- combos = o.ruby_versions.product(o.rails_versions, o.db_adapters).map{|product| Combo.new(*product)}.select {|combo|
66
- case
67
- when combo.rails >= "3.2" && combo.ruby <= "1.8.7" then false # no longer happens, just keeping it as an example
68
- when combo.rails >= "4" && combo.db_adapter == "mysql" then false
69
- when combo.ruby == "jruby"
70
- case
71
- when combo.rails > "3.2" then false
72
- when combo.db_adapter == "postgresql" then true
73
- when combo.db_adapter =~ /mysql/ then true
74
- else false
75
- end
76
- else true
77
- end
78
- }
79
-
80
- case
81
- when system("which -s chruby-exec")
82
- def ruby_version_selector(ruby)
83
- "SHELL=`which bash` chruby-exec #{ruby} --"
84
- end
85
-
86
- when system("which -s rvm")
87
- # using rvm
88
- def ruby_version_selector(ruby)
89
- "rvm #{ruby} do"
90
- end
91
- else
92
- # using rbenv.
93
- #
94
- # because we're running within a ruby program that was launched by
95
- # rbenv, we already have various environment variables set up. need
96
- # strip those out so that the forked shell can run a diifferent ruby
97
- # version than the one we're in now.
98
- ENV['PATH'] = ENV['PATH'].split(':').reject{|dir| dir =~ %r{/\.?rbenv/(?!shims)}}.join(':')
99
- ENV['GEM_PATH'] = ENV['GEM_PATH'].split(':').reject{|dir| dir =~ %r{/\.?rbenv}}.join(':') unless ENV['GEM_PATH'].nil?
100
- ENV['RBENV_DIR'] = nil
101
- ENV['RBENV_HOOK_PATH'] = nil
102
-
103
- def ruby_version_selector(ruby)
104
- @versions ||= `rbenv versions --bare`.split
105
- version = @versions.select{|v| v.start_with? ruby}.last || abort("no ruby version '#{ruby}' installed in rbenv")
106
- "RBENV_VERSION=#{version}"
107
- end
108
- end
109
-
110
-
111
- GEMFILES_DIR = File.expand_path('../gemfiles', __FILE__)
112
- errs = []
113
- combos.each_with_index do |combo, n|
114
- ruby = combo.ruby
115
- rails = combo.rails
116
- db_adapter = combo.db_adapter
117
-
118
- cmd = case
119
- when o.update
120
- "bundle update"
121
- when o.install
122
- "bundle install"
123
- when o.rspec
124
- "bundle exec rspec -Ispec/connections/#{db_adapter}"
125
- else
126
- "bundle exec rake #{db_adapter}:spec"
127
- end
128
-
129
- command = %Q{/usr/bin/env BUNDLE_GEMFILE="#{File.join(GEMFILES_DIR, "rails-#{rails}", "Gemfile.#{db_adapter}")}" #{ruby_version_selector(ruby)} #{cmd} #{Shellwords.join(ARGV)}}
130
-
131
- puts "\n\n*** ruby version #{ruby} - rails version #{rails} - db adapter: #{db_adapter} [#{n+1} of #{combos.size}]\n\n#{command}"
132
-
133
- next if o.dry_run
134
-
135
- Tempfile.open('runspecs') do |file|
136
- system("(#{command}) 2>&1 | tee #{file.path}")
137
- file.rewind
138
- errs << "ruby #{ruby}, rails #{rails}#{db_adapter && ", db_adapter #{db_adapter}"}" if file.readlines.grep(/(^Failed examples)|(rake aborted)/).any?
139
- end
140
- end
141
- puts errs.any? ? "\n*** #{errs.size} failures:\n\t#{errs.join("\n\t")}" : "\n*** #{combos.size > 1 ? 'all versions' : 'spec'} succeeded ***" unless o.dry_run
142
- exit !errs.any?
@@ -1,17 +0,0 @@
1
- print "Using MySQL\n"
2
- require 'logger'
3
-
4
- ActiveRecord::Base.logger = Logger.new(File.open("mysql.log", "w"))
5
-
6
- ActiveRecord::Base.configurations = {
7
- 'schema_plus' => {
8
- :adapter => 'mysql',
9
- :database => 'schema_plus_test',
10
- :username => ENV.fetch('MYSQL_DB_USER', 'schema_plus'),
11
- :encoding => 'utf8',
12
- :min_messages => 'warning'
13
- }
14
-
15
- }
16
-
17
- ActiveRecord::Base.establish_connection :schema_plus
@@ -1,17 +0,0 @@
1
- print "Using MySQL2\n"
2
- require 'logger'
3
-
4
- ActiveRecord::Base.logger = Logger.new(File.open("mysql2.log", "w"))
5
-
6
- ActiveRecord::Base.configurations = {
7
- 'schema_plus' => {
8
- :adapter => 'mysql2',
9
- :database => 'schema_plus_test',
10
- :username => ENV.fetch('MYSQL_DB_USER', 'schema_plus'),
11
- :encoding => 'utf8',
12
- :min_messages => 'warning'
13
- }
14
-
15
- }
16
-
17
- ActiveRecord::Base.establish_connection :schema_plus
@@ -1,16 +0,0 @@
1
- print "Using PostgreSQL\n"
2
- require 'logger'
3
-
4
- ActiveRecord::Base.logger = Logger.new(File.open("postgresql.log", "w"))
5
-
6
- ActiveRecord::Base.configurations = {
7
- 'schema_plus' => {
8
- :adapter => 'postgresql',
9
- :username => ENV['POSTGRESQL_DB_USER'],
10
- :database => 'schema_plus_test',
11
- :min_messages => 'warning'
12
- }
13
-
14
- }
15
-
16
- ActiveRecord::Base.establish_connection :schema_plus
@@ -1,15 +0,0 @@
1
- print "Using SQLite3\n"
2
- require 'logger'
3
-
4
- ActiveRecord::Base.logger = Logger.new(File.open("sqlite3.log", "w"))
5
-
6
- ActiveRecord::Base.configurations = {
7
- 'schema_plus' => {
8
- :adapter => 'sqlite3',
9
- :database => File.expand_path('schema_plus.sqlite3', File.dirname(__FILE__)),
10
- }
11
-
12
- }
13
-
14
- ActiveRecord::Base.establish_connection :schema_plus
15
- ActiveRecord::Base.connection.execute "PRAGMA synchronous = OFF"