私にとっての答えは、groovy/GANT スクリプトを作成し、コマンド ラインから実行することでした。
私のプラグインにはscripts
ディレクトリがあり、そこに というスクリプトを作成しましたDeploy.groovy
。
コマンドの実行
grails deploy
このスクリプトを自動的に実行します。このスクリプトは、組み込みの grails ターゲットを使用してプラグインをパッケージ化し、コマンドラインから grails コマンドを実行します。
plugin-home/scripts/Deploy.groovy
includeTargets << grailsScript("PackagePlugin_")
includeTool << gant.tools.Execute
target(main: "This is the script that tries to test what's going on...") {
println ("1. Package the plugin")
packagePlugin()
println ("2. Confirm the directory")
execute.shell("cd ~/quirk-projects/admin-cms-plugin-test && pwd")
println ("3. Remove the plugin ")
execute.shell("cd ~/quirk-projects/admin-cms-plugin-test && grails uninstall-plugin grails-admin-cms-plugin")
println ("4. Install the plugin ")
execute.shell("cd ~/quirk-projects/admin-cms-plugin-test && grails install-plugin ../admin-cms-plugin/grails-admin-cms-plugin-0.1.zip")
println ("5. Run Application")
execute.shell("cd ~/quirk-projects/admin-cms-plugin-test && grails run-app")
println ("6. Your plugin is ready for testing...")
}
setDefaultTarget(main)
インクリメントするには、ソース ファイルを編集してバージョン番号をインクリメントするだけのスクリプトを作成しました。
plugin-home/scripts/_Events.groovy
eventCompileStart = { kind ->
println("Incrementing Version Number for next time")
def version = metadata.'version'
if (!version) {
version = '1'
} else {
version = version.toInteger() + 1
}
metadata.'version' = version.toString()
metadata.persist()
def file = new File("${basedir}/AdminCmsPluginGrailsPlugin.groovy")
def script = file.text
def array = script.split("\n")
for (int i = 0 ; i < array.length; i++) {
if (array[i].indexOf("def version") > -1) {
array[i] = " def version = 0." + version
}
}
def newScript = array.join(System.getProperty("line.separator"))
file.text = newScript
}