From 456fdd510047baec4ab59eb98fab5918b4305a96 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 28 Oct 2014 07:04:53 +0530 Subject: [PATCH] jruby support. --- .travis.yml | 1 + features/support/env.rb | 4 +--- lib/looksist.rb | 2 +- lib/looksist/hashed.rb | 2 +- lib/looksist/version.rb | 2 +- looksist.gemspec | 3 --- spec/spec_helper.rb | 4 +--- 7 files changed, 6 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 04e7ca0..74856a5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: ruby rvm: - ruby-2.1.2 + - jruby-1.7.16 services: - redis-server diff --git a/features/support/env.rb b/features/support/env.rb index aea2b2b..cd80113 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -1,10 +1,8 @@ require 'active_support/all' -require 'faraday_middleware' require 'her' require 'ostruct' require 'pry' require 'redis' -require 'hiredis' require 'jsonpath' require 'simplecov' require 'coveralls' @@ -28,7 +26,7 @@ I18n.enforce_available_locales = false Looksist.configure do |looksist| - looksist.lookup_store = Redis.new(url: 'redis://localhost:6379', driver: :hiredis) + looksist.lookup_store = Redis.new(url: 'redis://localhost:6379') looksist.l2_cache = :no_cache looksist.driver = Looksist::Serializers::Her end diff --git a/lib/looksist.rb b/lib/looksist.rb index edfd47b..b09fb13 100644 --- a/lib/looksist.rb +++ b/lib/looksist.rb @@ -28,7 +28,7 @@ def configure def bucket_dump(entity) keys = Looksist.lookup_store.keys("#{entity.pluralize}*") values = Looksist.redis_service.send("#{entity}_for", keys.collect{|i| i.split('/').last}) - (keys.collect {|i| i.split('/').last}).zip(values).to_h + Hash[(keys.collect {|i| i.split('/').last}).zip(values)] end end end \ No newline at end of file diff --git a/lib/looksist/hashed.rb b/lib/looksist/hashed.rb index be3babe..6641169 100644 --- a/lib/looksist/hashed.rb +++ b/lib/looksist/hashed.rb @@ -59,7 +59,7 @@ def update_using_json_path(hash, opts) def inject_attributes_for(arry_of_hashes, opts) entity_name = __entity__(opts[:bucket_name] || opts[:using]) keys = (arry_of_hashes.collect { |i| i[opts[:using]] }).compact.uniq - values = keys.zip(Looksist.redis_service.send("#{entity_name}_for", keys)).to_h + values = Hash[keys.zip(Looksist.redis_service.send("#{entity_name}_for", keys))] arry_of_hashes.each do |elt| elt[opts[:populate]] = values[elt[opts[:using]]] end diff --git a/lib/looksist/version.rb b/lib/looksist/version.rb index 7b4dba2..3757345 100644 --- a/lib/looksist/version.rb +++ b/lib/looksist/version.rb @@ -1,3 +1,3 @@ module Lookist - VERSION = '0.2.6' + VERSION = '0.2.7' end diff --git a/looksist.gemspec b/looksist.gemspec index c101791..e80ca7b 100644 --- a/looksist.gemspec +++ b/looksist.gemspec @@ -25,11 +25,8 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'activesupport' spec.add_development_dependency 'activemodel' spec.add_development_dependency 'her' - spec.add_development_dependency 'faraday' - spec.add_development_dependency 'faraday_middleware' spec.add_development_dependency 'cucumber' spec.add_development_dependency 'redis' - spec.add_development_dependency 'hiredis' spec.add_development_dependency 'simplecov' spec.add_development_dependency 'coveralls' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 27b7d31..336c2ed 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,6 @@ require 'active_support/all' -require 'faraday_middleware' require 'her' +require 'faraday' require 'ostruct' require 'pry' require 'simplecov' @@ -32,8 +32,6 @@ def as_json(opts={}) TEST_API = Her::API.new config = Proc.new do |conn| - conn.use FaradayMiddleware::EncodeJson - conn.use Faraday::Request::UrlEncoded conn.use Her::Middleware::DefaultParseJSON conn.use Faraday::Adapter::NetHttp conn.use Faraday::Response::RaiseError