/** * An extension over <code>System.getProperty</code> method. * Handles security restrictions, and returns <code>null</code> * if the access to the property is restricted. * @param property The system property name. * @return The value of the system property, * or the default value. */ public static String getProperty(String property) { return getProperty(property, null); }
/** * An extension over <code>System.getProperty</code> method * that additionally produces an int value. * Handles security restrictions, and returns <code>0</code> * if the access to the property is restricted. * @param property The system property name. * @return The value of the system property, * or the default value. */ public static int getInt(String property) { return getInt(property, 0); }
/** * Returns a possible base directory. PWD environment variables is looked up first, * then user.dir System property second. This directory is used as a default value * when base directory is not given. * * @return a base directory. */ public static String getBaseDir() { String baseDir = SafePropertyAccessor.getenv("PWD"); if (baseDir == null || "/".equals(baseDir)) { baseDir = SafePropertyAccessor.getProperty("user.dir"); } return baseDir; } }
String extendedOption = grabOptionalValue(); if (extendedOption == null) { if (SafePropertyAccessor.getBoolean("jruby.launcher.nopreamble", false)) { throw new MainExitException(0, OutputStrings.getExtendedHelp()); } else {
private void initRubyInstanceConfig() throws RaiseException { String home = SafePropertyAccessor.getenv("JRUBY_HOME"); if (home != null) { provider.getRubyInstanceConfig().setJRubyHome(home); } provider.getRubyInstanceConfig().setScriptFileName("<script>"); }
String extendedOption = grabOptionalValue(); if (extendedOption == null) { if (SafePropertyAccessor.getBoolean("jruby.launcher.nopreamble", false)) { throw new MainExitException(0, OutputStrings.getExtendedHelp()); } else {
private void initRubyInstanceConfig() throws RaiseException { String home = SafePropertyAccessor.getenv("JRUBY_HOME"); if (home != null) { provider.getRubyInstanceConfig().setJRubyHome(home); } provider.getRubyInstanceConfig().setScriptFileName("<script>"); }
/** * An extension over <code>System.getProperty</code> method. * Handles security restrictions, and returns <code>null</code> * if the access to the property is restricted. * @param property The system property name. * @return The value of the system property, * or the default value. */ public static String getProperty(String property) { return getProperty(property, null); }
/** * Returns a possible base directory. PWD environment variables is looked up first, * then user.dir System property second. This directory is used as a default value * when base directory is not given. * * @return a base directory. */ public static String getBaseDir() { String baseDir = SafePropertyAccessor.getenv("PWD"); if (baseDir == null || "/".equals(baseDir)) { baseDir = SafePropertyAccessor.getProperty("user.dir"); } return baseDir; } }
/** * An extension over <code>System.getProperty</code> method * that additionally produces an int value. * Handles security restrictions, and returns <code>0</code> * if the access to the property is restricted. * @param property The system property name. * @return The value of the system property, * or the default value. */ public static int getInt(String property) { return getInt(property, 0); }
String extendedOption = grabOptionalValue(); if (extendedOption == null) { if (SafePropertyAccessor.getBoolean("jruby.launcher.nopreamble", false)) { throw new MainExitException(0, OutputStrings.getExtendedHelp()); } else {
/** * An extension over <code>System.getProperty</code> method. * Handles security restrictions, and returns <code>null</code> * if the access to the property is restricted. * @param property The system property name. * @return The value of the system property, * or the default value. */ public static String getProperty(String property) { return getProperty(property, null); }
/** * Returns a possible base directory. PWD environment variables is looked up first, * then user.dir System property second. This directory is used as a default value * when base directory is not given. * * @return a base directory. */ public static String getBaseDir() { String baseDir = SafePropertyAccessor.getenv("PWD"); if (baseDir == null || "/".equals(baseDir)) { baseDir = SafePropertyAccessor.getProperty("user.dir"); } return baseDir; } }
/** * An extension over <code>System.getProperty</code> method * that additionally produces an int value. * Handles security restrictions, and returns <code>0</code> * if the access to the property is restricted. * @param property The system property name. * @return The value of the system property, * or the default value. */ public static int getInt(String property) { return getInt(property, 0); }
String extendedOption = grabOptionalValue(); if (extendedOption == null) { if (SafePropertyAccessor.getBoolean("jruby.launcher.nopreamble", false)) { throw new MainExitException(0, OutputStrings.getExtendedHelp()); } else {
/** * An extension over <code>System.getProperty</code> method. * Handles security restrictions, and returns <code>null</code> * if the access to the property is restricted. * @param property The system property name. * @return The value of the system property, * or the default value. */ public static String getProperty(String property) { return getProperty(property, null); }
/** * Returns a possible base directory. PWD environment variables is looked up first, * then user.dir System property second. This directory is used as a default value * when base directory is not given. * * @return a base directory. */ public static String getBaseDir() { String baseDir = SafePropertyAccessor.getenv("PWD"); if (baseDir == null || "/".equals(baseDir)) { baseDir = SafePropertyAccessor.getProperty("user.dir"); } return baseDir; } }
/** * An extension over <code>System.getProperty</code> method * that additionally produces an int value. * Handles security restrictions, and returns <code>0</code> * if the access to the property is restricted. * @param property The system property name. * @return The value of the system property, * or the default value. */ public static int getInt(String property) { return getInt(property, 0); }
public static String getRubygemsDir(Ruby runtime) { // used when integrating JRuby with system RubyGems - example: /usr/share/rubygems return SafePropertyAccessor.getProperty("vendor.dir.rubygems", null); }
/** * Tries to find JRuby home from the order of JRUBY_HOME environment variable, * jruby.home System property, then "/META-INF/jruby.home" if jruby-complete.jar * is used. * * @param instance any instance to get a resource * @return JRuby home path if exists, null when failed to find it. */ @Deprecated public static String findJRubyHome(Object instance) { String jrubyhome; if ((jrubyhome = SafePropertyAccessor.getenv("JRUBY_HOME")) != null) { return jrubyhome; } if ((jrubyhome = SafePropertyAccessor.getProperty("jruby.home")) != null) { return jrubyhome; } return "uri:classloader://META-INF/jruby.home"; }