Coder Social home page Coder Social logo

soulheart's Introduction

Soulheart Soulheart Build Status Code Climate Test Coverage

Soulheart is a ready-to-use remote data source for autocomplete. The goal is to provide a solid, flexible tool that's downright easy to set up and use.

Features

  • Pagination
    For infinite scrolling of results - wow!
  • Categories
    Match results for specified categories, or not. Your choice
  • Prioritization
    Return results sorted by priority (not just alphabetically)
  • Arbitrary return objects
    Get whatever you want back. IDs, URLs, image links, HTML, 💥
  • Loads data
    Accepts local or remote data - e.g. you can use a gist
  • Runs Standalone or inside a rails app

Autocomplete in action

Getting started

See the Soulheart intro page for a step-by-step explanation of setting up a select box that uses Soulheart as a remote data source.

Deployment

With Heroku Deploy

You can instantly deploy Soulheart to Heroku for free! This requires a verified Heroku account—you will have to add a payment method to Heroku but you won't be charged.

To update your Heroku deploy of Soulheart, use the Heroku CLI and redeploy the app:

heroku deploy -a NAME_OF_YOUR_APP_ON_HEROKU

In a Rails app

Soulheart is a gem. It uses hiredis on Ruby MRI. Add these lines to your gemfile:

gem 'soulheart'
gem 'hiredis', '~> 0.6.0' # Skip using JRuby
gem 'redis', '>= 3.2.0', require: ['redis', 'redis/connection/hiredis'] # Skip if using JRuby

And add this in your routes.rb:

require 'soulheart/server'

Rails.application.routes.draw do
  # .... your application routes

  mount Soulheart::Server => '/soulhearts'
end

You can then access the server when your rails app is running. You can run the Soulheart commands from that directory.

Hote: On Heroku Soulheart uses rackup to start the server. Because of this, there's a config.ru, a Gemfile.lock and a app.json—to make it (and any forks of it) directly deployable. These files aren't in the Gem.

Setting redis url

You can also set the redis url.

# config/initializers/soulheart.rb

Soulheart.redis = 'redis://127.0.0.1:6379/0'
# or you can asign an existing instance of Redis, Redis::Namespace, etc.
# Soulheart.redis = $redis

Testing

Tested with rspec. Check out test information at Code Climate.

You can run bundle exec guard to watch for changes and rerun the tests when files are saved.

Requirements

Soulheart is a Redis backed Sinatra server. It's tested with the latest MRI (2.2, 2.1, 2.0) and JRuby versions (1.7). Other versions/VMs are untested but might work fine.

It requires Redis >= 3.0

Additional info

This initially started as a fork of Soulmate to support the features listed, provide demos and make it instantly deployable to Heroku.

It's MIT licensed.

soulheart's People

Contributors

erwaller avatar hungyuhei avatar jgadbois avatar josegonzalez avatar rexlane avatar rixth avatar sethherr avatar theghostwhoforks avatar willcosgrove avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.