aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Formula/elasticsearch.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/Library/Formula/elasticsearch.rb b/Library/Formula/elasticsearch.rb
index 580fd016f..625ca0ff0 100644
--- a/Library/Formula/elasticsearch.rb
+++ b/Library/Formula/elasticsearch.rb
@@ -4,12 +4,22 @@ class Elasticsearch < Formula
homepage 'http://www.elasticsearch.org'
url 'http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.2.tar.gz'
sha1 '9bedb3638e4fc5a53e264aab3c5ff1a345f22bab'
+ head 'https://github.com/elasticsearch/elasticsearch.git'
+
+ depends_on 'maven' if build.head?
def cluster_name
"elasticsearch_#{ENV['USER']}"
end
def install
+ if build.head?
+ # Build the package from source
+ system "mvn clean package -DskipTests"
+ # Extract the package to the current directory
+ system "tar --strip 1 -xzf target/releases/elasticsearch-*.tar.gz"
+ end
+
# Remove Windows files
rm_f Dir["bin/*.bat"]
@@ -20,6 +30,14 @@ class Elasticsearch < Formula
# Install everything else into package directory
prefix.install Dir['*']
+ # Remove unnecessary files
+ rm_f Dir["#{prefix}/lib/sigar/*"]
+ if build.head?
+ rm_rf "#{prefix}/pom.xml"
+ rm_rf "#{prefix}/src/"
+ rm_rf "#{prefix}/target/"
+ end
+
# Set up ElasticSearch for local development:
inreplace "#{prefix}/config/elasticsearch.yml" do |s|
# 1. Give the cluster a unique name