storey 0.3.6 → 0.4.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.
- data/README.md +8 -0
- data/lib/storey/version.rb +1 -1
- data/lib/storey.rb +9 -1
- data/spec/storey/default_schema.rb +19 -0
- data/spec/storey/default_search_path_spec.rb +7 -0
- metadata +5 -3
    
        data/README.md
    CHANGED
    
    | @@ -35,6 +35,14 @@ Usage: | |
| 35 35 | 
             
                Storey.schemas
         | 
| 36 36 | 
             
                Storey.schemas(:exclude_public => true)
         | 
| 37 37 |  | 
| 38 | 
            +
            ## default_schema?
         | 
| 39 | 
            +
             | 
| 40 | 
            +
            Returns true if the current schema is the default schema. Returns false otherwise. Useful for running migrations only for the public schema.
         | 
| 41 | 
            +
             | 
| 42 | 
            +
            Usage:
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                Storey.default_schema?
         | 
| 45 | 
            +
             | 
| 38 46 | 
             
            ## create
         | 
| 39 47 |  | 
| 40 48 | 
             
            Accepts:
         | 
    
        data/lib/storey/version.rb
    CHANGED
    
    
    
        data/lib/storey.rb
    CHANGED
    
    | @@ -26,7 +26,15 @@ module Storey | |
| 26 26 | 
             
              end
         | 
| 27 27 |  | 
| 28 28 | 
             
              def default_search_path
         | 
| 29 | 
            -
                 | 
| 29 | 
            +
                default_search_paths = @@default_search_path.split(',')
         | 
| 30 | 
            +
                paths = default_search_paths + self.persistent_schemas
         | 
| 31 | 
            +
                paths.uniq!
         | 
| 32 | 
            +
                paths.compact!
         | 
| 33 | 
            +
                paths.join(',')
         | 
| 34 | 
            +
              end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
              def default_schema?
         | 
| 37 | 
            +
                self.schema == self.default_search_path
         | 
| 30 38 | 
             
              end
         | 
| 31 39 |  | 
| 32 40 | 
             
              def excluded_models=(array)
         | 
| @@ -0,0 +1,19 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe Storey, '#default_schema?' do
         | 
| 4 | 
            +
              context 'when not in the default schema' do
         | 
| 5 | 
            +
                it 'should return false' do
         | 
| 6 | 
            +
                  Storey.create 'hah' do
         | 
| 7 | 
            +
                    Storey.default_schema?.should be_false
         | 
| 8 | 
            +
                  end
         | 
| 9 | 
            +
                end
         | 
| 10 | 
            +
              end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              context 'when in the default schema' do
         | 
| 13 | 
            +
                it 'should return true' do
         | 
| 14 | 
            +
                  Storey.switch do
         | 
| 15 | 
            +
                    Storey.default_schema?.should be_true
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
            end
         | 
| @@ -7,4 +7,11 @@ describe 'Storey', '#default_search_path' do | |
| 7 7 | 
             
                Storey.default_search_path.should == '"$user",public,hello,there'
         | 
| 8 8 | 
             
              end
         | 
| 9 9 |  | 
| 10 | 
            +
              context 'when the persistent schemas includes `public`' do
         | 
| 11 | 
            +
                it 'should only have one instance of public' do
         | 
| 12 | 
            +
                  Storey.persistent_schemas = %w(public hello)
         | 
| 13 | 
            +
                  Storey.default_search_path.should == '"$user",public,hello'
         | 
| 14 | 
            +
                end
         | 
| 15 | 
            +
              end
         | 
| 16 | 
            +
             | 
| 10 17 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: storey
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.4.0
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -161,6 +161,7 @@ files: | |
| 161 161 | 
             
            - spec/storey/configuration_spec.rb
         | 
| 162 162 | 
             
            - spec/storey/create_plain_schema_spec.rb
         | 
| 163 163 | 
             
            - spec/storey/create_spec.rb
         | 
| 164 | 
            +
            - spec/storey/default_schema.rb
         | 
| 164 165 | 
             
            - spec/storey/default_search_path_spec.rb
         | 
| 165 166 | 
             
            - spec/storey/drop_spec.rb
         | 
| 166 167 | 
             
            - spec/storey/dumper_spec.rb
         | 
| @@ -192,7 +193,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 192 193 | 
             
                  version: '0'
         | 
| 193 194 | 
             
                  segments:
         | 
| 194 195 | 
             
                  - 0
         | 
| 195 | 
            -
                  hash: - | 
| 196 | 
            +
                  hash: -2618005081690436209
         | 
| 196 197 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 197 198 | 
             
              none: false
         | 
| 198 199 | 
             
              requirements:
         | 
| @@ -201,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 201 202 | 
             
                  version: '0'
         | 
| 202 203 | 
             
                  segments:
         | 
| 203 204 | 
             
                  - 0
         | 
| 204 | 
            -
                  hash: - | 
| 205 | 
            +
                  hash: -2618005081690436209
         | 
| 205 206 | 
             
            requirements: []
         | 
| 206 207 | 
             
            rubyforge_project: storey
         | 
| 207 208 | 
             
            rubygems_version: 1.8.24
         | 
| @@ -254,6 +255,7 @@ test_files: | |
| 254 255 | 
             
            - spec/storey/configuration_spec.rb
         | 
| 255 256 | 
             
            - spec/storey/create_plain_schema_spec.rb
         | 
| 256 257 | 
             
            - spec/storey/create_spec.rb
         | 
| 258 | 
            +
            - spec/storey/default_schema.rb
         | 
| 257 259 | 
             
            - spec/storey/default_search_path_spec.rb
         | 
| 258 260 | 
             
            - spec/storey/drop_spec.rb
         | 
| 259 261 | 
             
            - spec/storey/dumper_spec.rb
         |