soulheart 0.0.8 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fca63751060b314d95ce3574b90e80b65ae5f517
4
- data.tar.gz: ac427fb1200ece18b30bdcf3903d9e12ba1fb3ce
3
+ metadata.gz: b7614d5a25688e37c96f1934f0e431048603771d
4
+ data.tar.gz: 7bede6c0cd14ddb287636f8194d641eb1842625c
5
5
  SHA512:
6
- metadata.gz: c3f4307acaf580c609e3eec7450a440c75e10fbe0df2a9104d68fcfdb0f3e888ed5675352d286e6540f1ec7906b623dd36485f187404a0d4990058df09ee3d3e
7
- data.tar.gz: d7d4a2948a9a87782bf3703ffe41de388a3f0fe160d27c179bbfd027a5120148550da4e5ba52b9bc7050f2ad42897a5645f95070e4ffb52cfc6eb39411f56956
6
+ metadata.gz: 6380d4fa61e9101397e254afc09b4fe8b765f396728f2b68ad358224bf6ac09f36dad401c0079cf0dc7b28bccd22b4ab0a1c2fa9bc0e7f7868aa47a7d16714eb
7
+ data.tar.gz: 5c1700b08f56ef30e12fdef6520f1d5b89641b2e6480a2489edb75ba67b8b6e786b15f9ff20f2a63dccca12766db6981253ecc15ba0854fed6f7ea5e5cb13da9
data/README.md CHANGED
@@ -1,34 +1,71 @@
1
1
  # <img src="https://raw.githubusercontent.com/sethherr/soulheart/master/logo.png" alt="Soulheart" width="200"> Soulheart [![Build Status](https://travis-ci.org/sethherr/soulheart.svg)](https://travis-ci.org/sethherr/soulheart) [![Code Climate](https://codeclimate.com/github/sethherr/soulheart/badges/gpa.svg)](https://codeclimate.com/github/sethherr/soulheart) [![Test Coverage](https://codeclimate.com/github/sethherr/soulheart/badges/coverage.svg)](https://codeclimate.com/github/sethherr/soulheart/coverage)
2
2
 
