private void migrateRubyPlugin(final Migrator migrator, final ComparableVersion fromVersion, final String thisEmbulkVersion) throws IOException { final String jrubyVersion = ScriptingContainerDelegateImpl.getJRubyVersion(EmbulkMigrate.class.getClassLoader()); if (jrubyVersion != null) { migrator.write(".ruby-version", "jruby-" + jrubyVersion); } else { System.err.println("JRuby version not found. No .ruby-version is created nor migrated."); } // Update |embulk| version depending. if (fromVersion.compareTo(new ComparableVersion("0.1.0")) <= 0) { // Add add_development_dependency. migrator.insertLineRecursive("*.gemspec", DEVELOPMENT_DEPENDENCY_IN_GEMSPEC, new StringUpsert() { @Override public String getUpsertd(Matcher matcher) { return String.format("%s.add_development_dependency 'embulk', ['>= %s']", matcher.group(1), thisEmbulkVersion); } }); } else { if (migrator.replaceRecursive("*.gemspec", EMBULK_DEPENDENCY_PRERELEASE_IN_GEMSPEC, 1, ">= " + thisEmbulkVersion).isEmpty()) { migrator.replaceRecursive("*.gemspec", EMBULK_DEPENDENCY_IN_GEMSPEC, 1, thisEmbulkVersion); } } }
for ( String version : args ) ComparableVersion c = new ComparableVersion( version ); int compare = prev.compareTo( c ); System.out.println( " " + prev.toString() + ' ' + ( ( compare == 0 ) ? "==" : ( ( compare < 0 ) ? "<" : ">" ) ) + ' ' + version ); System.out.println( String.valueOf( i++ ) + ". " + version + " == " + c.getCanonical() );
@Override public int hashCode() { return 11 + comparable.hashCode(); }
if (!matchedEmbulkCoreInGradle.isEmpty()) { language = Language.JAVA; fromVersion = new ComparableVersion(matchedEmbulkCoreInGradle.get(0).group(1).replace("+", "0")); System.out.printf("Detected Java plugin for Embulk %s...\n", fromVersion.toString()); } else if (!matchedNewEmbulkInGemspec.isEmpty()) { language = Language.RUBY; fromVersion = new ComparableVersion(matchedNewEmbulkInGemspec.get(0).group(1)); System.out.printf("Detected Ruby plugin for Embulk %s...\n", fromVersion.toString()); } else if (!matchedOldEmbulkInGemspec.isEmpty()) { language = Language.RUBY; fromVersion = new ComparableVersion("0.1.0"); System.out.println("Detected Ruby plugin for unknown Embulk version..."); } else {
@Override public int compareTo(Library o) { return ComparisonChain.start() .compare(libraryKey, o.libraryKey) .compare(new ComparableVersion(version), new ComparableVersion(o.version)) .result(); } }
String version1Str = plugin1.getVersion(); String version2Str = plugin2.getVersion(); ComparableVersion plugin1Version = new ComparableVersion((version1Str != null) ? version1Str : "0"); ComparableVersion plugin2Version = new ComparableVersion((version2Str != null) ? version2Str : "0"); if (plugin1Version.equals(plugin2Version)) { if (plugin1.getMtime() == plugin2.getMtime()) { LOG.info("Plugins [" + plugin1 + ", " + plugin2 return plugin2; } else if (plugin1Version.compareTo(plugin2Version) < 0) { return plugin1; } else {
public int compareTo( ArtifactVersion otherVersion ) { if ( otherVersion instanceof DefaultArtifactVersion ) { return this.comparable.compareTo( ( (DefaultArtifactVersion) otherVersion ).comparable ); } else { return compareTo( new DefaultArtifactVersion( otherVersion.toString() ) ); } }
@ExcludeDefaultInterceptors public AgentVersionCheckResults isAgentVersionSupported(AgentVersion agentVersionInfo) { try { Properties properties = getAgentUpdateVersionFileContent(); String supportedAgentBuilds = properties.getProperty(RHQ_AGENT_SUPPORTED_BUILDS); // this is optional String latestAgentVersion = properties.getProperty(RHQ_AGENT_LATEST_VERSION); String latestAgentBuild = properties.getProperty(RHQ_AGENT_LATEST_BUILD_NUMBER); if (latestAgentVersion == null) { throw new NullPointerException("no agent version in file"); } boolean isSupported; //if no list of supportedBuilds provident then, if (supportedAgentBuilds == null || supportedAgentBuilds.isEmpty()) { // we weren't given a regex of supported versions, make a simple string equality test on latest agent version ComparableVersion agent = new ComparableVersion(agentVersionInfo.getVersion()); ComparableVersion server = new ComparableVersion(latestAgentVersion); isSupported = agent.equals(server); } else { // we were given a regex of supported builds, check the agent build to see if it matches the regex isSupported = agentVersionInfo.getBuild().matches(supportedAgentBuilds); } return new AgentVersionCheckResults(isSupported, new AgentVersion(latestAgentVersion, latestAgentBuild)); } catch (Exception e) { LOG.warn("Cannot determine if agent version [" + agentVersionInfo + "] is supported. Cause: " + e); return new AgentVersionCheckResults(false, null); // assume we can't talk to it } }
@Override public String toString() { return comparable.toString(); } }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ModuleVersionNumber other = (ModuleVersionNumber) obj; if (this.delegate == null) { if (other.delegate != null) return false; } else if (!this.delegate.equals(other.delegate)) return false; return true; }
public final void parseVersion( String version ) comparable = new ComparableVersion( version );
public int compareTo( ArtifactVersion otherVersion ) { if ( otherVersion instanceof DefaultArtifactVersion ) { return this.comparable.compareTo( ( (DefaultArtifactVersion) otherVersion ).comparable ); } else { return compareTo( new DefaultArtifactVersion( otherVersion.toString() ) ); } }
public Collection<String> findVersions(String groupId, String artifactId, String searchExpression, Packaging packaging) { try { Collection<IndexedArtifact> values = index.find(new MatchTypedStringSearchExpression(groupId, MatchType.EXACT), new MatchTypedStringSearchExpression(artifactId, MatchType.EXACT), null, packaging.toSearchExpression()); if(values.isEmpty()) { return Collections.emptySet(); } TreeSet<String> ids = new TreeSet<String>(); Set<IndexedArtifactFile> files = values.iterator().next().getFiles(); for(IndexedArtifactFile artifactFile : files) { ids.add(artifactFile.version); } Collection<String> result = subSet(ids, searchExpression); // sort results according to o.a.m.artifact.versioning.ComparableVersion SortedSet<ComparableVersion> versions = new TreeSet<ComparableVersion>(); for(String version : result) { versions.add(new ComparableVersion(version)); } result = null; // not used any more List<String> sorted = new ArrayList<String>(versions.size()); for(ComparableVersion version : versions) { sorted.add(version.toString()); } versions = null; // not used any more Collections.reverse(sorted); return sorted; } catch(CoreException ex) { throw new SearchException(ex.getMessage(), ex.getStatus().getException()); } }
@Override public String toString() { return comparable.toString(); } }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ModuleVersionNumber other = (ModuleVersionNumber) obj; if (this.delegate == null) { if (other.delegate != null) return false; } else if (!this.delegate.equals(other.delegate)) return false; return true; }
} else { System.out.println("Checking the latest version..."); final ComparableVersion runningVersion = new ComparableVersion(runningVersionString); targetVersionString = checkLatestVersion(); final ComparableVersion targetVersion = new ComparableVersion(targetVersionString); if (targetVersion.compareTo(runningVersion) <= 0) { System.out.printf("Already up-to-date. %s is the latest version.\n", runningVersion); return;
public final void parseVersion( String version ) comparable = new ComparableVersion( version );
for ( String version : args ) ComparableVersion c = new ComparableVersion( version ); int compare = prev.compareTo( c ); System.out.println( " " + prev.toString() + ' ' + ( ( compare == 0 ) ? "==" : ( ( compare < 0 ) ? "<" : ">" ) ) + ' ' + version ); System.out.println( String.valueOf( i++ ) + ". " + version + " == " + c.getCanonical() );
public int compareTo(ModuleVersionNumber installingVersion) { return delegate.compareTo(installingVersion.delegate); }
v -> { try { return new ComparableVersion(v); } catch (Exception e) { LOG.error( return new InstallerFqn(installerFqn.getId(), latestVersion.get().toString());