schema_monkey 2.0.1 → 2.1.0

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: e2ba91ff751129e56965c986ca35a5ca8c7a4996
4
- data.tar.gz: 48fac590947b7de42eeb8137eac0ec79639eb544
3
+ metadata.gz: 2cd38c5890ddc04325c12c6e231bda0d1622ba4e
4
+ data.tar.gz: dea34315b4b49a545dd43c440f6ffdec23a571c1
5
5
  SHA512:
6
- metadata.gz: 2f989b848d4dd7b49d970c7e65faa96ddf503a05c24463d0e8737f3f136fd0e1175181d65b649964d66ac9aae0f5977f039cb5b5d7b803e73bf448975899e92e
7
- data.tar.gz: 8674917f2c77a10d16d1d52c9b54ed2bafc4386f869588d401fdbece2ae731b1e1a2787c6587e0c98c04caa11363b35d058f9fac772b1bd7de1ab240279513ff
6
+ metadata.gz: 528676ab7eca48f208b8ceca8b470831d48b767f7a52f559640d708f4e0c543adf92074347b805f60bcadd02e36946f90c34a3bb0ddda0286bb01a577fc04068
7
+ data.tar.gz: 38d41cfef17a81fcd208a1085978cf0abede1878f3d73f5a1cea3411ada32677d2e6851031e2d9d658782318c5807faa09ba9974e14f802adc1cf63f864b7974
data/README.md CHANGED
@@ -21,14 +21,6 @@ gem "schema_monkey" # in a Gemfile
21
21
  gem.add_dependency "schema_monkey" # in a .gemspec
22
22
  ```
23
23
 
24
- To use with a rails app, also include
25
-
26
- ```ruby
27
- gem "schema_monkey_rails"
28
- ```
29
-
30
- which creates a Railtie to insert SchemaMonkey appropriately into the rails stack. To use with Padrino, see [schema_monkey_padrino](https://github.com/SchemaPlus/schema_monkey_padrino).
31
-
32
24
  ## Usage
33
25
 
34
26
  SchemaMonkey works with the notion of a "client" -- which is a module containining definitions. A typical SchemaMonkey client looks like
@@ -62,16 +54,16 @@ of course a typical client will be split into files corresponding to submodules;
62
54
  ```ruby
63
55
  require 'schema_plus/core'
64
56
 
65
- require_relative 'schema_plus_indexes/active_record/base'
66
- require_relative 'schema_plus_indexes/active_record/connection_adapters/abstract_adapter'
67
- require_relative 'schema_plus_indexes/active_record/connection_adapters/index_definition'
57
+ require 'schema_plus/indexes/active_record/base'
58
+ require 'schema_plus/indexes/active_record/connection_adapters/abstract_adapter'
59
+ require 'schema_plus/indexes/active_record/connection_adapters/index_definition'
68
60
 
69
- require_relative 'schema_plus_indexes/middleware/dumper'
70
- require_relative 'schema_plus_indexes/middleware/migration'
71
- require_relative 'schema_plus_indexes/middleware/model'
72
- require_relative 'schema_plus_indexes/middleware/query'
61
+ require 'schema_plus/indexes/middleware/dumper'
62
+ require 'schema_plus/indexes/middleware/migration'
63
+ require 'schema_plus/indexes/middleware/model'
64
+ require 'schema_plus/indexes/middleware/schema'
73
65
 
