GemRunner(final RubyPlatform platform) { this.platform = platform; assert platform.hasRubyGemsInstalled() : "GemRunner cannot be used fro platform without RubyGems: " + platform; }
/** * Calls {@link #hasRubyGemsInstalled(boolean)} with <tt>false</tt> for warn * parameter. */ public boolean hasRubyGemsInstalled() { return hasRubyGemsInstalled(false); }
public GemManager(final RubyPlatform platform) { assert platform.hasRubyGemsInstalled() : "called when RubyGems installed"; this.platform = platform; this.runnerLocalLock = new ReentrantLock(true); this.runnerRemoteLock = new ReentrantLock(true); }
public static boolean chooseAndSetGemHome(final Component parent, final RubyPlatform platform) { if (platform == null) { return false; } assert platform.hasRubyGemsInstalled() : "has RubyGems installed"; File gemHomeF = chooseGemRepository(parent); if (gemHomeF != null) { platform.setGemHome(gemHomeF); return true; } return false; }
/** * See also {@link #hasRubyGemsInstalled}. * * @return either an instance of {@link GemManager} or <tt>null</tt>. */ @CheckForNull public synchronized GemManager getGemManager() { if (gemManager == null && hasRubyGemsInstalled()) { gemManager = new GemManager(this); } return gemManager; }
private synchronized void initGemList() { if (localGems == null) { // Initialize lazily assert platform.hasRubyGemsInstalled() : "asking for gems only when RubyGems are installed"; localGems = new HashMap<String, List<GemInfo>>(); Set<File> allSpecFiles = new HashSet<File>(100); for (File gemDir : getRepositories()) { File specDir = new File(gemDir, SPECIFICATIONS); if (specDir.exists()) { LOGGER.finer("Initializing \"" + gemDir + "\" repository"); // Add each of */lib/ File[] specFiles = specDir.listFiles(); if (specFiles != null) { allSpecFiles.addAll(Arrays.asList(specFiles)); } } else { LOGGER.finer("Cannot find Gems repository. \"" + gemDir + "\" does not exist or is not a directory."); // NOI18N } } Map<String, List<GemInfo>> namesToInfos = GemFilesParser.getGemInfos(allSpecFiles); for (Map.Entry<String, List<GemInfo>> nameToInfos : namesToInfos.entrySet()) { String name = nameToInfos.getKey(); localGems.put(name, nameToInfos.getValue()); } logGems(Level.FINEST); } }
public void setGemHome(File gemHome) { assert hasRubyGemsInstalled() : "has RubyGems installed"; info.setGemHome(gemHome.getAbsolutePath()); try { RubyPlatformManager.storePlatform(this); } catch (IOException ioe) { LOGGER.log(Level.SEVERE, ioe.getLocalizedMessage(), ioe); } getGemManager().reset(); }
/** * Checks whether the platform has a valid Rake installed. * * @param warn whether to show warning message to the user if ther is no * valid Rake installed */ public boolean hasValidRake(boolean warn) { boolean valid = isValid(warn) && hasRubyGemsInstalled(warn); String rakePath = getRake(); valid = (rakePath != null) && new File(rakePath).exists(); possiblyNotifyUser(warn, valid, "rake"); // NOI18N return valid; }
private static String getGemHomeURL(RubyPlatform platform) { return platform.hasRubyGemsInstalled() ? platform.getGemManager().getGemHomeUrl() : null; }
public RubyExecutionDescriptor(final RubyPlatform platform, final String displayName, final File pwd, final String script) { this.platform = platform; this.displayName = displayName; this.pwd = pwd; this.script = script; this.useInterpreter = true; assert (pwd == null) || pwd.isDirectory() : pwd + " is a directory"; if (platform.hasRubyGemsInstalled()) { Map<String, String> env = new HashMap<String, String>(); GemManager.adjustEnvironment(platform, env); addAdditionalEnv(env); } if (platform.isJRuby()) { Map<String, String> env = new HashMap<String, String>(); String home = platform.getHome().getAbsolutePath(); env.put("JRUBY_HOME", home); // NOI18N env.put("JRUBY_BASE", home); // NOI18N env.put("JAVA_HOME", ExecutionUtils.getJavaHome()); // NOI18N addAdditionalEnv(env); } }
private void refreshDebugger() { RubyPlatform platform = getSelectedPlatform(); boolean supportFastDebuggerInstallation = !platform.isRubinius(); boolean fdInstalled = platform.hasFastDebuggerInstalled(); installFastDebugger.setEnabled(supportFastDebuggerInstallation && platform.hasRubyGemsInstalled()); installFastDebugger.setVisible(supportFastDebuggerInstallation && !fdInstalled); String key = platform.isRubinius() ? "RubyPlatformCustomizer.noFastDebuggerForRubiniusYet.text" // NOI18N : (platform.hasFastDebuggerInstalled() ? "RubyPlatformCustomizer.rubyDebugEngine.text" // NOI18N : "RubyPlatformCustomizer.classicDebuggerEngine.text"); // NOI18N engineType.setText(getMessage(key)); }
public static void adjustEnvironment(final RubyPlatform platform, final Map<String, String> env) { if (platform.hasRubyGemsInstalled()) { String gemHome = adjustGemPath(platform.getGemManager().getGemHome()); String gemPath = adjustGemPath(platform.getInfo().getGemPath()); env.put("GEM_HOME", gemHome); // NOI18N env.put("GEM_PATH", gemPath); // NOI18N } }
exclude.append(home.replace('\\', '/').replace("/", "\\/")); // NOI18N if (platform.hasRubyGemsInstalled()) { GemManager gemManager = platform.getGemManager(); if (gemManager != null) {
if (!platform.hasRubyGemsInstalled()) { continue;
if (!platform.hasRubyGemsInstalled()) { LOGGER.fine("Not RubyGems installed, returning empty result"); return Collections.emptyList();
if (!getPlatform().hasRubyGemsInstalled()) { LOGGER.fine("Not RubyGems installed, returning empty result"); return Collections.emptyList();
plfInterpreterValue.setText(plaf.getInterpreter()); Color color; boolean gemsInstalled = plaf.hasRubyGemsInstalled(); if (gemsInstalled) { gemHomeValue.setText(plaf.getGemManager().getGemHome());
LOGGER.log(Level.WARNING, "Could not find Ruby interpreter executable when searching for '{0}'", toFind); // NOI18N if (exec == null && searchInRubyGems && hasRubyGemsInstalled()) { for (File repo : getGemManager().getRepositories()) { String libGemBinDir = repo.getAbsolutePath() + File.separator + "bin"; // NOI18N
if (paltformsAreBeingLoaded || platform == null || !platform.isValid() || !platform.hasRubyGemsInstalled()) { if (!paltformsAreBeingLoaded) { gemHomeValue.setForeground(PlatformComponentFactory.INVALID_PLAF_COLOR);
if (!platform.hasRubyGemsInstalled(true) || !platform.hasValidRake(true)) { return;