Upload
kiyotaka-oku
View
1.204
Download
0
Embed Size (px)
Citation preview
GroovyConsoleで遊ぶ第16回 G*ワークショップ
自己紹介
奥清隆(おくきよたか)
id:kiy0taka、@kiy0taka
JGGUG関西支部
Jenkinsプラグインとか
Terminal、jQuery、MongoDB
著書
の
※ イメージです。
技術評論社
「モテる」Groovy!
実際、何もやってませんが
いただきます!
申し訳ないので
もう一冊買う?
保存用?
観賞用?
いや、、、
転売用!
GroovyConsoleで遊ぶ
GroovyConsole
Groovyをインストールすると使える便利ツール
コードを書いてすぐ試せる
ASTとかも確認できる
GroovyConsoleの中身
groovy.ui.Console
ツールというよりGroovy本体の1クラス
groovy-all.jarがあればいい
Grapeできないけど...
GroovyConsoleの実行
groovyConsole
java -jar groovy-all.jar groovy.ui.Console
groovy -e "new groovy.ui.Console().run()"
拡張してみる
メニューを追加してみるrun()
void run() { run(frameConsoleDelegates)}
void run(Map defaults) { …}
frameConsoleDelegates
static def frameConsoleDelegates = [ rootContainerDelegate: { … } menuBarDelegate: {arg-> current.JMenuBar = build(arg) }];
独自メニューを用意する
def myMenu = { menu(text:'JGGUG') { menuItem('Hello', actionPerformed: { JOptionPane.showMessageDialog(null, 'Hello!') }) }}
メニューを追加する
new Console().run( Console.frameConsoleDelegates << [menuBarDelegate: {arg-> current.JMenuBar = build(arg) current.JMenuBar.add(build(myMenu)) }])
処理を追加する
スクリプト実行前後
beforeExecution
afterExecution
new Console( beforeExecution: { ... }, afterExecution: { ... })
その他
あとは必要に応じてよろしくやってください。
サンプル
GroovyConsole on Jenkins
https://gist.github.com/843507
MoteConsole
https://gist.github.com/1031115
おまけ
GROOVY_SOURCE_EXTENSIONS = ['*.groovy', '*.gvy', '*.gy', '*.gsh']
Groovyの拡張子