Skip to content

Commit

Permalink
Merge pull request elastic#1316 from colinsurprenant/spaceinpath
Browse files Browse the repository at this point in the history
support for spaces in dir path of logstash installation
  • Loading branch information
jordansissel committed May 5, 2014
2 parents 1a011db + 649814b commit 655b787
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 19 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ vendor/ua-parser/regexes.yaml: | vendor/ua-parser/
.PHONY: test
test: QUIET_OUTPUT=
test: | $(JRUBY) vendor-elasticsearch vendor-geoip vendor-collectd vendor-gems
$(SPEC_ENV) bin/logstash rspec $(SPEC_OPTS) --order rand --fail-fast $(TESTS)
$(SPEC_ENV) USE_JRUBY=1 bin/logstash rspec $(SPEC_OPTS) --order rand --fail-fast $(TESTS)

.PHONY: reporting-test
reporting-test: SPEC_ENV=JRUBY_OPTS=--debug COVERAGE=TRUE
Expand Down Expand Up @@ -382,4 +382,4 @@ tarball-test: #build/logstash-$(VERSION).tar.gz
$(QUIET)-rm -rf build/test-tarball/
$(QUIET)mkdir -p build/test-tarball/
tar -C build/test-tarball --strip-components 1 -xf build/logstash-$(VERSION).tar.gz
(cd build/test-tarball; bin/logstash rspec $(TESTS) --fail-fast)
(cd build/test-tarball; USE_JRUBY=1 bin/logstash rspec $(TESTS) --fail-fast)
21 changes: 14 additions & 7 deletions bin/logstash
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ LS_HEAP_SIZE="${LS_HEAP_SIZE:=500m}"

unset CDPATH
basedir=$(cd `dirname $0`/..; pwd)
. ${basedir}/bin/logstash.lib.sh
. "${basedir}/bin/logstash.lib.sh"

setup

Expand All @@ -30,13 +30,20 @@ export HOME SINCEDB_DIR
case $1 in
deps) install_deps ;;
env) env "$@" ;;
-*)
# is the first argument a flag? If so, assume 'agent'
program="$basedir/lib/logstash/runner.rb"
exec $RUBYCMD -I$RUBYLIB "$program" agent "$@"
-*)
if [ -z "$VENDORED_JRUBY" ] ; then
exec "${RUBYCMD}" "-I${RUBYLIB}" "${basedir}/lib/logstash/runner.rb" "agent" "$@"
else
exec "${JAVACMD}" $JAVA_OPTS "-jar" "$JRUBY_JAR" "-I${RUBYLIB}" "${basedir}/lib/logstash/runner.rb" "agent" "$@"
fi
;;
*)
program="$basedir/lib/logstash/runner.rb"
exec $RUBYCMD -I$RUBYLIB "$program" "$@"
if [ -z "$VENDORED_JRUBY" ] ; then
exec "${RUBYCMD}" "-I${RUBYLIB}" "${basedir}/lib/logstash/runner.rb" "$@"
else
exec "${JAVACMD}" $JAVA_OPTS "-jar" "$JRUBY_JAR" "-I${RUBYLIB}" "${basedir}/lib/logstash/runner.rb" "$@"
fi
;;
esac


30 changes: 20 additions & 10 deletions bin/logstash.lib.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
basedir=$(cd `dirname $0`/..; pwd)

setup_ruby() {
export RUBYLIB="$basedir/lib"
export RUBYLIB="${basedir}/lib"

# Verify ruby works
if ! ruby -e 'puts "HURRAY"' 2> /dev/null | grep -q "HURRAY" ; then
echo "No ruby program found. Cannot start."
exit 1
fi

# set $RUBY and $RUBYVER
eval $(ruby -rrbconfig -e 'puts "RUBYVER=#{RbConfig::CONFIG["ruby_version"]}"; puts "RUBY=#{RUBY_ENGINE}"')

RUBYCMD="ruby"
export GEM_HOME="$basedir/vendor/bundle/${RUBY}/${RUBYVER}"
VENDORED_JRUBY=

export GEM_HOME="${basedir}/vendor/bundle/${RUBY}/${RUBYVER}"
export GEM_PATH=
}

Expand Down Expand Up @@ -58,15 +63,18 @@ setup_java() {

export JAVACMD
export JAVA_OPTS
export RUBYLIB="$basedir/lib"
export GEM_HOME="$basedir/vendor/bundle/jruby/1.9"
export GEM_PATH=
}

setup_vendored_jruby() {
RUBYVER=1.9
RUBY=jruby
RUBYCMD="$JAVACMD $JAVA_OPTS -jar $basedir/vendor/jar/jruby-complete-*.jar"

JRUBY_JAR=$(ls "${basedir}"/vendor/jar/jruby-complete-*.jar)
VENDORED_JRUBY=1

export RUBYLIB="${basedir}/lib"
export GEM_HOME="${basedir}/vendor/bundle/${RUBY}/${RUBYVER}"
export GEM_PATH=
}

setup() {
Expand All @@ -80,10 +88,12 @@ setup() {

install_deps() {
if [ -f "$basedir/logstash.gemspec" ] ; then
program="$basedir/gembag.rb"
set -- "$basedir/logstash.gemspec"
exec $RUBYCMD "$basedir/gembag.rb" "$@"
if [ -z "$VENDORED_JRUBY" ] ; then
exec "${RUBYCMD}" "${basedir}/gembag.rb" "${basedir}/logstash.gemspec" "$@"
else
exec "${JAVACMD}" $JAVA_OPTS "-jar" "$JRUBY_JAR" "${basedir}/gembag.rb" "${basedir}/logstash.gemspec" "$@"
fi
else
echo "Cannot install dependencies; missing logstash.gemspec. This 'deps' command only works from a logstash git clone."
fi
}
}

0 comments on commit 655b787

Please sign in to comment.