dm-adapter-simpledb 1.4.0 → 1.5.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/Rakefile
    CHANGED
    
    | @@ -80,7 +80,7 @@ END | |
| 80 80 | 
             
                gem.add_dependency('dm-migrations',         '~> 0.10.0')
         | 
| 81 81 | 
             
                gem.add_dependency('dm-types',              '~> 0.10.0')
         | 
| 82 82 | 
             
                gem.add_dependency('uuidtools',             '~> 2.0')
         | 
| 83 | 
            -
                gem.add_dependency('sdbtools',              '~> 0. | 
| 83 | 
            +
                gem.add_dependency('sdbtools',              '~> 0.5')
         | 
| 84 84 | 
             
              end
         | 
| 85 85 | 
             
              Jeweler::GemcutterTasks.new
         | 
| 86 86 | 
             
            rescue LoadError
         | 
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            1. | 
| 1 | 
            +
            1.5.0
         | 
| @@ -33,9 +33,12 @@ module DataMapper | |
| 33 33 | 
             
                    # here is chosen on the basis of it being unlikely to match any strings
         | 
| 34 34 | 
             
                    # found in real-world records, as well as being eye-catching in case any
         | 
| 35 35 | 
             
                    # nils DO manage to sneak in. It would be preferable if we could disable
         | 
| 36 | 
            -
                    #  | 
| 36 | 
            +
                    # AWS's nil-token replacement altogether, but that does not appear
         | 
| 37 37 | 
             
                    # to be an option.
         | 
| 38 38 | 
             
                    @sdb_options[:nil_representation] = "<[<[<NIL>]>]>"
         | 
| 39 | 
            +
                    @sdb_options[:connection_mode] = options.fetch(:connection_mode) {
         | 
| 40 | 
            +
                      :per_thread
         | 
| 41 | 
            +
                    }
         | 
| 39 42 | 
             
                    @null_mode   = options.fetch(:null) { false }
         | 
| 40 43 | 
             
                    @batch_limit = options.fetch(:batch_limit) {
         | 
| 41 44 | 
             
                      SDBTools::Selection::DEFAULT_RESULT_LIMIT
         | 
| @@ -163,6 +166,10 @@ module DataMapper | |
| 163 166 | 
             
                    database.domains
         | 
| 164 167 | 
             
                  end
         | 
| 165 168 |  | 
| 169 | 
            +
                  def sdb_interface
         | 
| 170 | 
            +
                    database.sdb
         | 
| 171 | 
            +
                  end
         | 
| 172 | 
            +
             | 
| 166 173 | 
             
                private
         | 
| 167 174 | 
             
                  def domain
         | 
| 168 175 | 
             
                    @domain ||= database.domain(@sdb_options[:domain])
         | 
| @@ -194,8 +201,10 @@ module DataMapper | |
| 194 201 | 
             
                  end
         | 
| 195 202 |  | 
| 196 203 | 
             
                  def database
         | 
| 197 | 
            -
                     | 
| 198 | 
            -
                     | 
| 204 | 
            +
                    return @database if defined?(@database) && !@database.nil?
         | 
| 205 | 
            +
                    options = @sdb_options.dup
         | 
| 206 | 
            +
                    if sdb then options.merge(:sdb_interface => sdb) end
         | 
| 207 | 
            +
                    @database = SDBTools::Database.new(
         | 
| 199 208 | 
             
                      @sdb_options[:access_key], 
         | 
| 200 209 | 
             
                      @sdb_options[:secret_key],
         | 
| 201 210 | 
             
                      options)
         | 
| @@ -29,7 +29,7 @@ module DataMapper | |
| 29 29 | 
             
                    # we need to return an object which IS considered a primitive - in this
         | 
| 30 30 | 
             
                    # case a plain 'ole Ruby Object. In order to convey the actual array
         | 
| 31 31 | 
             
                    # value to the backend, we tack on a #to_ary method which returns the
         | 
| 32 | 
            -
                    # array data.  | 
| 32 | 
            +
                    # array data. Aws calls Array() on all values before writing them,
         | 
| 33 33 | 
             
                    # which in turn calls #to_ary(), and winds up with the correct data. In
         | 
| 34 34 | 
             
                    # effect we are sneaking the array data through DataMapper inside a
         | 
| 35 35 | 
             
                    # singleton method.
         | 
| @@ -4,7 +4,6 @@ $LOAD_PATH.unshift(File.join(ROOT,'lib')) | |
| 4 4 | 
             
            require 'simpledb_adapter'
         | 
| 5 5 | 
             
            require 'logger'
         | 
| 6 6 | 
             
            require 'fileutils'
         | 
| 7 | 
            -
            require 'right_aws'
         | 
| 8 7 | 
             
            require 'spec'
         | 
| 9 8 | 
             
            require 'spec/autorun'
         | 
| 10 9 |  | 
| @@ -48,11 +47,8 @@ Spec::Runner.configure do |config| | |
| 48 47 | 
             
                log.level = ::Logger::DEBUG
         | 
| 49 48 | 
             
                DataMapper.logger.level = :debug
         | 
| 50 49 |  | 
| 51 | 
            -
                $control_sdb ||= RightAws::SdbInterface.new(
         | 
| 52 | 
            -
                  access_key, secret_key, :domain => test_domain)
         | 
| 53 | 
            -
             | 
| 54 50 | 
             
                DataMapper.logger.set_log(log_file, :debug)
         | 
| 55 | 
            -
                DataMapper.setup(:default, {
         | 
| 51 | 
            +
                adapter = DataMapper.setup(:default, {
         | 
| 56 52 | 
             
                    :adapter => 'simpledb',
         | 
| 57 53 | 
             
                    :access_key => access_key,
         | 
| 58 54 | 
             
                    :secret_key => secret_key,
         | 
| @@ -60,6 +56,7 @@ Spec::Runner.configure do |config| | |
| 60 56 | 
             
                    :logger => log,
         | 
| 61 57 | 
             
                    :wait_for_consistency => :manual
         | 
| 62 58 | 
             
                  })
         | 
| 59 | 
            +
                $control_sdb = adapter.sdb_interface
         | 
| 63 60 | 
             
              end
         | 
| 64 61 |  | 
| 65 62 | 
             
              # Run before each group
         | 
| @@ -1,12 +1,12 @@ | |
| 1 1 | 
             
            require 'spec'
         | 
| 2 2 | 
             
            ROOT = File.expand_path('../..', File.dirname(__FILE__))
         | 
| 3 3 | 
             
            $LOAD_PATH.unshift(File.join(ROOT,'lib'))
         | 
| 4 | 
            -
            require ' | 
| 4 | 
            +
            require 'aws'
         | 
| 5 5 | 
             
            require 'simpledb_adapter'
         | 
| 6 6 |  | 
| 7 7 | 
             
            Spec::Runner.configure do |config|
         | 
| 8 8 | 
             
              config.before :each do
         | 
| 9 | 
            -
                @sdb = stub(" | 
| 9 | 
            +
                @sdb = stub("AWS::SdbInterface").as_null_object
         | 
| 10 10 | 
             
                @log = stub("Log").as_null_object
         | 
| 11 11 |  | 
| 12 12 | 
             
                # Using Abstract adapter as a null DB
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: dm-adapter-simpledb
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              version: 1. | 
| 4 | 
            +
              version: 1.5.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors: 
         | 
| 7 7 | 
             
            - Jeremy Boles
         | 
| @@ -13,7 +13,7 @@ autorequire: | |
| 13 13 | 
             
            bindir: bin
         | 
| 14 14 | 
             
            cert_chain: []
         | 
| 15 15 |  | 
| 16 | 
            -
            date: 2010-01- | 
| 16 | 
            +
            date: 2010-01-26 00:00:00 -05:00
         | 
| 17 17 | 
             
            default_executable: 
         | 
| 18 18 | 
             
            dependencies: 
         | 
| 19 19 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| @@ -74,7 +74,7 @@ dependencies: | |
| 74 74 | 
             
                requirements: 
         | 
| 75 75 | 
             
                - - ~>
         | 
| 76 76 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 77 | 
            -
                    version: "0. | 
| 77 | 
            +
                    version: "0.5"
         | 
| 78 78 | 
             
                version: 
         | 
| 79 79 | 
             
            description: |
         | 
| 80 80 | 
             
              A DataMapper adapter for Amazon's SimpleDB service. 
         |