This repository has been archived by the owner on Feb 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some additional changes following code review
- Loading branch information
Catalin Buleandra
committed
Mar 2, 2015
1 parent
159bb45
commit 0b428e9
Showing
24 changed files
with
197 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
src/main/groovy/com/ofg/uptodate/finder/HttpConnectionSettings.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
src/main/groovy/com/ofg/uptodate/finder/JCenterNewVersionFinderFactory.groovy
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
src/main/groovy/com/ofg/uptodate/finder/JCenterRepositorySettingsProvider.groovy
This file was deleted.
Oops, something went wrong.
61 changes: 0 additions & 61 deletions
61
src/main/groovy/com/ofg/uptodate/finder/MavenLatestDependenciesProvider.groovy
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
src/main/groovy/com/ofg/uptodate/finder/MavenNewVersionFinderFactory.groovy
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
src/main/groovy/com/ofg/uptodate/finder/MavenRepositorySettingsProvider.groovy
This file was deleted.
Oops, something went wrong.
30 changes: 20 additions & 10 deletions
30
src/main/groovy/com/ofg/uptodate/finder/NewVersionFinder.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,43 @@ | ||
package com.ofg.uptodate.finder | ||
|
||
import com.ofg.uptodate.LoggerProxy | ||
import com.ofg.uptodate.UptodatePluginExtension | ||
import groovy.util.logging.Slf4j | ||
|
||
@Slf4j | ||
class NewVersionFinder { | ||
|
||
private final LoggerProxy loggerProxy | ||
private final LatestDependenciesProvider latestDependenciesProvider | ||
private final FinderConfiguration finderConfiguration | ||
private final LoggerProxy loggerProxy | ||
|
||
NewVersionFinder(LoggerProxy loggerProxy, | ||
RepositorySettingsProvider repositorySettingsProvider, | ||
LatestDependenciesProvider latestDependenciesProvider, | ||
UptodatePluginExtension uptodatePluginExtension) { | ||
|
||
finderConfiguration = new FinderConfiguration(repositorySettingsProvider.getFrom(uptodatePluginExtension), uptodatePluginExtension) | ||
this.latestDependenciesProvider = latestDependenciesProvider | ||
NewVersionFinder(LoggerProxy loggerProxy, LatestDependenciesProvider latestDependenciesProvider, FinderConfiguration finderConfiguration) { | ||
this.loggerProxy = loggerProxy | ||
this.latestDependenciesProvider = latestDependenciesProvider | ||
this.finderConfiguration = finderConfiguration | ||
} | ||
|
||
List<Dependency> findNewer(List<Dependency> dependencies) { | ||
if (finderConfiguration.ignore || dependencies.empty) { | ||
return [] | ||
} | ||
|
||
List<Dependency> newerDependencies = latestDependenciesProvider.findLatest(dependencies, finderConfiguration) | ||
List<Dependency> newerDependencies = latestDependenciesProvider.findLatest(dependencies, finderConfiguration).grep(getOnlyNewer).collect {it[1]} | ||
loggerProxy.debug(log, "Newer dependencies found in $finderConfiguration.httpConnectionSettings.url $newerDependencies") | ||
return newerDependencies | ||
} | ||
|
||
private Closure<Boolean> getOnlyNewer = { List<Dependency> dependenciesToCompare -> | ||
loggerProxy.debug(log, "${finderConfiguration.httpConnectionSettings.url} - Dependencies to get only newer $dependenciesToCompare") | ||
if (dependenciesToCompare.empty) { | ||
loggerProxy.debug(log, "Dependencies to compare are empty - sth went wrong so no newer version was found") | ||
return false | ||
} | ||
if (!dependenciesToCompare[1].version) { | ||
loggerProxy.debug(log, "The retrieved dependency has null version value thus no newer version was found") | ||
return false | ||
} | ||
boolean fetchedDependencyHasGreaterVersion = dependenciesToCompare[1].version > dependenciesToCompare[0].version | ||
loggerProxy.debug(log, "Fetched dependency has greater version than the current one [$fetchedDependencyHasGreaterVersion]") | ||
return fetchedDependencyHasGreaterVersion | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
src/main/groovy/com/ofg/uptodate/finder/RepositorySettingsProvider.groovy
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.