diff options
| author | Karel Minarik | 2012-12-30 15:09:45 +0100 |
|---|---|---|
| committer | Adam Vandenberg | 2013-01-04 08:58:58 -0800 |
| commit | 743ea94ff8da07ec246705456f002294ffe5d614 (patch) | |
| tree | 69f13f09bc68ebdbebc53262d48fbb29cf601a29 /Library | |
| parent | 265a7bcf337810dee3234e47b167da0aff8af7cc (diff) | |
| download | homebrew-743ea94ff8da07ec246705456f002294ffe5d614.tar.bz2 | |
Cleanup elasticsearch
Cleanup of the Elasticsearch formula:
1/ Fixed incorrectly installed Sigar libraries on Mac OS X
Move all neccessary files to `libexec/sigar`.
2/ Removed manipulating the bin scripts, use ES_HOME variable
Instead of hardcoding paths to Homebrew locations in the `bin/elasticsearch`
and `bin/plugin` scripts, set up the ES_HOME environment variable
in the `bin/elasticsearch.in.sh` properly.
Also, simplify the Regex for replacing path to Elasticsearch classes (`--classpath`)
in the `bin/plugin` script and use the `ES_CLASSPATH` variable.
3/ Simplified elasticsearch.yml configuration
Reorganize the commands, use `sub` instead of `gsub`.
4/ Cleaned up the caveats/info section
Remove redundant information.
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Formula/elasticsearch.rb | 51 |
1 files changed, 17 insertions, 34 deletions
diff --git a/Library/Formula/elasticsearch.rb b/Library/Formula/elasticsearch.rb index e49ac57fc..580fd016f 100644 --- a/Library/Formula/elasticsearch.rb +++ b/Library/Formula/elasticsearch.rb @@ -12,64 +12,47 @@ class Elasticsearch < Formula def install # Remove Windows files rm_f Dir["bin/*.bat"] - # Move JARs from lib to libexec according to homebrew conventions + + # Move libraries to `libexec` directory libexec.install Dir['lib/*.jar'] - (libexec+'sigar').install Dir['lib/sigar/*.jar'] + (libexec/'sigar').install Dir['lib/sigar/*.{jar,dylib}'] - # Install everything directly into folder + # Install everything else into package directory prefix.install Dir['*'] # Set up ElasticSearch for local development: inreplace "#{prefix}/config/elasticsearch.yml" do |s| - # 1. Give the cluster a unique name s.gsub! /#\s*cluster\.name\: elasticsearch/, "cluster.name: #{cluster_name}" # 2. Configure paths - s.gsub! /#\s*path\.data\: [^\n]+/, "path.data: #{var}/elasticsearch/" - s.gsub! /#\s*path\.logs\: [^\n]+/, "path.logs: #{var}/log/elasticsearch/" + s.sub! "# path.data: /path/to/data", "path.data: #{var}/elasticsearch/" + s.sub! "# path.logs: /path/to/logs", "path.logs: #{var}/log/elasticsearch/" + s.sub! "# path.plugins: /path/to/plugins", "path.plugins: #{var}/lib/elasticsearch/plugins" # 3. Bind to loopback IP for laptops roaming different networks s.gsub! /#\s*network\.host\: [^\n]+/, "network.host: 127.0.0.1" - - # 4. Persist plugins on upgrade - s.gsub! "# path.plugins: /path/to/plugins", "path.plugins: #{var}/lib/elasticsearch/plugins" - end inreplace "#{bin}/elasticsearch.in.sh" do |s| - # Replace CLASSPATH paths to use libexec instead of lib + # Configure ES_HOME + s.sub! /#\!\/bin\/sh\n/, "#!/bin/sh\n\nES_HOME=#{prefix}" + # Configure ES_CLASSPATH paths to use libexec instead of lib s.gsub! /ES_HOME\/lib\//, "ES_HOME/libexec/" end - inreplace "#{bin}/elasticsearch" do |s| - # Set ES_HOME to prefix value - s.gsub! /^ES_HOME=.*$/, "ES_HOME=#{prefix}" - end - inreplace "#{bin}/plugin" do |s| - # Set ES_HOME to prefix value - s.gsub! /^ES_HOME=.*$/, "ES_HOME=#{prefix}" - # Replace CLASSPATH paths to use libexec instead of lib - s.gsub! /-cp \".*\"/, '-cp "$ES_HOME/libexec/*"' + # Add the proper ES_CLASSPATH configuration + s.sub! /SCRIPT="\$0"/, %Q|SCRIPT="$0"\nES_CLASSPATH=#{prefix}/libexec| + # Replace paths to use libexec instead of lib + s.gsub! /\$ES_HOME\/lib\//, "$ES_CLASSPATH/" end end def caveats; <<-EOS.undent - If upgrading from 0.18 ElasticSearch requires flushing before shutting - down the cluster with no indexing operations happening after flush: - curl host:9200/_flush - - See the 'elasticsearch.yml' file for configuration options. - - You'll find the ElasticSearch log here: - open #{var}/log/elasticsearch/#{cluster_name}.log - - The folder with cluster data is here: - open #{var}/elasticsearch/#{cluster_name}/ - - You should see ElasticSearch running: - open http://localhost:9200/ + Data: #{var}/elasticsearch/#{cluster_name}/ + Logs: #{var}/log/elasticsearch/#{cluster_name}.log + Plugins: #{var}/lib/elasticsearch/plugins/ EOS end |
