Created
December 6, 2010 12:19
-
-
Save calavera/730210 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class MirahInterpreter < CommandInterpreter | |
$Extension | |
def self.getExtension | |
@@extension ||= DescriptorImpl.new(MirahInterpreter.class) | |
end | |
$DataBoundConstructor | |
def initialize(command:String, verbose:boolean) | |
super(command) | |
@verbose = verbose | |
end | |
def buildCommandLine(script:FilePath) | |
verbose_arg = @verbose ? '--verbose' : '' | |
list = ['mirah', verbose_arg, script.getRemote] | |
strings = String[list.size] | |
list.size.times { |i| strings[i] = String(list.get(i)) } | |
strings | |
end | |
def isVerbose | |
@verbose | |
end | |
def getFileExtension | |
".mirah" | |
end | |
def getDescriptor | |
@@extension | |
end | |
def getContents | |
getCommand | |
end | |
class DescriptorImpl < BuilderStepDescriptor | |
def initialize(clazz:Class) | |
super(clazz) | |
end | |
def newInstance(req:StaplerRequest, data:JSONObject):Builder | |
MirahInterpreter.new(data.getString('command'), data.getBoolean('verbose')) | |
end | |
def getDisplayName | |
"Execute Mirah script" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment