support bundler for gems in topology
This commit is contained in:
parent
01976ea771
commit
288f23a900
|
@ -1,10 +1,12 @@
|
|||
require 'rubygems'
|
||||
require 'rubygems' # needed for remote cluster exec where TopolyLauncher require rubygems is not called
|
||||
require 'red_storm'
|
||||
require 'bundler/setup'
|
||||
|
||||
require 'redis'
|
||||
require 'thread'
|
||||
require 'red_storm'
|
||||
|
||||
require 'examples/simple/word_count_bolt'
|
||||
|
||||
|
||||
module RedStorm
|
||||
module Examples
|
||||
|
||||
|
|
|
@ -1,5 +1,21 @@
|
|||
|
||||
module RedStorm
|
||||
REDSTORM_HOME = File.expand_path(File.dirname(__FILE__) + '/..') unless defined?(REDSTORM_HOME)
|
||||
LAUNCH_PATH = File.expand_path(File.dirname(__FILE__))
|
||||
JAR_CONTEXT = !!(LAUNCH_PATH =~ /\.jar!$/)
|
||||
|
||||
if JAR_CONTEXT
|
||||
REDSTORM_HOME = LAUNCH_PATH
|
||||
TARGET_PATH = LAUNCH_PATH
|
||||
BUNDLE_GEMFILE = "#{TARGET_PATH}/Gemfile"
|
||||
BUNDLE_PATH = "#{TARGET_PATH}/bundler/#{Gem.ruby_engine}/#{Gem::ConfigMap[:ruby_version]}/"
|
||||
GEM_PATH = "#{TARGET_PATH}/gems/"
|
||||
else
|
||||
REDSTORM_HOME = File.expand_path(LAUNCH_PATH + '/..')
|
||||
TARGET_PATH = Dir.pwd
|
||||
BUNDLE_GEMFILE = "#{TARGET_PATH}/Gemfile"
|
||||
BUNDLE_PATH = "#{TARGET_PATH}/target/gems/bundler/#{Gem.ruby_engine}/#{Gem::ConfigMap[:ruby_version]}/"
|
||||
GEM_PATH = "#{TARGET_PATH}/target/gems/gems"
|
||||
end
|
||||
end
|
||||
|
||||
require 'red_storm/version'
|
||||
|
@ -8,3 +24,18 @@ require 'red_storm/application'
|
|||
require 'red_storm/simple_bolt'
|
||||
require 'red_storm/simple_spout'
|
||||
require 'red_storm/simple_topology'
|
||||
|
||||
ENV['BUNDLE_GEMFILE'] = RedStorm::BUNDLE_GEMFILE
|
||||
ENV['BUNDLE_PATH'] = RedStorm::BUNDLE_PATH
|
||||
ENV["GEM_PATH"] = RedStorm::GEM_PATH
|
||||
ENV['BUNDLE_DISABLE_SHARED_GEMS'] = "1"
|
||||
|
||||
# puts("************************ PWD=#{Dir.pwd}")
|
||||
# puts("************************ RedStorm::JAR_CONTEXT=#{RedStorm::JAR_CONTEXT}")
|
||||
# puts("************************ RedStorm::LAUNCH_PATH=#{RedStorm::LAUNCH_PATH}")
|
||||
# puts("************************ RedStorm::REDSTORM_HOME=#{RedStorm::REDSTORM_HOME}")
|
||||
# puts("************************ RedStorm::TARGET_PATH=#{RedStorm::TARGET_PATH}")
|
||||
# puts("************************ RedStorm::GEM_PATH=#{RedStorm::GEM_PATH}")
|
||||
# puts("************************ ENV['BUNDLE_GEMFILE']=#{ENV['BUNDLE_GEMFILE']}")
|
||||
# puts("************************ ENV['BUNDLE_PATH']=#{ENV['BUNDLE_PATH']}")
|
||||
# puts("************************ ENV['GEM_PATH']=#{ENV['GEM_PATH']}")
|
||||
|
|
|
@ -10,6 +10,8 @@ java_import 'backtype.storm.tuple.Values'
|
|||
java_import 'java.util.Map'
|
||||
java_import 'org.apache.log4j.Logger'
|
||||
|
||||
java_import 'org.apache.log4j.Logger'
|
||||
|
||||
java_package 'redstorm.proxy'
|
||||
|
||||
# the Bolt class is a proxy to the real bolt to avoid having to deal with all the
|
||||
|
|
|
@ -10,6 +10,8 @@ java_import 'backtype.storm.tuple.Values'
|
|||
java_import 'java.util.Map'
|
||||
java_import 'org.apache.log4j.Logger'
|
||||
|
||||
java_import 'org.apache.log4j.Logger'
|
||||
|
||||
java_package 'redstorm.proxy'
|
||||
|
||||
# the Spout class is a proxy to the real spout to avoid having to deal with all the
|
||||
|
|
|
@ -80,6 +80,11 @@ module RedStorm
|
|||
end
|
||||
end
|
||||
|
||||
def self.log
|
||||
@log ||= Logger.getLogger(self.name)
|
||||
end
|
||||
|
||||
|
||||
def self.spout(spout_class, options = {})
|
||||
spout_options = {:id => self.underscore(spout_class), :parallelism => DEFAULT_SPOUT_PARALLELISM}.merge(options)
|
||||
spout = SpoutDefinition.new(spout_class, spout_options[:id], spout_options[:parallelism])
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
module RedStorm
|
||||
VERSION = '0.4.0'
|
||||
VERSION = '0.4.1'
|
||||
end
|
|
@ -46,6 +46,8 @@ task :setup do
|
|||
ant.mkdir :dir => TARGET_CLASSES_DIR
|
||||
ant.mkdir :dir => TARGET_SRC_DIR
|
||||
ant.mkdir :dir => TARGET_GEMS_DIR
|
||||
ant.mkdir :dir => "#{TARGET_GEMS_DIR}/gems"
|
||||
ant.mkdir :dir => "#{TARGET_GEMS_DIR}/bundler"
|
||||
ant.path :id => 'classpath' do
|
||||
fileset :dir => TARGET_DEPENDENCY_DIR
|
||||
fileset :dir => TARGET_CLASSES_DIR
|
||||
|
@ -68,6 +70,10 @@ task :devjar => [:unpack, :clean_jar] do
|
|||
fileset :dir => RedStorm::REDSTORM_HOME do
|
||||
include :name => "examples/**/*"
|
||||
end
|
||||
fileset :dir => RedStorm::REDSTORM_HOME do
|
||||
include :name => "Gemfile"
|
||||
include :name => "Gemfile.lock"
|
||||
end
|
||||
fileset :dir => JRUBY_SRC_DIR do
|
||||
exclude :name => "tasks/**"
|
||||
end
|
||||
|
@ -83,6 +89,10 @@ task :jar, [:dir] => [:unpack, :clean_jar] do |t, args|
|
|||
fileset :dir => TARGET_CLASSES_DIR
|
||||
fileset :dir => TARGET_DEPENDENCY_UNPACKED_DIR
|
||||
fileset :dir => TARGET_GEMS_DIR
|
||||
fileset :dir => CWD do
|
||||
include :name => "Gemfile"
|
||||
include :name => "Gemfile.lock"
|
||||
end
|
||||
fileset :dir => JRUBY_SRC_DIR do
|
||||
exclude :name => "tasks/**"
|
||||
end
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -5,7 +5,7 @@
|
|||
<groupId>redstorm</groupId>
|
||||
<artifactId>redstorm</artifactId>
|
||||
<version>0.4.0</version>
|
||||
<name>RedStorm JRuby on Storm</name>
|
||||
<name>RedStorm</name>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
|
|
@ -22,7 +22,7 @@ Gem::Specification.new do |s|
|
|||
|
||||
s.add_development_dependency "rubyforge"
|
||||
|
||||
s.add_runtime_dependency "rake", ["~> 0.9.2"]
|
||||
s.add_runtime_dependency "rake", ["~> 0.9.2.2"]
|
||||
s.add_runtime_dependency "ruby-maven", ["~> 3.0.3.0.28.5"]
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue