-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for a Jenkins version argument (CLI and env var) + Make J…
…enkins WAR parameter optional in the Plugin Manager Lib API and the implementation (#232) * Add support for a Jenkins version argument (CLI and env var) * Make Jenkins WAR option in the Plugin Manager Lib API and the implementation * Simplify the version number parser, add test * Rename the argument to follow the naming pattern * Remove unused import
- Loading branch information
1 parent
9156665
commit 0adab4b
Showing
8 changed files
with
160 additions
and
12 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
31 changes: 31 additions & 0 deletions
31
...management-cli/src/main/java/io/jenkins/tools/pluginmanager/cli/VersionNumberHandler.java
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package io.jenkins.tools.pluginmanager.cli; | ||
|
||
import hudson.util.VersionNumber; | ||
import org.kohsuke.args4j.CmdLineException; | ||
import org.kohsuke.args4j.CmdLineParser; | ||
import org.kohsuke.args4j.OptionDef; | ||
import org.kohsuke.args4j.spi.OneArgumentOptionHandler; | ||
import org.kohsuke.args4j.spi.Setter; | ||
|
||
// TODO(oleg_nenashev): Move to the VersionNumber lib? | ||
|
||
public class VersionNumberHandler extends OneArgumentOptionHandler<VersionNumber> { | ||
|
||
public VersionNumberHandler(CmdLineParser parser, OptionDef option, Setter<VersionNumber> setter) { | ||
super(parser, option, setter); | ||
} | ||
|
||
@Override | ||
protected VersionNumber parse(String argument) throws NumberFormatException, CmdLineException { | ||
try { | ||
return new VersionNumber(argument); | ||
} catch (Exception ex) { | ||
throw new CmdLineException("Failed to parse the version number", ex); | ||
} | ||
} | ||
|
||
@Override | ||
public String getDefaultMetaVariable() { | ||
return null; | ||
} | ||
} |
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
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