Renamed run() -> doRun()
Used run() to wrap doRun() in a prepare()/destroy()
diff --git a/src/main/groovy/m4e/AbstractCommand.groovy b/src/main/groovy/m4e/AbstractCommand.groovy
index 9aaf3ac..d85ef12 100644
--- a/src/main/groovy/m4e/AbstractCommand.groovy
+++ b/src/main/groovy/m4e/AbstractCommand.groovy
@@ -25,7 +25,23 @@
run( args as String[] )
}
- abstract void run( String... args );
+ void run( String... args ) {
+ prepare()
+
+ doRun( args )
+
+ destroy()
+ }
+
+ void prepare() {
+
+ }
+
+ void destroy() {
+
+ }
+
+ abstract void doRun( String... args );
int errorCount = 0
int warningCount = 0
diff --git a/src/main/groovy/m4e/AnalyzeCmd.groovy b/src/main/groovy/m4e/AnalyzeCmd.groovy
index 5fd4a9d..b3180ad 100644
--- a/src/main/groovy/m4e/AnalyzeCmd.groovy
+++ b/src/main/groovy/m4e/AnalyzeCmd.groovy
@@ -24,7 +24,7 @@
- Check a converted Maven 2 repository for various problems
'''
- void run( String... args ) {
+ void doRun( String... args ) {
if( args.size() <= 1 ) {
throw new UserError( 'Missing path to repository to analyze' )
}
diff --git a/src/main/groovy/m4e/AttachSourcesCmd.groovy b/src/main/groovy/m4e/AttachSourcesCmd.groovy
index cbc6587..738da1a 100644
--- a/src/main/groovy/m4e/AttachSourcesCmd.groovy
+++ b/src/main/groovy/m4e/AttachSourcesCmd.groovy
@@ -17,7 +17,7 @@
int count
- void run( String... args ) {
+ void doRun( String... args ) {
log.warn( 'This command is obsolete' )
}
}
diff --git a/src/main/groovy/m4e/ConvertCmd.groovy b/src/main/groovy/m4e/ConvertCmd.groovy
index 62b37b5..afa42c8 100644
--- a/src/main/groovy/m4e/ConvertCmd.groovy
+++ b/src/main/groovy/m4e/ConvertCmd.groovy
@@ -18,7 +18,7 @@
The first argument is used to create a POM file with a dependencyManagement element.'''
- void run( String... args ) {
+ void doRun( String... args ) {
File downloads = new File( 'downloads' ).absoluteFile
if( !downloads.exists() ) {
throw new UserError( "Missing directory ${downloads}. Please create it and copy all files into it that you want to convert." )
@@ -40,8 +40,6 @@
mergeRepos()
- attachSources()
-
applyPatches( patches )
analyze()
@@ -98,12 +96,6 @@
mergeCounters( cmd )
}
- void attachSources() {
- def cmd = new AttachSourcesCmd( workDir: workDir )
- cmd.run( 'as', targetRepo.absolutePath )
- mergeCounters( cmd )
- }
-
void applyPatches( List<String> patches ) {
List args = [ 'ap', targetRepo.absolutePath ]
args.addAll( patches )
diff --git a/src/main/groovy/m4e/DependencyManagementCmd.groovy b/src/main/groovy/m4e/DependencyManagementCmd.groovy
index f5f8efe..27e0c1a 100644
--- a/src/main/groovy/m4e/DependencyManagementCmd.groovy
+++ b/src/main/groovy/m4e/DependencyManagementCmd.groovy
@@ -29,7 +29,7 @@
String artifactId
String version
- void run( String... args ) {
+ void doRun( String... args ) {
if( args.size() == 1 ) {
throw new UserError( 'Missing path to repository to analyze' )
}
diff --git a/src/main/groovy/m4e/DownloadCmd.groovy b/src/main/groovy/m4e/DownloadCmd.groovy
index f16828b..c463357 100644
--- a/src/main/groovy/m4e/DownloadCmd.groovy
+++ b/src/main/groovy/m4e/DownloadCmd.groovy
@@ -22,7 +22,7 @@
'''
@Override
- public void run( String... args ) {
+ public void doRun( String... args ) {
if( args.size() == 1 ) {
throw new UserError( 'Missing URLs to download' )
diff --git a/src/main/groovy/m4e/InstallCmd.groovy b/src/main/groovy/m4e/InstallCmd.groovy
index cba1ac8..20934c9 100644
--- a/src/main/groovy/m4e/InstallCmd.groovy
+++ b/src/main/groovy/m4e/InstallCmd.groovy
@@ -26,7 +26,7 @@
final static String DESCRIPTION = '''archives...\n- Extract the specified archives and convert the Eclipse plug-ins inside into Maven artifacts'''
- void run( String... args ) {
+ void doRun( String... args ) {
// args[1..-1] throws "IndexOutOfBoundsException: toIndex = 2" if array has only one element
if( args.size() > 1 ) {
for( String archive in args[1..-1] ) {
diff --git a/src/main/groovy/m4e/MergeCmd.groovy b/src/main/groovy/m4e/MergeCmd.groovy
index 9acf4c1..b33ce4d 100644
--- a/src/main/groovy/m4e/MergeCmd.groovy
+++ b/src/main/groovy/m4e/MergeCmd.groovy
@@ -17,7 +17,7 @@
final static String DESCRIPTION = '''directories... destination\n- Merge several Maven repositories into one.\n\nFor safety reasons, destination must not exist.'''
- void run( String... args ) {
+ void doRun( String... args ) {
if( args.size() < 2 ) {
throw new UserError( 'Missing repositories to merge' )
}
diff --git a/src/main/groovy/m4e/P2ListCmd.groovy b/src/main/groovy/m4e/P2ListCmd.groovy
index fb8174d..4024504 100644
--- a/src/main/groovy/m4e/P2ListCmd.groovy
+++ b/src/main/groovy/m4e/P2ListCmd.groovy
@@ -25,7 +25,7 @@
URL
- List the content of a P2 repository.'''
- void run( String... args ) {
+ void doRun( String... args ) {
def url = findURL( args )
log.info( 'Listing {}...', url )
diff --git a/src/main/groovy/m4e/PatchCmd.groovy b/src/main/groovy/m4e/PatchCmd.groovy
index bd97cba..a554afd 100644
--- a/src/main/groovy/m4e/PatchCmd.groovy
+++ b/src/main/groovy/m4e/PatchCmd.groovy
@@ -40,7 +40,7 @@
File target
PatchSet set
- void run( String... args ) {
+ void doRun( String... args ) {
if( args.size() == 1 ) {
throw new UserError( 'Missing path to repository to patch' )
}
diff --git a/src/main/groovy/m4e/ShowRepoCmd.groovy b/src/main/groovy/m4e/ShowRepoCmd.groovy
index 10c2bf0..6dbd29b 100644
--- a/src/main/groovy/m4e/ShowRepoCmd.groovy
+++ b/src/main/groovy/m4e/ShowRepoCmd.groovy
@@ -21,7 +21,7 @@
'''
@Override
- public void run( String... args ) {
+ public void doRun( String... args ) {
File repo = repoOption( args, 1 )
def view = new M2RepoView( repo: repo )
diff --git a/src/main/groovy/m4e/Tool.groovy b/src/main/groovy/m4e/Tool.groovy
index e6b43e7..c2bdf9b 100644
--- a/src/main/groovy/m4e/Tool.groovy
+++ b/src/main/groovy/m4e/Tool.groovy
@@ -120,7 +120,7 @@
final static String DESCRIPTION = '\n- Clean the work directory'
- void run( String... args ) {
+ void doRun( String... args ) {
assert workDir != null
log.info( 'Deleting {} and everything below', workDir )
diff --git a/src/main/groovy/m4e/UpdateImportExportDatabaseCmd.groovy b/src/main/groovy/m4e/UpdateImportExportDatabaseCmd.groovy
index 4e2d1bc..6047258 100644
--- a/src/main/groovy/m4e/UpdateImportExportDatabaseCmd.groovy
+++ b/src/main/groovy/m4e/UpdateImportExportDatabaseCmd.groovy
@@ -21,7 +21,7 @@
'''
@Override
- public void run( String... args ) {
+ public void doRun( String... args ) {
File repo = repoOption( args, 1 )
File dbPath = new File( repo, '.mt4e/importExportDB' )