From a505e9c5c868798da42e53754a8667a3bbc39865 Mon Sep 17 00:00:00 2001 From: "R. Tyler Croy" Date: Fri, 11 Sep 2015 15:18:25 -0700 Subject: [PATCH] Rely on our file path containing stormjar.jar in order to determine if we're ina supervisor This is admittedly a bit hackish but I have yet to find any data at runtime that indicates whether we're executing inside of a local mode (non jar) or clustered mode other than this Fixes #16 --- build.gradle | 2 +- lib/red_storm/environment.rb | 16 +++++----------- lib/red_storm/topology_launcher.rb | 1 + lib/red_storm/version.rb | 2 +- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index b760600..f027113 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'java' apply plugin: 'com.github.jruby-gradle.jar' apply plugin: 'com.jfrog.bintray' -version = '0.9.1' +version = '0.9.2' group = 'com.github.jruby-gradle' description = "RedStorm integrates Ruby code via JRuby into the Storm distributed computation system" defaultTasks 'check', 'assemble' diff --git a/lib/red_storm/environment.rb b/lib/red_storm/environment.rb index 11d107f..e131211 100644 --- a/lib/red_storm/environment.rb +++ b/lib/red_storm/environment.rb @@ -5,10 +5,10 @@ module RedStorm CWD = Dir.pwd launch_path = File.expand_path(File.dirname(__FILE__)) - jar_context = !!(launch_path =~ /\.jar!\/red_storm$/) + jar_context = !!(launch_path =~ /stormjar\.jar!\/red_storm$/) if jar_context - BASE_PATH = File.expand_path(launch_path + '/..') + BASE_PATH = 'uri:classloader:/' REDSTORM_HOME = BASE_PATH GEM_PATH = "#{REDSTORM_HOME}/gems/" # Make sure that when we're loading our environment up that we properly set @@ -44,15 +44,6 @@ module RedStorm SRC_EXAMPLES = "#{REDSTORM_HOME}/examples" DST_EXAMPLES = "#{CWD}/examples" - SRC_IVY_DIR = "#{REDSTORM_HOME}/ivy" - DST_IVY_DIR = "#{CWD}/ivy" - DEFAULT_IVY_SETTINGS = "#{SRC_IVY_DIR}/settings.xml" - CUSTOM_IVY_SETTINGS = "#{DST_IVY_DIR}/settings.xml" - DEFAULT_IVY_STORM_DEPENDENCIES = "#{SRC_IVY_DIR}/storm_dependencies.xml" - CUSTOM_IVY_STORM_DEPENDENCIES = "#{DST_IVY_DIR}/storm_dependencies.xml" - DEFAULT_IVY_TOPOLOGY_DEPENDENCIES = "#{SRC_IVY_DIR}/topology_dependencies.xml" - CUSTOM_IVY_TOPOLOGY_DEPENDENCIES = "#{DST_IVY_DIR}/topology_dependencies.xml" - DEFAULT_STORM_CONF_FILE = File.expand_path("~/.storm/storm.yaml") rescue '' def current_ruby_mode @@ -72,3 +63,6 @@ module RedStorm module_function :current_ruby_mode, :jruby_mode_token, :java_runtime_version end + +# Requiring this at the tail-end to make sure whatever modifications we needed to make to our environment works properly +require 'jars/setup' diff --git a/lib/red_storm/topology_launcher.rb b/lib/red_storm/topology_launcher.rb index f0897f9..8bee212 100644 --- a/lib/red_storm/topology_launcher.rb +++ b/lib/red_storm/topology_launcher.rb @@ -54,6 +54,7 @@ class TopologyLauncher $:.unshift File.expand_path(launch_path + '/target/lib') begin + require 'jars/setup' require "#{class_path}" rescue => ex puts "Failed to load #{class_path}! (#{ex.inspect})" diff --git a/lib/red_storm/version.rb b/lib/red_storm/version.rb index 061327b..c066c38 100644 --- a/lib/red_storm/version.rb +++ b/lib/red_storm/version.rb @@ -1,3 +1,3 @@ module RedStorm - VERSION = '0.7.0.beta1' + VERSION = '0.9.2' end \ No newline at end of file