diff --git a/app/conf/application.yml b/app/conf/application.yml
index 1f01b08..b44fe58 100644
--- a/app/conf/application.yml
+++ b/app/conf/application.yml
@@ -1,7 +1,8 @@
+---
grails:
- profile: plugin
+ profile: web
codegen:
- defaultPackage: org.graceframework.plugin.htmx
+ defaultPackage: grace.demos
gorm:
reactor:
# Whether to translate GORM events into Reactor events
@@ -42,3 +43,101 @@ environments:
management:
endpoints:
enabled-by-default: false
+
+---
+grails:
+ mime:
+ disable:
+ accept:
+ header:
+ userAgents:
+ - Gecko
+ - WebKit
+ - Presto
+ - Trident
+ types:
+ all: '*/*'
+ atom: application/atom+xml
+ css: text/css
+ csv: text/csv
+ form: application/x-www-form-urlencoded
+ html:
+ - text/html
+ - application/xhtml+xml
+ js: text/javascript
+ json:
+ - application/json
+ - text/json
+ multipartForm: multipart/form-data
+ pdf: application/pdf
+ rss: application/rss+xml
+ text: text/plain
+ hal:
+ - application/hal+json
+ - application/hal+xml
+ xml:
+ - text/xml
+ - application/xml
+ urlmapping:
+ cache:
+ maxsize: 1000
+ controllers:
+ defaultScope: singleton
+ converters:
+ encoding: UTF-8
+ views:
+ default:
+ codec: html
+ gsp:
+ encoding: UTF-8
+ htmlcodec: xml
+ codecs:
+ expression: html
+ scriptlet: html
+ taglib: none
+ staticparts: none
+
+---
+hibernate:
+ cache:
+ queries: false
+ use_second_level_cache: false
+ use_query_cache: false
+dataSource:
+ pooled: true
+ jmxExport: true
+ driverClassName: org.h2.Driver
+ username: sa
+ password: ''
+
+environments:
+ development:
+ dataSource:
+ dbCreate: create-drop
+ url: jdbc:h2:mem:devDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
+ test:
+ dataSource:
+ dbCreate: update
+ url: jdbc:h2:mem:testDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
+ production:
+ dataSource:
+ dbCreate: none
+ url: jdbc:h2:./prodDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
+ properties:
+ jmxEnabled: true
+ initialSize: 5
+ maxActive: 50
+ minIdle: 5
+ maxIdle: 25
+ maxWait: 10000
+ maxAge: 600000
+ timeBetweenEvictionRunsMillis: 5000
+ minEvictableIdleTimeMillis: 60000
+ validationQuery: SELECT 1
+ validationQueryTimeout: 3
+ validationInterval: 15000
+ testOnBorrow: true
+ testWhileIdle: true
+ testOnReturn: false
+ jdbcInterceptors: ConnectionState
+ defaultTransactionIsolation: 2 # TRANSACTION_READ_COMMITTED
diff --git a/app/conf/logback.xml b/app/conf/logback.xml
index 1fbae70..70b90e4 100644
--- a/app/conf/logback.xml
+++ b/app/conf/logback.xml
@@ -15,5 +15,6 @@
-
+
+
diff --git a/app/controllers/grace/demos/UrlMappings.groovy b/app/controllers/grace/demos/UrlMappings.groovy
new file mode 100644
index 0000000..e40fdec
--- /dev/null
+++ b/app/controllers/grace/demos/UrlMappings.groovy
@@ -0,0 +1,16 @@
+package grace.demos
+
+class UrlMappings {
+
+ static mappings = {
+ "/$controller/$action?/$id?(.$format)?"{
+ constraints {
+ // apply constraints here
+ }
+ }
+
+ "/"(view:"/index")
+ "500"(view:'/error')
+ "404"(view:'/notFound')
+ }
+}
diff --git a/app/init/org/graceframework/plugins/htmx/Application.groovy b/app/init/grace/demos/Application.groovy
similarity index 57%
rename from app/init/org/graceframework/plugins/htmx/Application.groovy
rename to app/init/grace/demos/Application.groovy
index d370f80..0cf6990 100644
--- a/app/init/org/graceframework/plugins/htmx/Application.groovy
+++ b/app/init/grace/demos/Application.groovy
@@ -1,9 +1,9 @@
-package org.graceframework.plugins.htmx
+package grace.demos
import grails.boot.Grails
-import grails.plugins.metadata.PluginSource
+import groovy.transform.CompileStatic
-@PluginSource
+@CompileStatic
class Application {
static void main(String[] args) {
diff --git a/app/init/org/graceframework/plugins/htmx/BootStrap.groovy b/app/init/grace/demos/BootStrap.groovy
similarity index 69%
rename from app/init/org/graceframework/plugins/htmx/BootStrap.groovy
rename to app/init/grace/demos/BootStrap.groovy
index a7873c4..80de1c7 100644
--- a/app/init/org/graceframework/plugins/htmx/BootStrap.groovy
+++ b/app/init/grace/demos/BootStrap.groovy
@@ -1,4 +1,4 @@
-package org.graceframework.plugins.htmx
+package grace.demos
class BootStrap {
diff --git a/build.gradle b/build.gradle
index 1afed38..e10bd19 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,48 +1,107 @@
buildscript {
repositories {
- // mavenLocal()
mavenCentral()
+ maven { url "https://repo.gradle.org/gradle/libs-releases" }
maven { url "https://plugins.gradle.org/m2/" }
- maven { url 'https://repo.gradle.org/gradle/libs-releases' }
}
dependencies {
classpath "io.github.gradle-nexus:publish-plugin:1.3.0"
+ classpath "org.graceframework:grace-gradle-plugin:$graceVersion"
+ classpath "com.github.erdi:webdriver-binaries-gradle-plugin:3.2"
+ classpath "org.graceframework.plugins:asset-pipeline-gradle:5.2.4"
}
}
-ext."signing.keyId" = project.hasProperty("signing.keyId") ? project.getProperty('signing.keyId') : System.getenv('SIGNING_KEY')
-ext."signing.password" = project.hasProperty("signing.password") ? project.getProperty('signing.password') : System.getenv('SIGNING_PASSPHRASE')
-ext."signing.secretKeyRingFile" = project.hasProperty("signing.secretKeyRingFile") ? project.getProperty('signing.secretKeyRingFile') : ("${System.properties['user.home']}${File.separator}.gnupg${File.separator}secring.gpg")
-ext.isReleaseVersion = !projectVersion.endsWith("SNAPSHOT")
-
-ext {
- springBootVersion = '2.6.6'
- servletVersion = '4.0.1'
-}
-
+group "grace.demos"
version projectVersion
-group "org.graceframework.plugins"
apply plugin: "eclipse"
apply plugin: "idea"
-apply plugin: "groovy"
+apply plugin: "war"
apply plugin: "io.github.gradle-nexus.publish-plugin"
-apply plugin: "maven-publish"
-apply plugin: "signing"
+apply plugin: "org.graceframework.grace-web"
+apply plugin: "com.github.erdi.webdriver-binaries"
+apply plugin: "org.graceframework.asset-pipeline"
+apply plugin: "org.graceframework.grace-gsp"
repositories {
mavenCentral()
}
+configurations {
+ developmentOnly
+}
+
+grails {
+ plugins {
+ implementation project(":plugin")
+ }
+}
+
dependencies {
- compileOnly "org.springframework.boot:spring-boot-autoconfigure:$springBootVersion"
- compileOnly "javax.servlet:javax.servlet-api:$servletVersion"
- compileOnly "org.graceframework:grace-core:$graceVersion"
- compileOnly "org.graceframework:grace-web-common:$graceVersion"
+ developmentOnly('org.springframework.boot:spring-boot-devtools')
+ compileOnly "io.micronaut:micronaut-inject-groovy"
+ console "org.graceframework:grace-console"
+ implementation "org.springframework.boot:spring-boot-starter-logging"
+ implementation "org.springframework.boot:spring-boot-starter-validation"
+ implementation "org.springframework.boot:spring-boot-autoconfigure"
+ implementation "org.graceframework:grace-core"
+ implementation "org.springframework.boot:spring-boot-starter-actuator"
+ implementation "org.springframework.boot:spring-boot-starter-tomcat"
+ implementation "org.graceframework:grace-boot"
+ implementation "org.graceframework:grace-logging"
+ implementation "org.graceframework:grace-plugin-controllers"
+ implementation "org.graceframework:grace-plugin-codecs"
+ implementation "org.graceframework:grace-plugin-databinding"
+ implementation "org.graceframework:grace-plugin-datasource"
+ implementation "org.graceframework:grace-plugin-domain-class"
+ implementation "org.graceframework:grace-plugin-i18n"
+ implementation "org.graceframework:grace-plugin-interceptors"
+ implementation "org.graceframework:grace-plugin-management"
+ implementation "org.graceframework:grace-plugin-rest"
+ implementation "org.graceframework:grace-plugin-services"
+ implementation "org.graceframework:grace-plugin-url-mappings"
+ implementation "org.graceframework.plugins:cache"
+ implementation "org.graceframework.plugins:async"
+ implementation "org.graceframework.plugins:scaffolding"
+ implementation "org.graceframework.plugins:fields"
+ implementation "org.graceframework.plugins:events"
+ implementation "org.graceframework.plugins:hibernate5"
+ implementation "org.hibernate:hibernate-core:5.6.15.Final"
+ implementation "org.graceframework:grace-plugin-gsp"
+ profile "org.graceframework.profiles:web"
+ runtimeOnly "com.h2database:h2"
+ runtimeOnly "org.apache.tomcat:tomcat-jdbc"
+ runtimeOnly "jakarta.xml.bind:jakarta.xml.bind-api:2.3.3"
+ runtimeOnly "jakarta.el:jakarta.el-api:3.0.3"
+ runtimeOnly "org.glassfish:jakarta.el:3.0.4"
+ runtimeOnly "org.graceframework.plugins:asset-pipeline-plugin:5.2.4"
+ testImplementation "io.micronaut:micronaut-inject-groovy"
+ testImplementation "org.graceframework:grace-test-support"
+ testImplementation "org.mockito:mockito-core"
+ testImplementation "org.graceframework.plugins:geb"
+ testImplementation "org.seleniumhq.selenium:selenium-remote-driver:4.2.2"
+ testImplementation "org.seleniumhq.selenium:selenium-api:4.2.2"
+ testImplementation "org.seleniumhq.selenium:selenium-support:4.2.2"
+ testRuntimeOnly "org.seleniumhq.selenium:selenium-chrome-driver:4.2.2"
+ testRuntimeOnly "org.seleniumhq.selenium:selenium-firefox-driver:4.2.2"
+}
+
+java {
+ sourceCompatibility = JavaVersion.VERSION_11
+ targetCompatibility = JavaVersion.VERSION_11
}
-tasks.withType(Sign) {
- onlyIf { isReleaseVersion }
+bootRun {
+ ignoreExitValue true
+ jvmArgs(
+ '-Dspring.output.ansi.enabled=always',
+ '-noverify',
+ '-XX:TieredStopAtLevel=1',
+ '-Xmx1024m')
+ sourceResources sourceSets.main
+ String springProfilesActive = 'spring.profiles.active'
+ systemProperty springProfilesActive, System.getProperty(springProfilesActive)
}
tasks.withType(GroovyCompile) {
@@ -55,70 +114,25 @@ tasks.withType(Test) {
useJUnitPlatform()
}
-java {
- toolchain {
- languageVersion = JavaLanguageVersion.of(8)
+webdriverBinaries {
+ chromedriver {
+ version = '122.0.6260.0'
+ fallbackTo32Bit = true
}
- withJavadocJar()
- withSourcesJar()
+ geckodriver '0.33.0'
}
-jar {
- duplicatesStrategy = DuplicatesStrategy.INCLUDE
- manifest.mainAttributes(
- "Built-By": System.properties['user.name'],
- "Created-By": System.properties['java.vm.version'] + " (" + System.properties['java.vm.vendor'] + ")",
- "Implementation-Title": "Grace Htmx Plugin",
- "Implementation-Version": projectVersion,
- "Implementation-Vendor": 'Grace Plugins')
- enabled = true
- archiveClassifier.set('')
- includeEmptyDirs = false
+tasks.withType(Test) {
+ useJUnitPlatform()
+ systemProperty "geb.env", System.getProperty('geb.env')
+ systemProperty "geb.build.reportsDir", reporting.file("geb/integrationTest")
+ systemProperty 'webdriver.chrome.driver', System.getProperty('webdriver.chrome.driver')
+ systemProperty 'webdriver.gecko.driver', System.getProperty('webdriver.gecko.driver')
}
-publishing {
- publications {
- maven(MavenPublication) {
- groupId = project.group
- artifactId = project.name
- version = project.version
-
- versionMapping {
- usage('java-api') {
- fromResolutionOf('runtimeClasspath')
- }
- usage('java-runtime') {
- fromResolutionResult()
- }
- }
-
- from components.java
-
- pom {
- name = "Grace Htmx Plugin"
- description = "Grace Plugin for using Grace with htmx."
- url = 'https://github.com/grace-plugins/grace-htmx'
- licenses {
- license {
- name = 'The Apache License, Version 2.0'
- url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
- }
- }
- developers {
- developer {
- id = 'rainboyan'
- name = 'Michael Yan'
- email = 'rain@rainboyan.com'
- }
- }
- scm {
- connection = 'scm:git:git://github.com/grace-plugins/grace-htmx.git'
- developerConnection = 'scm:git:ssh://github.com:grace-plugins/grace-htmx.git'
- url = 'https://github.com/grace-plugins/grace-htmx'
- }
- }
- }
- }
+assets {
+ minifyJs = true
+ minifyCss = true
}
nexusPublishing {
@@ -135,10 +149,3 @@ nexusPublishing {
}
}
}
-
-afterEvaluate {
- signing {
- required { isReleaseVersion && gradle.taskGraph.hasTask("publish") }
- sign publishing.publications.maven
- }
-}
diff --git a/gradle.properties b/gradle.properties
index f22bcda..6e5b4fd 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,6 +1,6 @@
projectVersion=0.5.0-SNAPSHOT
-graceVersion=2020.0.0
-groovyVersion=3.0.11
+graceVersion=2022.2.4
+groovyVersion=3.0.17
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx1024M
diff --git a/settings.gradle b/settings.gradle
index 8a72a34..60e1a56 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1 +1,3 @@
-rootProject.name = 'htmx'
+rootProject.name = 'grace-htmx'
+
+include 'plugin'
diff --git a/src/integration-test/resources/GebConfig.groovy b/src/integration-test/resources/GebConfig.groovy
new file mode 100644
index 0000000..0d97e35
--- /dev/null
+++ b/src/integration-test/resources/GebConfig.groovy
@@ -0,0 +1,25 @@
+import org.openqa.selenium.chrome.ChromeDriver
+import org.openqa.selenium.chrome.ChromeOptions
+import org.openqa.selenium.firefox.FirefoxDriver
+
+environments {
+
+ // run via “./gradlew -Dgeb.env=chrome iT”
+ chrome {
+ driver = { new ChromeDriver() }
+ }
+
+ // run via “./gradlew -Dgeb.env=chromeHeadless iT”
+ chromeHeadless {
+ driver = {
+ ChromeOptions o = new ChromeOptions()
+ o.addArguments('headless')
+ new ChromeDriver(o)
+ }
+ }
+
+ // run via “./gradlew -Dgeb.env=firefox iT”
+ firefox {
+ driver = { new FirefoxDriver() }
+ }
+}
diff --git a/src/main/groovy/.gitkeep b/src/main/groovy/.gitkeep
new file mode 100644
index 0000000..e69de29