Class: Rsense::Client::Daemon

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/rsense/client/daemon.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = []) ⇒ Daemon

Returns a new instance of Daemon.



15
16
17
18
19
20
21
22
23
# File 'lib/rsense/client/daemon.rb', line 15

def initialize(args=[])
  @external_args = args
  @rsense_home = rsense_home
  @rsense_lib = rsense_lib
  @rsense_bin = rsense_bin
  @argslist = build_argslist()
  @runner = Rsense::Client::Runner.new(@argslist)
  set_gem_path_env(gem_path)
end

Instance Attribute Details

#argslistObject

Returns the value of attribute argslist.



11
12
13
# File 'lib/rsense/client/daemon.rb', line 11

def argslist
  @argslist
end

#classpathObject

Returns the value of attribute classpath.



11
12
13
# File 'lib/rsense/client/daemon.rb', line 11

def classpath
  @classpath
end

#external_argsObject

Returns the value of attribute external_args.



11
12
13
# File 'lib/rsense/client/daemon.rb', line 11

def external_args
  @external_args
end

#rsense_binObject

Returns the value of attribute rsense_bin.



11
12
13
# File 'lib/rsense/client/daemon.rb', line 11

def rsense_bin
  @rsense_bin
end

#rsense_homeObject

Returns the value of attribute rsense_home.



11
12
13
# File 'lib/rsense/client/daemon.rb', line 11

def rsense_home
  @rsense_home
end

#rsense_libObject

Returns the value of attribute rsense_lib.



11
12
13
# File 'lib/rsense/client/daemon.rb', line 11

def rsense_lib
  @rsense_lib
end

#runnerObject

Returns the value of attribute runner.



11
12
13
# File 'lib/rsense/client/daemon.rb', line 11

def runner
  @runner
end

Instance Method Details

#build_argslistObject



25
26
27
# File 'lib/rsense/client/daemon.rb', line 25

def build_argslist
  java_args + jruby_args(@external_args)
end

#gem_pathObject



48
49
50
# File 'lib/rsense/client/daemon.rb', line 48

def gem_path
  Gem.path.join(File::PATH_SEPARATOR)
end

#java_argsObject



56
57
58
# File 'lib/rsense/client/daemon.rb', line 56

def java_args
  ["env", "java", "-cp", classpath, "org.jruby.Main"]
end

#jruby_args(cli_args = []) ⇒ Object



60
61
62
63
# File 'lib/rsense/client/daemon.rb', line 60

def jruby_args(cli_args=[])
  cli_args ||= [""]
  ["-I#{@rsense_lib}", @rsense_bin] + cli_args
end

#set_gem_path_env(gp) ⇒ Object



52
53
54
# File 'lib/rsense/client/daemon.rb', line 52

def set_gem_path_env(gp)
  ENV["GEM_PATH"] = gp
end