looksist 0.1.6 → 0.1.7
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/.travis.yml +2 -0
- data/Rakefile +9 -1
- data/features/bucket_lookup.feature +18 -0
- data/features/env.rb +16 -0
- data/features/step_definitions/bucket_lookup_steps.rb +12 -0
- data/lib/looksist/core.rb +1 -1
- data/lib/looksist/version.rb +1 -1
- data/lib/looksist.rb +6 -0
- data/looksist.gemspec +3 -0
- metadata +50 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 05e00fd33e27ccbadbb9a2cda52ec0836c00df83
         | 
| 4 | 
            +
              data.tar.gz: 36e9090fcacd6cddbe4dfb61f1e0065bb90ddcb7
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: ffb2876b6acc1b1d140532b7448c63a2cd0f1f26993e5cefa6d64891bc9ef9a13b2ad76d1345f142a060757aa4500209aa5f7606b400ffd3b845cca0ab44cdae
         | 
| 7 | 
            +
              data.tar.gz: bdfee543c270c43b238b3c982492ba91dedf388848e116980a720e1661154665a70686074ef0498f91c103869790085975c70895d867e12e12e5b3b52ea4ee84
         | 
    
        data/.travis.yml
    CHANGED
    
    
    
        data/Rakefile
    CHANGED
    
    | @@ -1,7 +1,15 @@ | |
| 1 | 
            +
            require 'rubygems'
         | 
| 2 | 
            +
            require 'cucumber'
         | 
| 3 | 
            +
             | 
| 1 4 | 
             
            require 'bundler/gem_tasks'
         | 
| 2 5 | 
             
            require 'rspec/core/rake_task'
         | 
| 6 | 
            +
            require 'cucumber/rake/task'
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            Cucumber::Rake::Task.new(:features) do |t|
         | 
| 9 | 
            +
              t.cucumber_opts = 'features --format pretty'
         | 
| 10 | 
            +
            end
         | 
| 3 11 |  | 
| 4 12 | 
             
            RSpec::Core::RakeTask.new(:spec)
         | 
| 5 13 |  | 
| 6 | 
            -
            task :default => :spec
         | 
| 14 | 
            +
            task :default => [:spec, :features]
         | 
| 7 15 |  | 
| @@ -0,0 +1,18 @@ | |
| 1 | 
            +
            @bucket_lookup
         | 
| 2 | 
            +
            Feature: I should be able to look up all keys in a bucket by pattern so that I can power drop downs with them.
         | 
| 3 | 
            +
             | 
| 4 | 
            +
              Scenario: Lookup keys in a bucket by pattern
         | 
| 5 | 
            +
                Given I have the following keys setup in Redis
         | 
| 6 | 
            +
                  | key                | value |
         | 
| 7 | 
            +
                  | ids/1              | ID 1  |
         | 
| 8 | 
            +
                  | ids/2              | ID 2  |
         | 
| 9 | 
            +
                  | ids/3              | ID 3  |
         | 
| 10 | 
            +
                  | ids/4              | ID 4  |
         | 
| 11 | 
            +
                  | non_matching_ids/4 | ID 4  |
         | 
| 12 | 
            +
                When I ask looksist to lookup by pattern "id"
         | 
| 13 | 
            +
                Then I see the response to be the following
         | 
| 14 | 
            +
                  | key   | value |
         | 
| 15 | 
            +
                  | ids/1 | ID 1  |
         | 
| 16 | 
            +
                  | ids/2 | ID 2  |
         | 
| 17 | 
            +
                  | ids/3 | ID 3  |
         | 
| 18 | 
            +
                  | ids/4 | ID 4  |
         | 
    
        data/features/env.rb
    ADDED
    
    | @@ -0,0 +1,16 @@ | |
| 1 | 
            +
            require 'active_support/all'
         | 
| 2 | 
            +
            require 'faraday_middleware'
         | 
| 3 | 
            +
            require 'her'
         | 
| 4 | 
            +
            require 'ostruct'
         | 
| 5 | 
            +
            require 'looksist'
         | 
| 6 | 
            +
            require 'looksist/redis_service'
         | 
| 7 | 
            +
            require 'looksist/hashed'
         | 
| 8 | 
            +
            require 'looksist/safe_lru_cache'
         | 
| 9 | 
            +
            require 'pry'
         | 
| 10 | 
            +
            require 'redis'
         | 
| 11 | 
            +
            require 'hiredis'
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            Looksist.configure do |looksist|
         | 
| 14 | 
            +
              looksist.lookup_store = Redis.new(url: 'redis://localhost:6379', driver: :hiredis)
         | 
| 15 | 
            +
              looksist.driver = Looksist::Serializers::Her
         | 
| 16 | 
            +
            end
         | 
| @@ -0,0 +1,12 @@ | |
| 1 | 
            +
            Given(/^I have the following keys setup in Redis$/) do |table|
         | 
| 2 | 
            +
              Looksist.lookup_store.flushall
         | 
| 3 | 
            +
              table.hashes.each { |row| Looksist.lookup_store.set(row[:key], row[:value]) }
         | 
| 4 | 
            +
            end
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            When(/^I ask looksist to lookup by pattern "([^"]*)"$/) do |arg|
         | 
| 7 | 
            +
              @last_response = Looksist.bucket_dump "#{arg}"
         | 
| 8 | 
            +
            end
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            Then(/^I see the response to be the following$/) do |table|
         | 
