/** * Returns a map of environment variables. * * @since JRuby 1.5.0. * * @return a map that has environment variables' key-value pairs. */ public Map getEnvironment() { return provider.getRubyInstanceConfig().getEnvironment(); }
/** * Returns a map of environment variables. * * @since JRuby 1.5.0. * * @return a map that has environment variables' key-value pairs. */ public Map getEnvironment() { return provider.getRubyInstanceConfig().getEnvironment(); }
public String getEnvironment() { return ruby.get().getInstanceConfig().getEnvironment().toString(); }
/** * Returns a map of environment variables. * * @since JRuby 1.5.0. * * @return a map that has environment variables' key-value pairs. */ public Map getEnvironment() { return provider.getRubyInstanceConfig().getEnvironment(); }
/** * Returns a map of environment variables. * * @since JRuby 1.5.0. * * @return a map that has environment variables' key-value pairs. */ public Map getEnvironment() { return provider.getRubyInstanceConfig().getEnvironment(); }
public String getEnvironment() { return ruby.get().getInstanceConfig().getEnvironment().toString(); }
public String getEnvironment() { return ruby.get().getInstanceConfig().getEnvironment().toString(); }
public String getEnvironment() { return ruby.get().getInstanceConfig().getEnvironment().toString(); }
private Ruby createRubyRuntime(String baseDir) throws IOException { RubyInstanceConfig runtimeConfig = createRuntimeConfig(); Map<String, String> env = new HashMap<String, String>(runtimeConfig.getEnvironment()); env.remove("GEM_HOME"); env.remove("GEM_PATH"); env.put("RACK_ENV", "production"); env.put("RAILS_ENV", "production"); runtimeConfig.setEnvironment(env); return JavaEmbedUtils.initialize(ImmutableList.of(baseDir), runtimeConfig); }
/** * Returns the environment as a hash of Ruby strings. * * @param runtime */ public Map getEnvironmentVariableMap(Ruby runtime) { Map envs = null; if (runtime.getInstanceConfig().getEnvironment() != null) { return getAsMapOfRubyStrings(runtime, runtime.getInstanceConfig().getEnvironment().entrySet()); } // fall back on empty env when security disallows environment var access (like in an applet) if (Ruby.isSecurityRestricted()) { envs = new HashMap(); } else { Map variables = System.getenv(); envs = getAsMapOfRubyStrings(runtime, variables.entrySet()); } return envs; }
/** * Returns the environment as a hash of Ruby strings. * * @param runtime */ public static Map<RubyString, RubyString> environmentVariableMap(Ruby runtime) { @SuppressWarnings("unchecked") Map<String, String> env = runtime.getInstanceConfig().getEnvironment(); if ( env != null ) return asMapOfRubyStrings(runtime, env); if ( Ruby.isSecurityRestricted() ) return Collections.emptyMap(); return asMapOfRubyStrings(runtime, System.getenv()); }
/** * Returns the environment as a hash of Ruby strings. * * @param runtime */ public static Map<RubyString, RubyString> environmentVariableMap(Ruby runtime) { @SuppressWarnings("unchecked") Map<String, String> env = runtime.getInstanceConfig().getEnvironment(); if ( env != null ) return asMapOfRubyStrings(runtime, env); if ( Ruby.isSecurityRestricted() ) return Collections.emptyMap(); return asMapOfRubyStrings(runtime, System.getenv()); }
/** * Returns the environment as a hash of Ruby strings. * * @param runtime */ public Map getEnvironmentVariableMap(Ruby runtime) { Map envs = null; if (runtime.getInstanceConfig().getEnvironment() != null) { return getAsMapOfRubyStrings(runtime, runtime.getInstanceConfig().getEnvironment().entrySet()); } // fall back on empty env when security disallows environment var access (like in an applet) if (Ruby.isSecurityRestricted()) { envs = new HashMap(); } else { Map variables = System.getenv(); envs = getAsMapOfRubyStrings(runtime, variables.entrySet()); } return envs; }
@JRubyMethod(meta = true) // for RubyGems' JRuby defaults public static IRubyObject classpath_launcher(ThreadContext context, IRubyObject recv) { final Ruby runtime = context.runtime; String launcher = runtime.getInstanceConfig().getEnvironment().get("RUBY"); if ( launcher == null ) launcher = ClasspathLauncher.jrubyCommand(runtime); return runtime.newString(launcher); }
@JRubyMethod(meta = true) // for RubyGems' JRuby defaults public static IRubyObject classpath_launcher(ThreadContext context, IRubyObject recv) { final Ruby runtime = context.runtime; String launcher = runtime.getInstanceConfig().getEnvironment().get("RUBY"); if ( launcher == null ) launcher = ClasspathLauncher.jrubyCommand(runtime); return runtime.newString(launcher); }
Object pathObj = config.getEnvironment().get("PATH"); String path = pathObj.toString(); if (path != null) {
Object pathObj = config.getEnvironment().get("PATH"); String path = pathObj.toString(); if (path != null) {
final Map<String, String> env = config.getEnvironment(); if ( env != null && env.containsKey("RUBYOPT") ) { newEnv.put( "RUBYOPT", env.get("RUBYOPT") );
private String resolveScript(String scriptName) { // These try/catches are to allow failing over to the "commands" logic // when running from within a jruby-complete jar file, which has // jruby.home = a jar file URL that does not resolve correctly with // JRubyFile.create. String result = resolve(config.getCurrentDirectory(), scriptName); if (result != null) return scriptName;// use relative filename result = resolve(config.getJRubyHome() + "/bin", scriptName); if (result != null) return result; // since the current directory is also on the classpath we // want to find it on filesystem first result = resolve(config.getCurrentDirectory() + "/bin", scriptName); if (result != null) return result; result = resolve("uri:classloader:/bin", scriptName); if (result != null) return result; Object maybePath = config.getEnvironment().get("PATH"); if (maybePath != null) { String path = maybePath.toString(); String[] paths = path.split(File.pathSeparator); for (int i = 0; i < paths.length; i++) { result = resolve(new File(paths[i]).getAbsolutePath(), scriptName); if (result != null) return result; } } if (config.isDebug()) { config.getError().println("warning: could not resolve -S script: " + scriptName); } // fall back to JRuby::Commands return null; }
private String resolveScript(String scriptName) { // These try/catches are to allow failing over to the "commands" logic // when running from within a jruby-complete jar file, which has // jruby.home = a jar file URL that does not resolve correctly with // JRubyFile.create. String result = resolve(config.getCurrentDirectory(), scriptName); if (result != null) return scriptName;// use relative filename result = resolve(config.getJRubyHome() + "/bin", scriptName); if (result != null) return result; // since the current directory is also on the classpath we // want to find it on filesystem first result = resolve(config.getCurrentDirectory() + "/bin", scriptName); if (result != null) return result; result = resolve("uri:classloader:/bin", scriptName); if (result != null) return result; Object maybePath = config.getEnvironment().get("PATH"); if (maybePath != null) { String path = maybePath.toString(); String[] paths = path.split(File.pathSeparator); for (int i = 0; i < paths.length; i++) { result = resolve(new File(paths[i]).getAbsolutePath(), scriptName); if (result != null) return result; } } if (config.isDebug()) { config.getError().println("warning: could not resolve -S script: " + scriptName); } // fall back to JRuby::Commands return null; }