public synchronized String getAutoSpec() { if (autospec == null) { autospec = findExecutable("autospec"); // NOI18N } return autospec; }
/** * Return path to the <em>gem</em> tool if it does exist. * * @return path to the <em>gem</em> tool; might be <tt>null</tt> if not * found. */ public synchronized String getGemTool() { if (gemTool == null) { gemTool = findExecutable("gem", false, true); // NOI18N } return gemTool; }
public synchronized String getRDoc() { if (rdoc == null) { rdoc = findExecutable("rdoc", false, true); // NOI18N } return rdoc; }
public synchronized String getRails() { if (rails == null) { rails = findExecutable("rails"); // NOI18N } return rails; }
public synchronized String getAutoTest() { if (autotest == null) { autotest = findExecutable("autotest"); // NOI18N } return autotest; }
/** * Try to find a path to the <tt>toFind</tt> executable in the "Ruby * specific" manner. * * @param toFind executable to be find, e.g. rails, rake, rdoc, irb ... * @return path to the found executable; might be <tt>null</tt> if not * found. */ public String findExecutable(final String toFind) { return findExecutable(toFind, true); }
public synchronized String getIRB() { if (irb == null) { irb = findExecutable(isJRuby() ? "jirb" : "irb", false, true); // NOI18N } return irb; }
/** * 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 String getRake() { if (rake == null) { rake = findExecutable("rake"); // NOI18N if (rake != null && !(new File(rake).exists()) && getGemManager().getLatestVersion("rake") != null) { // NOI18N // On Windows, rake does funny things - you may only get a rake.bat InstalledFileLocator locator = InstalledFileLocator.getDefault(); File f = locator.locate("modules/org-netbeans-modules-ruby-project.jar", // NOI18N null, false); if (f == null) { throw new RuntimeException("Can't find cluster"); // NOI18N } f = new File(f.getParentFile().getParentFile().getAbsolutePath() + File.separator + "rake"); // NOI18N try { rake = f.getCanonicalPath(); } catch (IOException ioe) { Exceptions.printStackTrace(ioe); } } } return rake; }
private boolean isWarblerInstalled() { return gemManager().isGemInstalled(WARBLER) && platform().findExecutable(WARBLE_CMD) != null; //NOI18N }
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 { LOGGER.log(Level.WARNING, "Could not find Ruby interpreter executable when searching for '{0}'", toFind); // NOI18N for (File repo : getGemManager().getRepositories()) { String libGemBinDir = repo.getAbsolutePath() + File.separator + "bin"; // NOI18N exec = RubyPlatform.findExecutable(libGemBinDir, toFind); if (exec != null) { break; exec = findExecutable(toFind + ".bat", searchInRubyGems); // NOI18N
private static void runWarblePluginize(RubyPlatform platform, Project project) { String warble = platform.findExecutable("warble"); //NOI18N if (warble == null) { // at this point the rails wizard should have already checked // that warble exists, so just logging LOGGER.warning("Could not find warble executable, platform: " + platform); return; } RubyExecutionDescriptor desc = new RubyExecutionDescriptor(platform, NbBundle.getMessage(RailsProjectGenerator.class, "WarblePluginize"), FileUtil.toFile(project.getProjectDirectory()), new File(warble).getAbsolutePath()); desc.additionalArgs("pluginize"); //NOI18N RubyProcessCreator processCreator = new RubyProcessCreator(desc); desc.addStandardRecognizers(); ExecutionService.newService(processCreator, desc.toExecutionDescriptor(), NbBundle.getMessage(RailsProjectGenerator.class, "WarblePluginize")).run(); }
/** * Initializes tasks, must be called before invoking {@link #getTasks() } * or {@link #installed() }. */ public void initialize() { initialized = true; RubyPlatform platform = getPlatform(); if (platform == null) { return; } bundle = platform.findExecutable(BUNDLE); if (bundle == null) { return; } GemManager gemManager = platform.getGemManager(); if (gemManager == null) { return; } installed = gemManager.isGemInstalled(BUNDLER_GEM); if (installed) { fetchTasks(); } }
private void openIrbConsole(Lookup context) { RubyPlatform platform = getPlatform(); String irbPath = platform.findExecutable("irb"); // NOI18N if (irbPath == null) { Toolkit.getDefaultToolkit().beep(); return; } String displayName = NbBundle.getMessage(RubyActionProvider.class, "CTL_IrbTopComponent"); File pwd = FileUtil.toFile(project.getProjectDirectory()); String classPath = project.evaluator().getProperty(RubyProjectProperties.JAVAC_CLASSPATH); RubyExecutionDescriptor desc = new RubyExecutionDescriptor(platform, displayName, pwd, irbPath). showSuspended(false). showProgress(false). classPath(classPath). allowInput(). additionalArgs("--simple-prompt", "--noreadline"). // NOI18N //additionalArgs(getApplicationArguments()). fileLocator(new RubyFileLocator(context, project)). addStandardRecognizers(); RubyProcessCreator rpc = new RubyProcessCreator(desc, getSourceEncoding()); ExecutionService.newService(rpc, desc.toExecutionDescriptor(), displayName).run(); }