Skip to content

Instantly share code, notes, and snippets.

@esmarkowski
Created May 30, 2013 03:11
Show Gist options
  • Save esmarkowski/5675516 to your computer and use it in GitHub Desktop.
Save esmarkowski/5675516 to your computer and use it in GitHub Desktop.
1. Place elastic in bin/elastic and chmod +x 2. Place boot.elastic.rb in config/boot.elastic.rb 3. Place .rubberband in config/.rubberband To run > bin/elastic @rubberband.search("body:goat")
servers:
- host: localhost
port: 9500
APP_PATH ||= File.expand_path('../..', __FILE__)
RACK_ENV ||= ENV['RACK_ENV'] || ENV["NODE_ENV"] || 'development'
# Set up gems listed in the Gemfile.
gemfile = File.expand_path('../../Gemfile', __FILE__)
begin
ENV['BUNDLE_GEMFILE'] = gemfile
require 'bundler'
Bundler.setup
Bundler.require(:default, :elastic_search)
begin
config = YAML.load_file( File.join(APP_PATH, 'config', '.rubberband' ))
rescue Errno::ENOENT => e
STDERR.puts "No yaml file found a config/.rubberband".color :red
exit!
end
connection_strings = config['servers'].collect{ |b| "#{b['host']}:#{b['port']}" }
puts "elasticsearch".color :green
puts connection_strings.join.color :white
puts "\n"
@rubberband = ElasticSearch.new(connection_strings, :transport => ElasticSearch::Transport::Thrift)
rescue Bundler::GemNotFound => e
STDERR.puts e.message
STDERR.puts "Try running `bundle install`."
exit!
end if File.exist?(gemfile)
irb -r./config/boot.elastic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment