@@ -37,6 +37,7 @@ import org.eclipse.jgit.api.Git
3737@CompileStatic
3838@Parameters (commandDescription = " Execute plugin-specific commands" )
3939class CmdPlugin extends CmdBase {
40+ private static String DEFAULT_TEMPLATE_TAG = ' v0.2.1'
4041
4142 @Override
4243 String getName () {
@@ -64,7 +65,7 @@ class CmdPlugin extends CmdBase {
6465 Plugins . pull(args[1 ]. tokenize(' ,' ))
6566 }
6667 else if ( args[0 ] == ' create' ) {
67- createPlugin(args)
68+ createPlugin(args, params . get( ' tag ' , DEFAULT_TEMPLATE_TAG ) )
6869 }
6970 // plugin run command
7071 else if ( args[0 ]. contains(CMD_SEP ) ) {
@@ -98,7 +99,7 @@ class CmdPlugin extends CmdBase {
9899 }
99100 }
100101
101- static createPlugin (List<String > args ) {
102+ static createPlugin (List<String > args , String tag ) {
102103 if ( args != [' create' ] && (args[0 ] != ' create' || ! (args. size() in [3 , 4 ])) )
103104 throw new AbortOperationException (" Invalid create parameters - usage: nextflow plugin create <Plugin name> <Organization name>" )
104105
@@ -132,7 +133,7 @@ class CmdPlugin extends CmdBase {
132133 final File targetDir = refactor. getPluginDir()
133134
134135 // clone the template repo
135- clonePluginTemplate(targetDir)
136+ clonePluginTemplate(targetDir, tag )
136137 // now refactor the template code
137138 refactor. apply()
138139 // remove git plat
@@ -148,14 +149,14 @@ class CmdPlugin extends CmdBase {
148149 : new BufferedReader (new InputStreamReader (System . in )). readLine()
149150 }
150151
151- static private void clonePluginTemplate (File targetDir ) {
152+ static private void clonePluginTemplate (File targetDir , String tag ) {
152153 final templateUri = " https://github.com/nextflow-io/nf-plugin-template.git"
153154 try {
154155 Git . cloneRepository()
155156 .setURI(templateUri)
156157 .setDirectory(targetDir)
157- .setBranchesToClone([" refs/tags/v0.2.0 " ])
158- .setBranch(" refs/tags/v0.2.0 " )
158+ .setBranchesToClone([" refs/tags/$t ag " . toString() ])
159+ .setBranch(" refs/tags/$t ag " )
159160 .call()
160161 }
161162 catch (Exception e) {
0 commit comments