| 11 | 
            +
              expect(table.hashes.each_with_object({}){|row, acc| acc[row[:key]] = row[:value]}).to eq(@last_response)
         | 
| 12 | 
            +
            end
         | 
    
        data/lib/looksist/core.rb
    CHANGED
    
    
    
        data/lib/looksist/version.rb
    CHANGED
    
    
    
        data/lib/looksist.rb
    CHANGED
    
    | @@ -24,5 +24,11 @@ module Looksist | |
| 24 24 | 
             
                    lookup.buffer_size = self.cache_buffer_size || 50000
         | 
| 25 25 | 
             
                  end
         | 
| 26 26 | 
             
                end
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                def bucket_dump(entity)
         | 
| 29 | 
            +
                  keys = Looksist.lookup_store.keys("#{entity.pluralize}*")
         | 
| 30 | 
            +
                  values = Looksist.redis_service.send("#{entity}_for", keys.collect{|i| i.split('/').last})
         | 
| 31 | 
            +
                  keys.zip(values).to_h
         | 
| 32 | 
            +
                end
         | 
| 27 33 | 
             
              end
         | 
| 28 34 | 
             
            end
         | 
    
        data/looksist.gemspec
    CHANGED
    
    | @@ -27,6 +27,9 @@ Gem::Specification.new do |spec| | |
| 27 27 | 
             
              spec.add_development_dependency 'her'
         | 
| 28 28 | 
             
              spec.add_development_dependency 'faraday'
         | 
| 29 29 | 
             
              spec.add_development_dependency 'faraday_middleware'
         | 
| 30 | 
            +
              spec.add_development_dependency 'cucumber'
         | 
| 31 | 
            +
              spec.add_development_dependency 'redis'
         | 
| 32 | 
            +
              spec.add_development_dependency 'hiredis'
         | 
| 30 33 |  | 
| 31 34 | 
             
              spec.add_runtime_dependency 'jsonpath', '~> 0.5.6'
         | 
| 32 35 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: looksist
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.7
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - RC
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2014-10- | 
| 12 | 
            +
            date: 2014-10-26 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: bundler
         | 
| @@ -137,6 +137,48 @@ dependencies: | |
| 137 137 | 
             
                - - ">="
         | 
| 138 138 | 
             
                  - !ruby/object:Gem::Version
         | 
| 139 139 | 
             
                    version: '0'
         | 
| 140 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 141 | 
            +
              name: cucumber
         | 
| 142 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 143 | 
            +
                requirements:
         | 
| 144 | 
            +
                - - ">="
         | 
| 145 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 146 | 
            +
                    version: '0'
         | 
| 147 | 
            +
              type: :development
         | 
| 148 | 
            +
              prerelease: false
         | 
| 149 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 150 | 
            +
                requirements:
         | 
| 151 | 
            +
                - - ">="
         | 
| 152 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 153 | 
            +
                    version: '0'
         | 
| 154 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 155 | 
            +
              name: redis
         | 
| 156 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 157 | 
            +
                requirements:
         | 
| 158 | 
            +
                - - ">="
         | 
| 159 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 160 | 
            +
                    version: '0'
         | 
| 161 | 
            +
              type: :development
         | 
| 162 | 
            +
              prerelease: false
         | 
| 163 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 164 | 
            +
                requirements:
         | 
| 165 | 
            +
                - - ">="
         | 
| 166 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 167 | 
            +
                    version: '0'
         | 
| 168 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 169 | 
            +
              name: hiredis
         | 
| 170 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 171 | 
            +
                requirements:
         | 
| 172 | 
            +
                - - ">="
         | 
| 173 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 174 | 
            +
                    version: '0'
         | 
| 175 | 
            +
              type: :development
         | 
| 176 | 
            +
              prerelease: false
         | 
| 177 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 178 | 
            +
                requirements:
         | 
| 179 | 
            +
                - - ">="
         | 
| 180 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 181 | 
            +
                    version: '0'
         | 
| 140 182 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 141 183 | 
             
              name: jsonpath
         | 
| 142 184 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -168,6 +210,9 @@ files: | |
| 168 210 | 
             
            - LICENSE.txt
         | 
| 169 211 | 
             
            - README.md
         | 
| 170 212 | 
             
            - Rakefile
         | 
| 213 | 
            +
            - features/bucket_lookup.feature
         | 
| 214 | 
            +
            - features/env.rb
         | 
| 215 | 
            +
            - features/step_definitions/bucket_lookup_steps.rb
         | 
| 171 216 | 
             
            - lib/looksist.rb
         | 
| 172 217 | 
             
            - lib/looksist/common.rb
         | 
| 173 218 | 
             
            - lib/looksist/core.rb
         | 
| @@ -206,6 +251,9 @@ signing_key: | |
| 206 251 | 
             
            specification_version: 4
         | 
| 207 252 | 
             
            summary: Redis backed lookup for your models
         | 
| 208 253 | 
             
            test_files:
         | 
| 254 | 
            +
            - features/bucket_lookup.feature
         | 
| 255 | 
            +
            - features/env.rb
         | 
| 256 | 
            +
            - features/step_definitions/bucket_lookup_steps.rb
         | 
| 209 257 | 
             
            - spec/looksist/hashed_spec.rb
         | 
| 210 258 | 
             
            - spec/looksist/looksist_spec.rb
         | 
| 211 259 | 
             
            - spec/looksist/redis_service_spec.rb
         |