74
- SchemaMonkey.register SchemaPlusIndexes
66
+ SchemaMonkey.register SchemaPlus::Indexes
75
67
  ```
76
68
 
77
69
  The details of ActiveRecord exentions and Middleware modules are described below.
@@ -3,13 +3,14 @@ module SchemaMonkey
3
3
  module ConnectionAdapters
4
4
  module AbstractAdapter
5
5
  def initialize(*args)
6
- super
7
6
  dbm = case adapter_name
8
7
  when /^MySQL/i then :Mysql
9
8
  when 'PostgreSQL', 'PostGIS' then :PostgreSQL
10
9
  when 'SQLite' then :SQLite3
11
10
  end
12
11
  SchemaMonkey.insert(dbm: dbm)
12
+
13
+ super
13
14
  end
14
15
  end
15
16
  end
@@ -22,6 +22,7 @@ module SchemaMonkey
22
22
  end
23
23
 
24
24
  def insert(dbm: nil)
25
+ insert if dbm and not @inserted # first do all non-dbm-specific insertions
25
26
  clients.each &it.insert(dbm: dbm)
26
27
  @inserted = true
27
28
  @inserted_dbm = dbm if dbm
@@ -1,3 +1,3 @@
1
1
  module SchemaMonkey
2
- VERSION = "2.0.1"
2
+ VERSION = "2.1.0"
3
3
  end
data/lib/schema_monkey.rb CHANGED
@@ -9,7 +9,6 @@ require_relative "schema_monkey/errors"
9
9
  require_relative "schema_monkey/module"
10
10
  require_relative "schema_monkey/monkey"
11
11
  require_relative "schema_monkey/stack"
12
- require_relative 'schema_monkey/rake'
13
12
 
14
13
  #
15
14
  # Middleware contents will be created dynamically
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schema_monkey
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.1.0
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-14 00:00:00.000000000 Z
11
+ date: 2015-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -175,16 +175,13 @@ files:
175
175
  - lib/schema_monkey/errors.rb
176
176
  - lib/schema_monkey/module.rb
177
177
  - lib/schema_monkey/monkey.rb
178
- - lib/schema_monkey/rake.rb
179
178
  - lib/schema_monkey/stack.rb
180
- - lib/schema_monkey/tasks/insert.rake
181
179
  - lib/schema_monkey/version.rb
182
180
  - schema_dev.yml
183
181
  - schema_monkey.gemspec
184
182
  - spec/active_record_spec.rb
185
183
  - spec/connection_spec.rb
186
184
  - spec/middleware_spec.rb
187
- - spec/rake_spec.rb
188
185
  - spec/spec_helper.rb
189
186
  homepage: https://github.com/SchemaPlus/schema_monkey
190
187
  licenses:
@@ -214,5 +211,4 @@ test_files:
214
211
  - spec/active_record_spec.rb
215
212
  - spec/connection_spec.rb
216
213
  - spec/middleware_spec.rb
217
- - spec/rake_spec.rb
218
214
  - spec/spec_helper.rb
@@ -1,12 +0,0 @@
1
- module SchemaMonkey
2
- module Rake
3
- TASKS_PATH = Pathname.new(__FILE__).dirname + "tasks"
4
-
5
- def self.insert(*task_names)
6
- ::Rake.load_rakefile TASKS_PATH + "insert.rake"
7
- task_names.each do |name|
8
- ::Rake.application.lookup(name).enhance(["schema_monkey:insert"])
9
- end
10
- end
11
- end
12
- end
@@ -1,5 +0,0 @@
1
- namespace :schema_monkey do
2
- task :insert do
3
- SchemaMonkey.insert
4
- end
5
- end
data/spec/rake_spec.rb DELETED
@@ -1,39 +0,0 @@
1
- require 'spec_helper'
2
- require 'rake'
3
-
4
- describe SchemaMonkey::Rake do
5
-
6
- context "insertion" do
7
- Given(:results) { [] }
8
-
9
- Given {
10
- allow(SchemaMonkey).to receive(:insert) { results << :schema_monkey }
11
- }
12
-
13
- Given {
14
- Rake.application = Rake::Application.new
15
- Rake::Task.define_task(:test1) { results << :test1 }
16
- Rake::Task.define_task(:test2) { results << :test2 }
17
- Rake::Task.define_task(:test3) { results << :test3 }
18
- }
19
-
20
- Given { SchemaMonkey::Rake.insert(:test1, :test2) }
21
-
22
-
23
- context "enhanced task 1" do
24
- When { Rake.application.invoke_task :test1 }
25
- Then { expect(results).to eq [:schema_monkey, :test1] }
26
- end
27
-
28
- context "enhanced task 2" do
29
- When { Rake.application.invoke_task :test2 }
30
- Then { expect(results).to eq [:schema_monkey, :test2] }
31
- end
32
-
33
- context "unenhanced task 3" do
34
- When { Rake.application.invoke_task :test3 }
35
- Then { expect(results).to eq [:test3] }
36
- end
37
- end
38
-
39
- end