schema_monkey 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/README.md +8 -16
 - data/lib/schema_monkey/active_record.rb +2 -1
 - data/lib/schema_monkey/monkey.rb +1 -0
 - data/lib/schema_monkey/version.rb +1 -1
 - data/lib/schema_monkey.rb +0 -1
 - metadata +2 -6
 - data/lib/schema_monkey/rake.rb +0 -12
 - data/lib/schema_monkey/tasks/insert.rake +0 -5
 - data/spec/rake_spec.rb +0 -39
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 2cd38c5890ddc04325c12c6e231bda0d1622ba4e
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: dea34315b4b49a545dd43c440f6ffdec23a571c1
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 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 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
      
 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 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
      
 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  
     | 
| 
      
 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
         
     | 
    
        data/lib/schema_monkey/monkey.rb
    CHANGED
    
    
    
        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 
     | 
| 
      
 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- 
     | 
| 
      
 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
         
     | 
    
        data/lib/schema_monkey/rake.rb
    DELETED
    
    | 
         @@ -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
         
     | 
    
        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
         
     |