helper.putProperties(RakeProjectHelper.PROJECT_PROPERTIES_PATH, ep); Util.logUsage(RubyProjectGenerator.class, "USG_PROJECT_CREATE_RUBY", // NOI18N platform.getInfo().getKind(), platform.getInfo().getPlatformVersion(), platform.getInfo().getGemVersion());
assert !EventQueue.isDispatchThread() : "computeInfo should not be run from EDT"; if (TEST_RUBY_PROPS != null && !RubyPlatformManager.getDefaultPlatform().getInterpreterFile().equals(interpreter)) { // tests return new Info(TEST_RUBY_PROPS); props.load(proc.getInputStream()); info = new Info(props); } else { LOGGER.severe(interpreter.getAbsolutePath() + " does not seems to be a valid interpreter"); // TODO localize me
/** * Return <tt>null</tt> if there are no problems running gem. Otherwise * return an error message which describes the problem. */ String getRubyGemsProblems() { String gemTool = platform.getGemTool(); if (gemTool == null) { return getGemMissingMessage(); } String gemHome = platform.getInfo().getGemHome(); if (gemHome == null) { // edge case, misconfiguration? gem tool is installed but repository is not found return NbBundle.getMessage(RubyPlatformValidator.class, "RubyPlatformValidator.CannotFindGemRepository"); } File gemHomeF = new File(gemHome); if (!gemHomeF.isDirectory()) { // Is this possible? (Installing gems, but no gems installed yet return null; } return null; }
: platform.getGemManager().getLatestVersion("rails"); // NOI18N Util.logUsage(RailsProjectGenerator.class, "USG_PROJECT_CREATE_RAILS", // NOI18N platform.getInfo().getKind(), platform.getInfo().getPlatformVersion(), platform.getInfo().getGemVersion(), getServerIdForLogging(data.getServerInstanceId(), platform), data.getDatabase().getDisplayName(),
Info info = new Info("User-specified Ruby", "0.1"); // NOI18N props.setProperty(Info.GEM_VERSION, "1.0.1 (1.0.1)"); // NOI18N props.setProperty(Info.RUBY_LIB_DIR, new File(new File(hardcodedRuby).getParentFile().getParentFile(), "lib" + File.separator + "ruby" + File.separator + "1.8").getPath()); // NOI18N info = new Info(props); props.put(Info.GEM_VERSION, p.get(PLATFORM_PREFIX + idDot + Info.GEM_VERSION)); Info info = new Info(props); platforms.add(new RubyPlatform(id, interpreterPath, info)); foundDefault |= id.equals(PLATFORM_ID_DEFAULT);
plfNameValue.setText(plaf.getInfo().getLongDescription()); plfInterpreterValue.setText(plaf.getInterpreter()); Color color; gemPathList.setModel(createGemPathsModel(plaf)); refreshGemToolVersion(); gemToolValue.setText(plaf.getGemTool() + " (" + plaf.getInfo().getGemVersion() + ')'); // NOI18N color = UIManager.getColor("Label.foreground"); } else {
private static void putPlatformProperties(final String id, final File interpreter, final Info info, final EditableProperties props) throws FileNotFoundException { String interpreterKey = PLATFORM_PREFIX + id + PLATFORM_INTEPRETER; props.setProperty(interpreterKey, interpreter.getAbsolutePath()); if (!interpreter.isFile()) { throw new FileNotFoundException(interpreter.getAbsolutePath()); } String idDot = id + '.'; props.setProperty(PLATFORM_PREFIX + idDot + Info.RUBY_KIND, info.getKind()); props.setProperty(PLATFORM_PREFIX + idDot + Info.RUBY_VERSION, info.getVersion()); if (info.getJVersion() != null) { props.setProperty(PLATFORM_PREFIX + idDot + Info.JRUBY_VERSION, info.getJVersion()); } if (info.getPatchlevel() != null) { props.setProperty(PLATFORM_PREFIX + idDot + Info.RUBY_PATCHLEVEL, info.getPatchlevel()); } props.setProperty(PLATFORM_PREFIX + idDot + Info.RUBY_RELEASE_DATE, info.getReleaseDate()); // props.setProperty(PLATFORM_PREFIX + idDot + Info.RUBY_EXECUTABLE, info.getExecutable()); props.setProperty(PLATFORM_PREFIX + idDot + Info.RUBY_PLATFORM, info.getPlatform()); if (!info.isRubinius()) { props.setProperty(PLATFORM_PREFIX + idDot + Info.RUBY_LIB_DIR, info.getLibDir()); } if (info.getGemHome() != null) { props.setProperty(PLATFORM_PREFIX + idDot + Info.GEM_HOME, info.getGemHome()); props.setProperty(PLATFORM_PREFIX + idDot + Info.GEM_PATH, info.getGemPath()); props.setProperty(PLATFORM_PREFIX + idDot + Info.GEM_VERSION, info.getGemVersion()); } }
@Override protected void storeProperties(EditableProperties projectProperties, EditableProperties privateProperties) throws IOException { if (server != null) { privateProperties.remove(RAILS_SERVERTYPE); projectProperties.setProperty(RAILS_SERVERTYPE, server.getServerUri()); } if (getRailsEnvironment() != null) { privateProperties.setProperty(RAILS_ENV, getRailsEnvironment()); } RubyPlatform platform = getPlatform(); if (platform == null) { LOGGER.fine("Project has invalid platform (null)."); return; } Info info = platform.getInfo(); Util.logUsage(RailsProjectProperties.class, "USG_PROJECT_CONFIG_RAILS", // NOI18N info.getKind(), info.getPlatformVersion(), info.getGemVersion(), getServerIdForLogging(), "", // XXX database seems to not be configurable, so this attribute does not make sense here? ""); // XXX rails version - the same as above 'database' attribute? }
static Info forDefaultPlatform() { // NbBundle.getMessage(RubyPlatformManager.class, "CTL_BundledJRubyLabel") Info info = new Info("JRuby", "1.8.7"); // NOI18N info.jversion = "1.5.1"; // NOI18N info.patchlevel = "249"; // NOI18N // XXX this is dynamically generated during JRuby build, should be // fixed by not hardcoding the default platform info, but rather // computing as for other platforms info.releaseDate = "2010-05-12"; // NOI18N info.platform = "java"; // NOI18N File jrubyHome = InstalledFileLocator.getDefault().locate( "jruby-1.5.1", "org.netbeans.modules.ruby.platform", false); // NOI18N // XXX handle valid case when it is not available, see #124534 assert (jrubyHome != null && jrubyHome.isDirectory()) : "Default platform available"; FileObject libDirFO = FileUtil.toFileObject(jrubyHome).getFileObject("/lib/ruby"); // NOI18N info.libDir = FileUtil.toFile(libDirFO.getFileObject("/1.8")).getAbsolutePath(); // NOI18N info.gemHome = FileUtil.toFile(libDirFO.getFileObject("/gems/1.8")).getAbsolutePath(); // NOI18N info.gemPath = info.gemHome; info.gemVersion = "1.3.6"; // NOI18N return info; }
String getRubyGemsVersion() { return platform.getInfo().getGemVersion(); }
public File getGemHomeF() { return FileUtil.normalizeFile(new File(platform.getInfo().getGemHome())); }
public String getLabel() { return info.getLabel(isDefault()); }
@Override protected void storeProperties(EditableProperties projectProperties, EditableProperties privateProperties) throws IOException { RubyPlatform platform = getPlatform(); if (platform == null) { LOGGER.fine("Project has invalid platform (null)."); return; } Info info = platform.getInfo(); Util.logUsage(RubyProjectProperties.class, "USG_PROJECT_CONFIG_RUBY", // NOI18N info.getKind(), info.getPlatformVersion(), info.getGemVersion()); }
private boolean refreshGemToolVersion(){ boolean wasUpdated = false; RubyPlatform plaf = getSelectedPlatform(); String old = plaf.getInfo().getGemVersion(); //original one plaf.getGemManager().resetLocal(); String updated = plaf.getGemManager().getLatestVersion(UPDATE_GEM_NAME); //NOI18N if(updated != null && !updated.equals(old)){ plaf.getInfo().setGemVersion(updated); wasUpdated = true; } return wasUpdated; }
private void includeDeps(List<String> argList) { // -y and --include-dependencies is deprecated since 0.9.5 (and automatic) if (Util.compareVersions(platform.getInfo().getGemVersion(), "0.9.5") < 0) { // NOI18N argList.add("--include-dependencies"); // NOI18N } }
/** * Get version specific for the platform. E.g. in the case of JRuby it * returns e.g. 1.1.4 instead of 1.8.6. * * @return platform specific version */ public String getPlatformVersion() { return isJRuby() ? getJVersion() : getVersion(); }
private static RubyPlatform findDefaultPlatform() { String path = RubyInstallation.getInstance().getJRuby(); return path == null ? null : new RubyPlatform(PLATFORM_ID_DEFAULT, path, Info.forDefaultPlatform()); }
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 } }
/** Returns paths to all Gem repositories. */ public Set<File> getGemPath() { Set<File> repos = new LinkedHashSet<File>(); StringTokenizer st = new StringTokenizer(platform.getInfo().getGemPath(), File.pathSeparator); while (st.hasMoreTokens()) { repos.add(new File(st.nextToken())); } return repos; }