/** Returns main Gem repository path. */ public String getGemHome() { return platform.getInfo().getGemHome(); }
/** 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; }
String getRubyGemsVersion() { return platform.getInfo().getGemVersion(); }
private void storeGemPath(final Set<File> gemPath) { StringBuilder pathSB = new StringBuilder(); for (File token : gemPath) { if (pathSB.length() != 0) { pathSB.append(File.pathSeparator); } pathSB.append(token.getAbsolutePath()); } platform.getInfo().setGemPath(pathSB.toString()); try { RubyPlatformManager.storePlatform(platform); } catch (IOException ioe) { LOGGER.log(Level.SEVERE, ioe.getLocalizedMessage(), ioe); } resetLocal(); }
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 } }
public File getGemHomeF() { return FileUtil.normalizeFile(new File(platform.getInfo().getGemHome())); }
/** * 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; }
@CheckForNull public static String platformDescriptionFor(Project project) { RubyPlatform platform = platformFor(project); return platform == null ? null : platform.getInfo().getLongDescription(); }
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; }
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 } }
@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()); }
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 {
@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? }
: 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(),