3
- To get started, check out examples and documentation at [sethherr.github.io/soulheart/](https://sethherr.github.io/soulheart/).
3
+ Soulheart is a ready-to-use remote data source for autocomplete. The goal is to provide a solid, flexible tool that's downright simple to set up.
4
4
 
5
- **Soulheart is a ready-to-use remote data source for autocomplete**. It supports:
5
+ - [Demos](https://sethherr.github.io/soulheart/)
6
+ - [Usage documentation](https://sethherr.github.io/soulheart/commands/)
7
+ - [Example data sources](https://github.com/sethherr/soulheart/tree/master/example_data_sources)
8
+ - [Getting started](#getting-started)
9
+ - [Deployment](#deployment)
10
+ - [Testing](#testing)
6
11
 
7
- - pagination
8
- - categories
9
- - sorting by priority (not just alphabetically)
10
- - arbitrary return values/objects
11
- - loading data via gists (or any url)
12
- - mounting standalone or inside of a rails app
13
12
 
14
- ... and is [instantly deployable to heroku](https://heroku.com/deploy) (for free).
13
+ ## Features
15
14
 
15
+ - **Pagination**
16
+ <br>For infinite scrolling of results - wow!
17
+ - **Categories**
18
+ <br>Match results for specified categories, or not - your choice.
19
+ - **Prioritization**
20
+ <br>Return results sorted by priority (not just alphabetically).
21
+ - **Arbitrary return objects**
22
+ <br>Get whatever you want back. IDs, URLs, image links, even pre-formatted HTML :boom:
23
+ - **Load remote data**
24
+ <br>Makes loading data via gists (or any url) possible.
25
+ - **Runs Standalone or inside a rails app**
16
26
 
17
- This project is in Beta. It's probably appropriate to use in production... but maybe wait? There are a few more changes coming, and some documentation improvements to be made.
27
+ ## Getting started
18
28
 
19
- =======
29
+ See the [Soulheart demos page](https://sethherr.github.io/soulheart/) for a step-by-step explanation of creating an instance and setting up a select box that uses it as a remote data source.
20
30
 
21
- I'm testing with: `ruby 2.1` and `redis 3.0`.
22
31
 
23
- Run `bundle exec guard` to run the specs when they change as you work.
32
+ ## Deployment
24
33
 
25
- This repo includes a `config.ru` and a `Gemfile.lock` so it and any forks of it can be deployed to Heroku. They shouldn't be in the Gem. if you build it separately.
34
+ #### With Heroku [![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy)
26
35
 
27
- ======
36
+ You can instantly deploy Soulheart to Heroku for free - just click the button - which deploys this repository using `rackup` to start the server. Because of this, there's a `config.ru` and a `Gemfile.lock`&mdash;to make it (and any forks) runnable on Heroku. These files aren't in the Gem.
28
37
 
29
- [There is issue for improving documentation](../../issues/1) because the documentation needs to be improved. Also, for serious, check out [sethherr.github.io/soulheart/](https://sethherr.github.io/soulheart/).
38
+ To update your Heroku deploy of Soulheart, use the [Heroku CLI](https://devcenter.heroku.com/articles/heroku-command) and redeploy the app:
39
+
40
+ heroku deploy -a NAME_OF_YOUR_APP_ON_HEROKU
41
+
30
42
 
31
- =====
43
+ #### In a Rails app
32
44
 
45
+ Soulheart is also a gem. Add it to your gemfile:
33
46
 
34
- This is a fork of [Soulmate](https://github.com/seatgeek/soulmate). It isn't backward compatible.
47
+ gem 'soulheart'
48
+
49
+ And then put this in your routes.rb -
50
+
51
+ require 'sidekiq/web'
52
+ mount Soulheart::Server => "/soulhearts"
53
+
54
+ You can then access the server when your rails app is running. You can run the [Soulheart commands](https://sethherr.github.io/soulheart/commands/) from that directory.
55
+
56
+ ## Testing
57
+
58
+ Tested with rspec, check out test information at [Code Climate](https://codeclimate.com/github/sethherr/soulheart).
59
+
60
+ Run `bundle exec guard` to watch for changes and rerun the tests when files are saved.
61
+
62
+
63
+ ## Requirements
64
+
65
+ Soulheart is a Redis backed Sinatra server. I test with the latest MRI (2.2, 2.1, 2.0) and JRuby versions (1.7). Other versions/VMs are untested but might work fine.
66
+
67
+ It requires Redis 3.0
68
+
69
+ ## Additional info
70
+
71
+ This started as a fork of [Soulmate](https://github.com/seatgeek/soulmate). It's MIT licensed.
@@ -19,12 +19,17 @@ module Soulheart
19
19
  redis
20
20
  end
21
21
 
22
+ def jruby?
23
+ RUBY_ENGINE == 'jruby'
24
+ end
25
+
22
26
  # Returns the current Redis connection. If none has been created, will
23
27
  # create a new one.
24
28
  def redis
25
29
  @redis ||= (
26
30
  url = URI(@redis_url || ENV['REDIS_URL'] || 'redis://127.0.0.1:6379/0')
27
- ::Redis.new( # driver: :hiredis,
31
+ ::Redis.new( #
32
+ driver: (jruby? ? :ruby : :hiredis),
28
33
  host: url.host,
29
34
  port: url.port,
30
35
  db: url.path[1..-1],
@@ -49,7 +49,7 @@ module Soulheart
49
49
  redis.del(results_hashes_id)
50
50
  end
51
51
 
52
- def clear(remove_results: false)
52
+ def clear(remove_results=false)
53
53
  category_combos.each {|cat| delete_data(category_id(cat)) }
54
54
  delete_categories
55
55
  delete_data
@@ -62,7 +62,7 @@ module Soulheart
62
62
  set_category_combos_array.each do |category_combo|
63
63
  items.each do |item|
64
64
  next unless category_combo.match(item['category']) || category_combo == 'all'
65
- add_item(item, category_id(category_combo), cleaned: true) # send it base
65
+ add_item(item, category_id(category_combo), true) # send it base
66
66
  end
67
67
  end
68
68
  end
@@ -75,7 +75,7 @@ module Soulheart
75
75
  .merge item
76
76
  end
77
77
 
78
- def add_item(item, category_base_id = nil, cleaned: false)
78
+ def add_item(item, category_base_id=nil, cleaned=false)
79
79
  unless cleaned
80
80
  item = clean(item)
81
81
  category_base_id ||= category_id(item['category'])
@@ -1,3 +1,3 @@
1
1
  module Soulheart
2
- VERSION = '0.0.8'
2
+ VERSION = '0.0.10'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soulheart
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Herr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-24 00:00:00.000000000 Z
11
+ date: 2015-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hiredis