public int compareTo(final RubyPlatform other) { return getInterpreter().compareTo(other.getInterpreter()); }
public String getBinDir(boolean canonical) { String rubybin = null; String r = getInterpreter(canonical); if (r != null) { rubybin = new File(r).getParent(); } return rubybin; }
private String getGemMissingMessage() { if (Utilities.isMac() && "/usr/bin/ruby".equals(platform.getInterpreter())) { // NOI18N String version = System.getProperty("os.version"); // NOI18N if (version == null || version.startsWith("10.4")) { // Only a problem on Tiger // NOI18N return NbBundle.getMessage(RubyPlatformValidator.class, "RubyPlatformValidator.GemMissingMac"); } } return NbBundle.getMessage(RubyPlatformValidator.class, "RubyPlatformValidator.GemMissing"); }
public static synchronized RubyPlatform getPlatformByFile(File interpreter) { for (RubyPlatform p : getPlatformsInternal()) { try { File current = new File(p.getInterpreter()).getCanonicalFile(); File toFind = interpreter.getCanonicalFile(); if (current.equals(toFind)) { return p; } } catch (IOException e) { LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e); } } return null; }
public boolean isDefault() { RubyPlatform defaultPlatform = RubyPlatformManager.getDefaultPlatform(); return defaultPlatform != null && interpreter.equals(defaultPlatform.getInterpreter()); }
public synchronized File getHome(boolean canonical) { if (home == null) { try { String rp = getInterpreter(canonical); if (rp == null) { return null; } File r = new File(rp); // Handle bogus paths like "/" which cannot possibly point to a valid ruby installation File p = r.getParentFile(); if (p == null) { return null; } p = p.getParentFile(); if (p == null) { return null; } home = p.getCanonicalFile(); } catch (IOException ioe) { Exceptions.printStackTrace(ioe); return null; } } return home; }
public int compare(RubyPlatform p1, RubyPlatform p2) { int result = Collator.getInstance().compare( p1.getInfo().getLongDescription(), p2.getInfo().getLongDescription()); if (result == 0) { result = p1.getInterpreter().compareTo(p2.getInterpreter()); } return result; } };
/** * If the platform is in invalid state, shows general message to the user. * * @return whether the platform is valid */ public boolean showWarningIfInvalid() { boolean valid = isValid(); if (!valid) { Util.notifyLocalized(RubyPlatform.class, "RubyPlatform.InvalidInterpreter", // NOI18N NotifyDescriptor.WARNING_MESSAGE, getInterpreter()); } return valid; }
public @Override String toString() { return "RubyPlatform[id:" + getID() + ", label:" + getLabel() + ", " + getInterpreter() + ", info: " + info + "]"; // NOI18N }
/** * The same as {@link #findExecutable(String)}, but if fails and withSuffix * is set to true, it tries to find also executable with the suffix with * which was compiled the interpreter. E.g. for <em>ruby1.8.6-p111</em> * tries to find <em>irb1.8.6-p111</em>. * * @param toFind see {@link #findExecutable(String)} * @param withSuffix whether to try also suffix version when non-suffix is not found * @return see {@link #findExecutable(String)} */ private String findExecutable(final String toFind, final boolean searchInRubyGems, final boolean withSuffix) { String exec = findExecutable(toFind, searchInRubyGems); if (exec == null && withSuffix && !isJRuby()) { // JRuby is not compiled with custom suffix String name = new File(getInterpreter(true)).getName(); if (name.startsWith("ruby")) { // NOI18N String suffix = name.substring(4); // Try to find with suffix (#120441) exec = findExecutable(toFind + suffix, searchInRubyGems); } } return exec; }
public synchronized static FileObject getRubyStubs() { if (stubsFO == null) { // Core classes: Stubs generated for the "builtin" Ruby libraries. File clusterFile = InstalledFileLocator.getDefault().locate( "modules/org-netbeans-modules-ruby-project.jar", null, false); // NOI18N if (clusterFile != null) { File rubyStubs = new File(clusterFile.getParentFile().getParentFile().getAbsoluteFile(), // JRUBY_RELEASEDIR + File.separator + "rubystubs" + File.separator + RUBYSTUBS_VERSION); // NOI18N assert rubyStubs.exists() && rubyStubs.isDirectory(); stubsFO = FileUtil.toFileObject(rubyStubs); } else { // Language registry polls us for some reason (see #153595 stacktrace) RubyPlatform platform = RubyPlatformManager.getDefaultPlatform(); if (platform != null) { // there does not need to be default platform String interpreter = platform.getInterpreter(); if (interpreter != null) { FileObject fo = FileUtil.toFileObject(new File(interpreter)); if (fo != null) { stubsFO = fo.getParent().getParent().getParent().getFileObject("rubystubs/" + RUBYSTUBS_VERSION); // NOI18N } } } } } return stubsFO; }
File cmd = new File(platform.getInterpreter());
File cmd = new File(platform.getInterpreter());
lastSelectedPlatformID = plaf.getID(); plfNameValue.setText(plaf.getInfo().getLongDescription()); plfInterpreterValue.setText(plaf.getInterpreter()); Color color; boolean gemsInstalled = plaf.hasRubyGemsInstalled();
String binDir = getBinDir(); if (binDir != null) { LOGGER.log(Level.FINER, "Looking for '{0}' executable; used intepreter: '{1}'", new String[]{toFind, getInterpreter()}); // NOI18N exec = RubyPlatform.findExecutable(binDir, toFind); } else {