Class: TorqueBox::Server Private

Inherits:
Object
  • Object
show all
Defined in:
lib/torquebox/server.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Class Method Summary collapse

Class Method Details

.gem_versionObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



44
45
46
# File 'lib/torquebox/server.rb', line 44

def self.gem_version
  Gem::Version.new( Gem::VERSION )
end

.jboss_homeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



36
37
38
# File 'lib/torquebox/server.rb', line 36

def self.jboss_home
  File.join(torquebox_home, 'jboss') if torquebox_home
end

.jruby_homeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



40
41
42
# File 'lib/torquebox/server.rb', line 40

def self.jruby_home
  File.expand_path(java.lang.System.getProperty('jruby.home'))
end

.setup_environmentObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



48
49
50
51
52
53
54
# File 'lib/torquebox/server.rb', line 48

def self.setup_environment
  ENV['TORQUEBOX_HOME'] ||= torquebox_home
  ENV['JBOSS_HOME'] ||= "#{ENV['TORQUEBOX_HOME']}/jboss" if ENV['TORQUEBOX_HOME']
  ENV['JRUBY_HOME'] ||= jruby_home
  ENV['JBOSS_OPTS'] ||= "-Djruby.home=#{jruby_home}"
  %w(JBOSS_HOME JRUBY_HOME).each { |key| puts "[ERROR] #{key} is not set. Install torquebox-server gem (and ensure it's in your Gemfile) or manually set #{key}" unless ENV[key] }
end

.torquebox_homeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



25
26
27
28
29
30
31
32
33
34
# File 'lib/torquebox/server.rb', line 25

def self.torquebox_home
  if ((gem_version <=> Gem::Version.new('1.8.9')) < 0)
    home = Gem.searcher.find( 'torquebox-server' )
  else
    home = Gem::Specification.find_by_name( 'torquebox-server' )
  end
  home.full_gem_path if home
rescue Exception => e
  nil
end