Avoid using Pathname to compute relative paths and instead rely on a fully expanded path
This will allow this code to work whether it's executing in a jar context or a .rb file on the filesystem
This commit is contained in:
parent
a56c54ef6b
commit
e62fe44a25
|
@ -1,7 +1,6 @@
|
||||||
require 'java'
|
require 'java'
|
||||||
require 'red_storm/configurator'
|
require 'red_storm/configurator'
|
||||||
require 'red_storm/environment'
|
require 'red_storm/environment'
|
||||||
require 'pathname'
|
|
||||||
|
|
||||||
java_import 'backtype.storm.tuple.Fields'
|
java_import 'backtype.storm.tuple.Fields'
|
||||||
java_import 'backtype.storm.tuple.Values'
|
java_import 'backtype.storm.tuple.Values'
|
||||||
|
@ -140,7 +139,7 @@ module RedStorm
|
||||||
# below non-dry see Spout class
|
# below non-dry see Spout class
|
||||||
def self.inherited(subclass)
|
def self.inherited(subclass)
|
||||||
path = (caller.first.to_s =~ /^(.+):\d+.*$/) ? $1 : raise(BoltError, "unable to extract base topology class path from #{caller.first.inspect}")
|
path = (caller.first.to_s =~ /^(.+):\d+.*$/) ? $1 : raise(BoltError, "unable to extract base topology class path from #{caller.first.inspect}")
|
||||||
subclass.base_class_path = Pathname.new(path).relative_path_from(Pathname.new(RedStorm::BASE_PATH)).to_s
|
subclass.base_class_path = File.expand_path(path)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.base_class_path=(path)
|
def self.base_class_path=(path)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
require 'java'
|
require 'java'
|
||||||
require 'red_storm/configurator'
|
require 'red_storm/configurator'
|
||||||
require 'red_storm/environment'
|
require 'red_storm/environment'
|
||||||
require 'pathname'
|
|
||||||
|
|
||||||
module RedStorm
|
module RedStorm
|
||||||
module DSL
|
module DSL
|
||||||
|
@ -177,7 +176,7 @@ module RedStorm
|
||||||
# below non-dry see Bolt class
|
# below non-dry see Bolt class
|
||||||
def self.inherited(subclass)
|
def self.inherited(subclass)
|
||||||
path = (caller.first.to_s =~ /^(.+):\d+.*$/) ? $1 : raise(SpoutError, "unable to extract base topology class path from #{caller.first.inspect}")
|
path = (caller.first.to_s =~ /^(.+):\d+.*$/) ? $1 : raise(SpoutError, "unable to extract base topology class path from #{caller.first.inspect}")
|
||||||
subclass.base_class_path = Pathname.new(path).relative_path_from(Pathname.new(RedStorm::BASE_PATH)).to_s
|
subclass.base_class_path = File.expand_path(path)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.base_class_path=(path)
|
def self.base_class_path=(path)
|
||||||
|
|
Loading…
Reference in New Issue