schema_plus_indexes 0.1.1 → 0.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: c3204552a60115feff109316363cec1ab9cc45e2
4
- data.tar.gz: a1087216a0144af5c299bc0972fca2989c81c122
3
+ metadata.gz: 5f4aa8a0bb209b6aefdd7ae30e47ec26c594a6e3
4
+ data.tar.gz: 6deee591cfa43d5a6bb3a14f5a4048647b9c0a2f
5
5
  SHA512:
6
- metadata.gz: 537929890d6ad08fd33f11a7f36c0b9413a93281e252258048e060eb71a05434f32d800f2887f13c044c0b2c3044fe684cb15e912fbfe00f6ce3706dc01611cc
7
- data.tar.gz: f36b1a1c603c1ee61ffcb1ed80345eee92c7f177c953ee859da21feefcc2b5a892a08caeb40e3dcea4b5295aa84eca702b432a7ca757c2cfff2e377bf1e68f62
6
+ metadata.gz: 73655b914ee4ff00cdc004d605e843eaa9c88268073ae1658ed6b6df0153a8b3e969b48ecdd1595e0c66237afc1e58d10cb18e526de97850dc620627f24bf465
7
+ data.tar.gz: c8fe49bbd8130f7562ab10b4d3caff918e2d9efbd826f16ecec40789fb6d979c47a00824df0811d52756c414b171d0a43115a0d355d623f394860a2aaa776919
data/.travis.yml CHANGED
@@ -5,7 +5,6 @@
5
5
  ---
6
6
  sudo: false
7
7
  rvm:
8
- - 1.9.3
9
8
  - 2.1.5
10
9
  gemfile:
11
10
  - gemfiles/activerecord-4.2/Gemfile.mysql2
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
1
  source "http://rubygems.org"
2
2
 
3
3
  gemspec
4
+
5
+ File.exist?(gemfile_local = File.expand_path('../Gemfile.local', __FILE__)) and eval File.read(gemfile_local), binding, gemfile_local
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  # schema_plus_indexes
7
7
 
8
- Schema_plus_index adds various convenient capabilities to `ActiveRecord`'s index handling:
8
+ SchemaPlusIndexes adds various convenient capabilities to `ActiveRecord`'s index handling:
9
9
 
10
10
  * Adds shorthands to the `:index` option in migrations
11
11
 
@@ -45,18 +45,31 @@ schema_plus_indexes is part of the [SchemaPlus](https://github.com/SchemaPlus/)
45
45
 
46
46
  ## Installation
47
47
 
48
- In your application's Gemfile
48
+ <!-- SCHEMA_DEV: TEMPLATE INSTALLATION - begin -->
49
+ <!-- These lines are auto-inserted from a schema_dev template -->
50
+ As usual:
49
51
 
50
52
  ```ruby
51
- gem "schema_plus_indexes"
53
+ gem "schema_plus_indexes" # in a Gemfile
54
+ gem.add_dependency "schema_plus_indexes" # in a .gemspec
52
55
  ```
56
+
57
+ To use with a rails app, also include
58
+
59
+ ```ruby
60
+ gem "schema_monkey_rails"
61
+ ```
62
+
63
+ which creates a Railtie to that will insert SchemaPlus::Indexes appropriately into the rails stack. To use with Padrino, see [schema_monkey_padrino](https://github.com/SchemaPlus/schema_monkey_padrino).
64
+
65
+ <!-- SCHEMA_DEV: TEMPLATE INSTALLATION - end -->
66
+
53
67
  ## Compatibility
54
68
 
55
69
  schema_plus_indexes is tested on
56
70
 
57
71
  <!-- SCHEMA_DEV: MATRIX - begin -->
58
72
  <!-- These lines are auto-generated by schema_dev based on schema_dev.yml -->
59
- * ruby **1.9.3** with activerecord **4.2**, using **mysql2**, **sqlite3** or **postgresql**
60
73
  * ruby **2.1.5** with activerecord **4.2**, using **mysql2**, **sqlite3** or **postgresql**
61
74
 
62
75
  <!-- SCHEMA_DEV: MATRIX - end -->
@@ -74,8 +87,10 @@ the standard protocol: fork, feature branch, develop, push, and issue pull reque
74
87
 
75
88
  Some things to know about to help you develop and test:
76
89
 
77
- * **schema_dev**: schema_plus_indexes uses [schema_dev](https://github.com/SchemaPlus/schema_dev) to
78
- facilitate running rspec tests on the matrix of ruby, rails, and database
90
+ <!-- SCHEMA_DEV: TEMPLATE USES SCHEMA_DEV - begin -->
91
+ <!-- These lines are auto-inserted from a schema_dev template -->
92
+ * **schema_dev**: SchemaPlus::Indexes uses [schema_dev](https://github.com/SchemaPlus/schema_dev) to
93
+ facilitate running rspec tests on the matrix of ruby, activerecord, and database
79
94
  versions that the gem supports, both locally and on
80
95
  [travis-ci](http://travis-ci.org/SchemaPlus/schema_plus_indexes)
81
96
 
@@ -84,15 +99,29 @@ Some things to know about to help you develop and test:
84
99
  $ schema_dev bundle install
85
100
  $ schema_dev rspec
86
101
 
87
- You can also run on just one configuration at a time; For info, see `schema_dev --help` or the
88
- [schema_dev](https://github.com/SchemaPlus/schema_dev) README.
102
+ You can also run on just one configuration at a time; For info, see `schema_dev --help` or the [schema_dev](https://github.com/SchemaPlus/schema_dev) README.
89
103
 
90
104
  The matrix of configurations is specified in `schema_dev.yml` in
91
105
  the project root.
92
106
 
93
- * **schema_monkey**: schema_plus_indexes extends ActiveRecord using
94
- [schema_monkey](https://github.com/SchemaPlus/schema_monkey)'s extension
95
- API and protocols -- see its README for details. If your contribution needs any additional monkey patching
96
- that isn't already supported by
97
- [schema_monkey](https://github.com/SchemaPlus/schema_monkey), please head
98
- over there and submit a PR.
107
+
108
+ <!-- SCHEMA_DEV: TEMPLATE USES SCHEMA_DEV - end -->
109
+ <!-- SCHEMA_DEV: TEMPLATE USES SCHEMA_PLUS_CORE - begin -->
110
+ <!-- These lines are auto-inserted from a schema_dev template -->
111
+ * **schema_plus_core**: SchemaPlus::Indexes uses the SchemaPlus::Core API that
112
+ provides middleware callback stacks to make it easy to extend
113
+ ActiveRecord's behavior. If that API is missing something you need for
114
+ your contribution, please head over to
115
+ [schema_plus_core](https://github/SchemaPlus/schema_plus_core) and open
116
+ an issue or pull request.
117
+
118
+ <!-- SCHEMA_DEV: TEMPLATE USES SCHEMA_PLUS_CORE - end -->
119
+ <!-- SCHEMA_DEV: TEMPLATE USES SCHEMA_MONKEY - begin -->
120
+ <!-- These lines are auto-inserted from a schema_dev template -->
121
+ * **schema_monkey**: SchemaPlus::Indexes is implemented as a
122
+ [schema_monkey](https://github.com/SchemaPlus/schema_monkey) client,
123
+ using [schema_monkey](https://github.com/SchemaPlus/schema_monkey)'s
124
+ convention-based protocols for extending ActiveRecord and using middleware stacks.
125
+ For more information see [schema_monkey](https://github.com/SchemaPlus/schema_monkey)'s README.
126
+
127
+ <!-- SCHEMA_DEV: TEMPLATE USES SCHEMA_MONKEY - end -->
@@ -1,8 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
  gemspec :path => File.expand_path('..', __FILE__)
3
3
 
4
- platform :ruby do
5
- gem "byebug" if RUBY_VERSION > "2"
6
- end
7
-
8
4
  File.exist?(gemfile_local = File.expand_path('../Gemfile.local', __FILE__)) and eval File.read(gemfile_local), binding, gemfile_local
@@ -1,4 +1,4 @@
1
- require 'schema_monkey'
1
+ require 'schema_plus/core'
2
2
 
3
3
  require_relative 'schema_plus_indexes/active_record/base'
4
4
  require_relative 'schema_plus_indexes/active_record/connection_adapters/abstract_adapter'
@@ -6,6 +6,6 @@ require_relative 'schema_plus_indexes/active_record/connection_adapters/index_de
6
6
  require_relative 'schema_plus_indexes/middleware/dumper'
7
7
  require_relative 'schema_plus_indexes/middleware/migration'
8
8
  require_relative 'schema_plus_indexes/middleware/model'
9
- require_relative 'schema_plus_indexes/middleware/sqlite3'
9
+ require_relative 'schema_plus_indexes/middleware/schema'
10
10
 
11
- SchemaMonkey.register(SchemaPlusIndexes)
11
+ SchemaMonkey.register SchemaPlusIndexes
@@ -1,12 +1,7 @@
1
1
  module SchemaPlusIndexes
2
2
  module ActiveRecord
3
-
4
3
  module Base
5
- def self.included(base) #:nodoc:
6
- base.extend(ClassMethods)
7
- end
8
-
9
- module ClassMethods #:nodoc:
4
+ module ClassMethods
10
5
 
11
6
  public
12
7
 
@@ -3,18 +3,14 @@ module SchemaPlusIndexes
3
3
  module ConnectionAdapters
4
4
  module AbstractAdapter
5
5
 
6
- def self.included(base) #:nodoc:
7
- base.alias_method_chain :remove_index, :schema_plus_indexes
8
- end
9
-
10
6
  # Extends rails' remove_index to include this options:
11
7
  # :if_exists
12
- def remove_index_with_schema_plus_indexes(table_name, *args)
8
+ def remove_index(table_name, *args)
13
9
  options = args.extract_options!
14
10
  if_exists = options.delete(:if_exists)
15
11
  args << options if options.any?
16
12
  return if if_exists and not index_name_exists?(table_name, options[:name] || index_name(table_name, *args), false)
17
- remove_index_without_schema_plus_indexes(table_name, *args)
13
+ super table_name, *args
18
14
  end
19
15
 
20
16
  end
@@ -6,17 +6,14 @@ module SchemaPlusIndexes
6
6
  # about partial indexes and case sensitivity (i.e. Postgresql
7
7
  # support).
8
8
  module IndexDefinition
9
- def self.included(base) #:nodoc:
10
- base.alias_method_chain :initialize, :schema_plus_indexes
11
- end
12
9
 
13
- def initialize_with_schema_plus_indexes(*args) #:nodoc:
10
+ def initialize(*args) #:nodoc:
14
11
  # same args as add_index(table_name, column_names, options)
15
12
  if args.length == 3 and Hash === args.last
16
13
  table_name, column_names, options = args + [{}]
17
- initialize_without_schema_plus_indexes(table_name, options[:name], options[:unique], column_names, options[:length], options[:orders], options[:where], options[:type], options[:using])
14
+ super table_name, options[:name], options[:unique], column_names, options[:length], options[:orders], options[:where], options[:type], options[:using]
18
15
  else # backwards compatibility
19
- initialize_without_schema_plus_indexes(*args)
16
+ super
20
17
  end
21
18
  unless orders.blank?
22
19
  # fill out orders with :asc when undefined. make sure hash ordering
@@ -1,7 +1,7 @@
1
1
  module SchemaPlusIndexes
2
2
  module Middleware
3
- module Sqlite3
4
- module Query
3
+ module Schema
4
+ module Sqlite3
5
5
  module Indexes
6
6
 
7
7
  def after(env)
@@ -1,3 +1,3 @@
1
1
  module SchemaPlusIndexes
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/schema_dev.yml CHANGED
@@ -1,5 +1,4 @@
1
1
  ruby:
2
- - 1.9.3
3
2
  - 2.1.5
4
3
  activerecord:
5
4
  - 4.2
@@ -3,27 +3,27 @@ lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'schema_plus_indexes/version'
5
5
 
6
- Gem::Specification.new do |spec|
7
- spec.name = "schema_plus_indexes"
8
- spec.version = SchemaPlusIndexes::VERSION
9
- spec.authors = ["ronen barzel"]
10
- spec.email = ["ronen@barzel.org"]
11
- spec.summary = %q{Adds shorthands and conveniences to ActiveRecord's handling of indexes}
12
- spec.homepage = "https://github.com/SchemaPlus/schema_plus_indexes"
13
- spec.license = "MIT"
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "schema_plus_indexes"
8
+ gem.version = SchemaPlusIndexes::VERSION
9
+ gem.authors = ["ronen barzel"]
10
+ gem.email = ["ronen@barzel.org"]
11
+ gem.summary = %q{Adds shorthands and conveniences to ActiveRecord's handling of indexes}
12
+ gem.homepage = "https://github.com/SchemaPlus/schema_plus_indexes"
13
+ gem.license = "MIT"
14
14
 
15
- spec.files = `git ls-files -z`.split("\x0")
16
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
- spec.require_paths = ["lib"]
15
+ gem.files = `git ls-files -z`.split("\x0")
16
+ gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
19
 
20
- spec.add_dependency "activerecord", "~> 4.2"
21
- spec.add_dependency "schema_monkey", "~> 1.0"
20
+ gem.add_dependency "activerecord", "~> 4.2"
21
+ gem.add_dependency "schema_plus_core", "~> 0.1"
22
22
 
23
- spec.add_development_dependency "bundler", "~> 1.7"
24
- spec.add_development_dependency "rake", "~> 10.0"
25
- spec.add_development_dependency "rspec", "~> 3.0.0"
26
- spec.add_development_dependency "schema_dev", "~> 3.0"
27
- spec.add_development_dependency "simplecov"
28
- spec.add_development_dependency "simplecov-gem-profile"
23
+ gem.add_development_dependency "bundler", "~> 1.7"
24
+ gem.add_development_dependency "rake", "~> 10.0"
25
+ gem.add_development_dependency "rspec", "~> 3.0.0"
26
+ gem.add_development_dependency "schema_dev", "~> 3.1"
27
+ gem.add_development_dependency "simplecov"
28
+ gem.add_development_dependency "simplecov-gem-profile"
29
29
  end
data/spec/spec_helper.rb CHANGED
@@ -23,7 +23,7 @@ def define_schema(config={}, &block)
23
23
  ActiveRecord::Migration.suppress_messages do
24
24
  ActiveRecord::Schema.define do
25
25
  connection.tables.each do |table|
26
- drop_table table, :cascade => true
26
+ drop_table table, :force => :cascade
27
27
  end
28
28
  instance_eval &block
29
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schema_plus_indexes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ronen barzel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-03 00:00:00.000000000 Z
11
+ date: 2015-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -25,19 +25,19 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.2'
27
27
  - !ruby/object:Gem::Dependency
28
- name: schema_monkey
28
+ name: schema_plus_core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.0'
33
+ version: '0.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.0'
40
+ version: '0.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '3.0'
89
+ version: '3.1'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '3.0'
96
+ version: '3.1'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: simplecov
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -147,7 +147,7 @@ files:
147
147
  - lib/schema_plus_indexes/middleware/dumper.rb
148
148
  - lib/schema_plus_indexes/middleware/migration.rb
149
149
  - lib/schema_plus_indexes/middleware/model.rb
150
- - lib/schema_plus_indexes/middleware/sqlite3.rb
150
+ - lib/schema_plus_indexes/middleware/schema.rb
151
151
  - lib/schema_plus_indexes/version.rb
152
152
  - schema_dev.yml
153
153
  - schema_plus_indexes.gemspec