private void updateEnabled() { RubyPlatform platform = (RubyPlatform) platforms.getSelectedItem(); boolean isJRuby = platform != null && platform.isJRuby(); jrubyPropsExample.setEnabled(isJRuby); jrubyPropsLabel.setEnabled(isJRuby); jrubyPropsText.setEnabled(isJRuby); }
private void initJvmArgs() { RubyPlatform selected = getPlatform(); boolean enable = selected != null && selected.isJRuby(); jvmArgsField.setEnabled(enable); jvmArgsLabel.setEnabled(enable); }
public synchronized String getIRB() { if (irb == null) { irb = findExecutable(isJRuby() ? "jirb" : "irb", false, true); // NOI18N } return irb; }
public boolean isGemInstalledForPlatform(final String gemName, final VersionPredicate predicate) { for (GemInfo gemInfo : getVersions(gemName)) { // TODO: the platform info should rather be encapsulated in GemInfo String specName = gemInfo.getSpecFile().getName(); // filter out all java gems for non-java platforms // hack until we support proper .gemspec parsing if (!platform.isJRuby() && specName.endsWith("-java.gemspec")) { // NOI18N continue; } // special hack for fast debugger if (specName.startsWith("ruby-debug-base-")) { // NOI18N boolean forJavaPlaf = specName.endsWith("-java.gemspec"); // NOI18N if (platform.isJRuby() && !forJavaPlaf) { continue; } if (!platform.isJRuby() && forJavaPlaf) { continue; } } if (predicate.isRight(gemInfo.getVersion())) { return true; } } return false; }
private void initGlassFish() { if (platform.isJRuby()) { GemManager gemManager = platform.getGemManager(); if (gemManager == null) { return; } List<GemInfo> versions = gemManager.getVersions(GlassFishGem.GEM_NAME); GemInfo glassFishGemInfo = versions.isEmpty() ? null : versions.get(0); if (glassFishGemInfo == null) { // remove all glassfish from gems for (Iterator<RubyServer> it = servers.iterator(); it.hasNext();) { if (it.next() instanceof GlassFishGem) { it.remove(); } } return; } GlassFishGem candidate = new GlassFishGem(platform, glassFishGemInfo); if (!servers.contains(candidate)) { servers.add(candidate); } } }
/** * 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; }
private static List<RailsDatabaseConfiguration> getMySQLAdapters(RubyPlatform platform) { if (!platform.isJRuby()) { return Collections.<RailsDatabaseConfiguration>singletonList(new MySQLAdapter()); } GemManager gemManager = platform.getGemManager(); if (gemManager == null || !gemManager.isGemInstalled(JdbcMySQlAdapter.GEM_NAME)) { return Collections.<RailsDatabaseConfiguration>singletonList(new MySQLAdapter()); } return Collections.<RailsDatabaseConfiguration>singletonList(new JdbcMySQlAdapter()); }
private static List<RailsDatabaseConfiguration> getPostgreSQLAdapters(RubyPlatform platform) { if (!platform.isJRuby()) { return Collections.<RailsDatabaseConfiguration>singletonList(new PostgreSQLAdapter()); } GemManager gemManager = platform.getGemManager(); if (gemManager == null || !gemManager.isGemInstalled(JdbcPostgreSQLAdapter.GEM_NAME)) { return Collections.<RailsDatabaseConfiguration>singletonList(new PostgreSQLAdapter()); } return Collections.<RailsDatabaseConfiguration>singletonList(new JdbcPostgreSQLAdapter()); } /**
void read(WizardDescriptor descriptor) { RubyPlatform platform = (RubyPlatform) descriptor.getProperty(NewRailsProjectWizardIterator.PLATFORM); boolean jruby = platform.isJRuby(); if (!initialized) { useIDEConnections.setSelected(jruby); useRailsAdapter.setSelected(!jruby); initialized = true; } if (!jruby) { useJdbc.setSelected(false); } useJdbc.setEnabled(jruby); jdbcPanel.read(descriptor); adaptersPanel.read(descriptor); initInnerPanels(); }
public void editConfig(RailsProject project) { RubyPlatform platform = RubyPlatform.platformFor(project); if (platform.isJRuby()) { // as of 1.1 RC2 JRuby apparently supports socket, but commenting it // out still using 127.0.0.1 rather than localhost for the reasons // described in issue #131024 RailsAdapters.commentOutSocket(project.getProjectDirectory(), "127.0.0.1"); //NOI18N } }
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); } }
public void editConfig(RailsProject project) { RubyPlatform platform = RubyPlatform.platformFor(project); if (platform.isJRuby()) { // only need extra config when using JRuby uncommentTcpIpConfig(project.getProjectDirectory()); } }
public void editConfig(RailsProject project) { RubyPlatform platform = RubyPlatform.platformFor(project); if (platform.isJRuby()) { // JRuby doesn't support socket RailsAdapters.commentOutSocket(project.getProjectDirectory(), "localhost"); //NOI18N } }
public static void addDefaultGlassFishGem(ComboBoxModel servers, RubyPlatform platform) { if (platform == null || !platform.isJRuby()) { return; } for (int i = 0; i < servers.getSize(); i++) { Object server = servers.getElementAt(i); if (server instanceof GlassFishGem) { return; } } ServerListModel model = (ServerListModel) servers; // no glassfish gem, add a placeholder RubyInstance fakeGfGem = new FakeGlassFishGem(); model.addServer(fakeGfGem); }
private void installFastDebuggerActionPerformed(java.awt.event.ActionEvent evt) { if (getSelectedPlatform().isJRuby()) { // automatic installation is not available yet Util.notifyLocalized(RubyPlatformCustomizer.class, "RubyPlatformCustomizer.instructionsToInstallJRubyDebugger", getSelectedPlatform().getFastDebuggerProblemsInHTML()); } else if (getSelectedPlatform().installFastDebugger()) { refreshDebugger(); } }
if (Utilities.isWindows() && !getPlatform().isJRuby()) {
desc.addStandardRecognizers(); if (RubyPlatform.platformFor(project).isJRuby()) { desc.appendJdkToPath(true);
private void railsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_railsButtonActionPerformed Runnable asyncCompletionTask = new InstallationComplete(); Gem rails = new Gem("rails", null, null); // NOI18N Gem jdbc = new Gem("activerecord-jdbc-adapter", null, null); // NOI18N Gem[] gems = platform().isJRuby() ? new Gem[]{rails, jdbc} : new Gem[]{rails}; RailsInstallationInfo railsInfo = RailsInstallationValidator.getRailsInstallation(platform()); if (railsInfo.getVersion() == null) { gemManager().install(gems, this, false, false, null, true, true, asyncCompletionTask); } else { // Already installed: update (with dependencies) gemManager().update(gems, this, false, false, true, true, asyncCompletionTask); } }//GEN-LAST:event_railsButtonActionPerformed
return new Ruby18Parser(); if (platform.isJRuby()) { return getParserForJRuby(owner);
allowInput(). classPath(classPath). appendJdkToPath(platform.isJRuby()). addStandardRecognizers(). addErrConvertor(LineConvertors.filePattern(fileLocator,