Created
May 30, 2013 03:11
-
-
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")
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
servers: | |
- host: localhost | |
port: 9500 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb -r./config/boot.elastic |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment