Compare commits

..

No commits in common. "master" and "v0.4.1" have entirely different histories.

55 changed files with 664 additions and 264 deletions

View File

@ -1,28 +0,0 @@
name: Ssg Check, Publish, and Release
on:
push:
tags:
- v*
jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v4
- name: Setup Java.
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
- name: Check libraries
run: ./gradlew check
- name: Publish to git.jessebrault.com
run: ./gradlew publishAllPublicationsToGiteaRepository
- name: Create install distribution
run: ./gradlew installDist
- name: Release cli to git.jessebrault.com
uses: akkuman/gitea-release-action@v1
with:
files: |-
cli/build/distributions/*.tar
cli/build/distributions/*.zip

29
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,29 @@
name: StaticSiteGenerator Release
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: adopt
cache: gradle
- name: Gradle Test
run: ./gradlew test
- name: Gradle Install
run: ./gradlew :cli:assembleDist
- name: Release
uses: ncipollo/release-action@v1
with:
artifacts: 'cli/build/distributions/*.tar,cli/build/distributions/*.zip'
name: ${{ env.GITHUB_REF_NAME }}
tag: ${{ env.GITHUB_REF_NAME }}
token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -0,0 +1,16 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="debug-test-project" type="Remote">
<module name="ssg" />
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" />
<option name="HOST" value="localhost" />
<option name="PORT" value="8192" />
<option name="AUTO_RESTART" value="false" />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="8192" />
<option name="LOCAL" value="false" />
</RunnerSettings>
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,19 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="launch-debug-test-project" type="ShConfigurationType">
<option name="SCRIPT_TEXT" value="" />
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
<option name="SCRIPT_PATH" value="$PROJECT_DIR$/test-ssg-project/bin/ssg" />
<option name="SCRIPT_OPTIONS" value="--debug build -g --dry-run -b default" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$/test-ssg-project" />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="/usr/bin/env" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="EXECUTE_IN_TERMINAL" value="true" />
<option name="EXECUTE_SCRIPT_FILE" value="true" />
<envs />
<method v="2">
<option name="Gradle.BeforeRunTask" enabled="true" tasks="publishToMavenLocal" externalProjectPath="$PROJECT_DIR$" vmOptions="" scriptParameters="" />
</method>
</configuration>
</component>

View File

@ -0,0 +1,19 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="run-test-project" type="ShConfigurationType">
<option name="SCRIPT_TEXT" value="" />
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
<option name="SCRIPT_PATH" value="$PROJECT_DIR$/test-ssg-project/bin/ssg" />
<option name="SCRIPT_OPTIONS" value="build --log-level=debug --gradle --dry-run --build default" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$/test-ssg-project" />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="/usr/bin/env" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="EXECUTE_IN_TERMINAL" value="false" />
<option name="EXECUTE_SCRIPT_FILE" value="true" />
<envs />
<method v="2">
<option name="Gradle.BeforeRunTask" enabled="true" tasks="publishToMavenLocal" externalProjectPath="$PROJECT_DIR$" vmOptions="" scriptParameters="" />
</method>
</configuration>
</component>

View File

@ -1,16 +0,0 @@
# Static Site Generator (SSG)
## Updating Gradle
Update the Gradle wrapper via `gradle/wrapper/gradle-wrapper.properties`. Make sure that the tooling-api dependency is
updated to the same version in `cli/build.gradle`.
## Version-bumping
Update the version of the project in `buildSrc/src/main/groovy/ssg-common.gradle`. Then update the references to the
`cli` and `api` projects in `ssg-gradle-plugin/src/main/java/com/jessebrault/ssg/gradle/SsgGradlePlugin.java`.
## Publishing
Gradle command `publishAllPublicationsToJbArchiva<Internal|Snapshots>Repository`. Which one of `internal` or `snapshots`
appears depends on the current version.

59
TODO.md
View File

@ -1,41 +1,52 @@
# TODO # TODO
Here will be kept all of the various todos for this project, organized by release. Here will be kept all of the various todos for this project, organized by release.
N.b. that v0.3.0 was skipped because of such a fundamental change in the usage of the
program with the incorporation of Groowt and Web View Components.
## 0.6.0 ## 0.4.2
- [ ] Plugin system for build scripts
## 0.5.0
- [ ] watch/dev mode and server
- [ ] Reorganize gradle project layout so there is less hunting around for files
## 0.4.* Ongoing
- [ ] Automate test project
- [ ] Move as much gradle integration from `cli` project to `api` project
- [ ] Think about abstracting the build tool logic, because all we need
really is the URLs/Paths for the classes/jars of components and resources
- [ ] Document new api and usage.
- [ ] Re-incorporate dist plugin in gradle build of cli/api
- [ ] Think about how these might be used without a gradle project backing
## 0.4.3
- [ ] `Text` component for simply rendering Text objects. Can be used as such: - [ ] `Text` component for simply rendering Text objects. Can be used as such:
``` ```
<Text path='/SomeText.md' /> <Text path='/SomeText.md' />
<Text name='SomeText.md' /> <Text name='SomeText.md' />
<Text text={text} /> <Text text={text} />
``` ```
- [ ] `TextContainer` for accessing all found texts
- [ ] `ModelFactory` for creating models, and `TextModelFactory` for creating models from texts.
- [ ] `Model` component for rendering a model with either a supplied renderer, or a registered `ModelRenderer`
- [ ] `Global` component for rendering globals.
- [ ] Automatically inject self PageSpec and path to Pages.
## 0.4.1 ## 0.4.1
- [x] Update groowt to 0.1.2. - [x] Update groowt to 0.1.2.
## Future
### Add
- [ ] Plan out plugin system such that we can create custom providers of texts, data, etc.
- [ ] Add `Watchable` interface/trait back; an abstraction over FS watching and other sources (such as a database, etc.).
- [ ] Explore `apply(Plugin)` in buildScripts.
### Fix
## v0.2.0
### Add
- [ ] Write manual.
- [x] Remove `lib` module.
- [x] Add a way for CLI to choose a build to do, or multiple builds, defaulting to 'default' if it exists.
- [ ] Still must work on 'default'-ing.
- [x] Write lots of tests for buildscript dsl, etc.
- [x] Explore `base` in buildScript dsl.
- Get rid of `allBuilds` concept, and replace it with composable/concat-able builds. In the dsl we could have a notion of `abstractBuild` which can be 'extended' (i.e., on the left side of a concat operation) but not actually run (since it doesn't have a name).
- `OutputDir` should be concat-able, such that the left is the *base* for the right.
- `OutputDirFunctions.concat` should be concat-able as well, such that both are `BiFunction<OutputDir, Build, OutputDir>`, and the output of the left is the input of the right.
- Make the delegates as dumb as possible; no more `getResult` methods; make different classes/object handle concat'ing and getting results.
- [x] Provide a way to override `ssgBuilds` variables from the cli.
### Fix
- [ ] Update CHANGELOG to reflect the gsp-dsl changes.
- [ ] `taskTypes` gone, use class name instead
- [ ] introduction of `models`
- [x] Change most instances of `Closure<Void>` to `Closure<?>` to help with IDE expectations.
- [ ] Fix auto-imports in build script so we don't need to import things.
- [x] Re-introduce input/output concept to tasks, if possible
## Finished
### v0.2.0 ### v0.2.0
- [x] Investigate imports, including static, in scripts - [x] Investigate imports, including static, in scripts
- Does not work; must use binding - Does not work; must use binding

View File

@ -8,6 +8,7 @@ plugins {
repositories { repositories {
mavenCentral() mavenCentral()
mavenLocal()
} }
configurations { configurations {
@ -19,12 +20,7 @@ configurations {
dependencies { dependencies {
api libs.groovy api libs.groovy
api libs.groovy.yaml api libs.groovy.yaml
api libs.groowt.all
api libs.groowt.v
api libs.groowt.vc
api libs.groowt.wvc
api libs.di
api libs.fp
compileOnlyApi libs.jetbrains.anontations compileOnlyApi libs.jetbrains.anontations
@ -33,7 +29,7 @@ dependencies {
implementation libs.commonmark.frontmatter implementation libs.commonmark.frontmatter
implementation libs.jsoup implementation libs.jsoup
runtimeOnly libs.groowt.wvcc runtimeOnly libs.groowt.wvcCompiler
} }
java { java {
@ -44,14 +40,10 @@ jar {
archivesBaseName = 'ssg-api' archivesBaseName = 'ssg-api'
} }
sourcesJar {
archiveBaseName = 'ssg-api'
}
publishing { publishing {
publications { publications {
create('ssgApi', MavenPublication) { create('ssgApi', MavenPublication) {
artifactId = 'api' artifactId = 'ssg-api'
from components.java from components.java
} }
} }

View File

@ -16,9 +16,10 @@ import com.jessebrault.ssg.view.SkipTemplate
import com.jessebrault.ssg.view.WvcCompiler import com.jessebrault.ssg.view.WvcCompiler
import com.jessebrault.ssg.view.WvcPageView import com.jessebrault.ssg.view.WvcPageView
import groovy.transform.TupleConstructor import groovy.transform.TupleConstructor
import com.jessebrault.di.ObjectFactory import groowt.util.di.ObjectFactory
import com.jessebrault.di.RegistryObjectFactory import groowt.util.di.RegistryObjectFactory
import com.jessebrault.fp.option.Option import groowt.util.fp.option.Option
import groowt.view.component.compiler.DefaultComponentTemplateCompilerConfiguration
import groowt.view.component.compiler.SimpleComponentTemplateClassFactory import groowt.view.component.compiler.SimpleComponentTemplateClassFactory
import groowt.view.component.factory.ComponentFactories import groowt.view.component.factory.ComponentFactories
import groowt.view.component.web.DefaultWebViewComponentContext import groowt.view.component.web.DefaultWebViewComponentContext
@ -32,8 +33,8 @@ import org.slf4j.LoggerFactory
import java.nio.file.Files import java.nio.file.Files
import java.nio.file.Path import java.nio.file.Path
import static com.jessebrault.di.BindingUtil.named import static groowt.util.di.BindingUtil.named
import static com.jessebrault.di.BindingUtil.toSingleton import static groowt.util.di.BindingUtil.toSingleton
@TupleConstructor(includeFields = true, defaults = false) @TupleConstructor(includeFields = true, defaults = false)
class DefaultStaticSiteGenerator implements StaticSiteGenerator { class DefaultStaticSiteGenerator implements StaticSiteGenerator {
@ -71,7 +72,10 @@ class DefaultStaticSiteGenerator implements StaticSiteGenerator {
} }
protected WvcCompiler getWvcCompiler() { protected WvcCompiler getWvcCompiler() {
new WvcCompiler(this.groovyClassLoader, new SimpleComponentTemplateClassFactory(this.groovyClassLoader)) def wvcCompilerConfiguration = new DefaultComponentTemplateCompilerConfiguration()
wvcCompilerConfiguration.groovyClassLoader = this.groovyClassLoader
def templateClassFactory = new SimpleComponentTemplateClassFactory(this.groovyClassLoader)
new WvcCompiler(wvcCompilerConfiguration, templateClassFactory)
} }
protected WebViewComponentContext makeContext( protected WebViewComponentContext makeContext(

View File

@ -4,8 +4,8 @@ import com.jessebrault.ssg.model.Model
import com.jessebrault.ssg.text.TextConverter import com.jessebrault.ssg.text.TextConverter
import groovy.transform.EqualsAndHashCode import groovy.transform.EqualsAndHashCode
import groovy.transform.NullCheck import groovy.transform.NullCheck
import com.jessebrault.di.RegistryObjectFactory import groowt.util.di.RegistryObjectFactory
import com.jessebrault.fp.provider.Provider import groowt.util.fp.provider.Provider
import static com.jessebrault.ssg.util.ObjectUtil.requireProvider import static com.jessebrault.ssg.util.ObjectUtil.requireProvider
import static com.jessebrault.ssg.util.ObjectUtil.requireString import static com.jessebrault.ssg.util.ObjectUtil.requireString

View File

@ -5,13 +5,13 @@ import com.jessebrault.ssg.model.Models
import com.jessebrault.ssg.text.MarkdownTextConverter import com.jessebrault.ssg.text.MarkdownTextConverter
import com.jessebrault.ssg.text.TextConverter import com.jessebrault.ssg.text.TextConverter
import com.jessebrault.ssg.util.PathUtil import com.jessebrault.ssg.util.PathUtil
import com.jessebrault.di.DefaultRegistryObjectFactory import groowt.util.di.DefaultRegistryObjectFactory
import com.jessebrault.di.RegistryObjectFactory import groowt.util.di.RegistryObjectFactory
import com.jessebrault.fp.property.DefaultProperty import groowt.util.fp.property.DefaultProperty
import com.jessebrault.fp.property.Property import groowt.util.fp.property.Property
import com.jessebrault.fp.provider.DefaultProvider import groowt.util.fp.provider.DefaultProvider
import com.jessebrault.fp.provider.NamedProvider import groowt.util.fp.provider.NamedProvider
import com.jessebrault.fp.provider.Provider import groowt.util.fp.provider.Provider
import java.nio.file.Path import java.nio.file.Path
import java.util.function.Supplier import java.util.function.Supplier

View File

@ -1,11 +1,11 @@
package com.jessebrault.ssg.di package com.jessebrault.ssg.di
import groovy.transform.TupleConstructor import groovy.transform.TupleConstructor
import com.jessebrault.di.Binding import groowt.util.di.Binding
import com.jessebrault.di.QualifierHandler import groowt.util.di.QualifierHandler
import com.jessebrault.di.QualifierHandlerContainer import groowt.util.di.QualifierHandlerContainer
import com.jessebrault.di.RegistryExtension import groowt.util.di.RegistryExtension
import com.jessebrault.di.SingletonBinding import groowt.util.di.SingletonBinding
import java.lang.annotation.Annotation import java.lang.annotation.Annotation

View File

@ -1,9 +1,9 @@
package com.jessebrault.ssg.di package com.jessebrault.ssg.di
import groovy.transform.TupleConstructor import groovy.transform.TupleConstructor
import com.jessebrault.di.Binding import groowt.util.di.Binding
import com.jessebrault.di.QualifierHandler import groowt.util.di.QualifierHandler
import com.jessebrault.di.SingletonBinding import groowt.util.di.SingletonBinding
@TupleConstructor(includeFields = true) @TupleConstructor(includeFields = true)
class InjectModelQualifierHandler implements QualifierHandler<InjectModel> { class InjectModelQualifierHandler implements QualifierHandler<InjectModel> {

View File

@ -1,9 +1,9 @@
package com.jessebrault.ssg.di package com.jessebrault.ssg.di
import groovy.transform.TupleConstructor import groovy.transform.TupleConstructor
import com.jessebrault.di.Binding import groowt.util.di.Binding
import com.jessebrault.di.QualifierHandler import groowt.util.di.QualifierHandler
import com.jessebrault.di.SingletonBinding import groowt.util.di.SingletonBinding
@TupleConstructor(includeFields = true) @TupleConstructor(includeFields = true)
class InjectModelsQualifierHandler implements QualifierHandler<InjectModels> { class InjectModelsQualifierHandler implements QualifierHandler<InjectModels> {

View File

@ -2,9 +2,9 @@ package com.jessebrault.ssg.di
import com.jessebrault.ssg.page.Page import com.jessebrault.ssg.page.Page
import groovy.transform.TupleConstructor import groovy.transform.TupleConstructor
import com.jessebrault.di.Binding import groowt.util.di.Binding
import com.jessebrault.di.QualifierHandler import groowt.util.di.QualifierHandler
import com.jessebrault.di.SingletonBinding import groowt.util.di.SingletonBinding
@TupleConstructor(includeFields = true) @TupleConstructor(includeFields = true)
class InjectPageQualifierHandler implements QualifierHandler<InjectPage> { class InjectPageQualifierHandler implements QualifierHandler<InjectPage> {

View File

@ -3,9 +3,9 @@ package com.jessebrault.ssg.di
import com.jessebrault.ssg.page.Page import com.jessebrault.ssg.page.Page
import com.jessebrault.ssg.util.Glob import com.jessebrault.ssg.util.Glob
import groovy.transform.TupleConstructor import groovy.transform.TupleConstructor
import com.jessebrault.di.Binding import groowt.util.di.Binding
import com.jessebrault.di.QualifierHandler import groowt.util.di.QualifierHandler
import com.jessebrault.di.SingletonBinding import groowt.util.di.SingletonBinding
@TupleConstructor(includeFields = true) @TupleConstructor(includeFields = true)
class InjectPagesQualifierHandler implements QualifierHandler<InjectPages> { class InjectPagesQualifierHandler implements QualifierHandler<InjectPages> {

View File

@ -2,9 +2,9 @@ package com.jessebrault.ssg.di
import com.jessebrault.ssg.text.Text import com.jessebrault.ssg.text.Text
import groovy.transform.TupleConstructor import groovy.transform.TupleConstructor
import com.jessebrault.di.Binding import groowt.util.di.Binding
import com.jessebrault.di.QualifierHandler import groowt.util.di.QualifierHandler
import com.jessebrault.di.SingletonBinding import groowt.util.di.SingletonBinding
@TupleConstructor(includeFields = true) @TupleConstructor(includeFields = true)
class InjectTextQualifierHandler implements QualifierHandler<InjectText> { class InjectTextQualifierHandler implements QualifierHandler<InjectText> {

View File

@ -3,9 +3,9 @@ package com.jessebrault.ssg.di
import com.jessebrault.ssg.text.Text import com.jessebrault.ssg.text.Text
import com.jessebrault.ssg.util.Glob import com.jessebrault.ssg.util.Glob
import groovy.transform.TupleConstructor import groovy.transform.TupleConstructor
import com.jessebrault.di.Binding import groowt.util.di.Binding
import com.jessebrault.di.QualifierHandler import groowt.util.di.QualifierHandler
import com.jessebrault.di.SingletonBinding import groowt.util.di.SingletonBinding
@TupleConstructor(includeFields = true) @TupleConstructor(includeFields = true)
class InjectTextsQualifierHandler implements QualifierHandler<InjectTexts> { class InjectTextsQualifierHandler implements QualifierHandler<InjectTexts> {

View File

@ -1,9 +1,9 @@
package com.jessebrault.ssg.di package com.jessebrault.ssg.di
import com.jessebrault.ssg.model.Model import com.jessebrault.ssg.model.Model
import com.jessebrault.di.QualifierHandler import groowt.util.di.QualifierHandler
import com.jessebrault.di.QualifierHandlerContainer import groowt.util.di.QualifierHandlerContainer
import com.jessebrault.di.RegistryExtension import groowt.util.di.RegistryExtension
import java.lang.annotation.Annotation import java.lang.annotation.Annotation

View File

@ -1,9 +1,9 @@
package com.jessebrault.ssg.di package com.jessebrault.ssg.di
import com.jessebrault.ssg.page.Page import com.jessebrault.ssg.page.Page
import com.jessebrault.di.QualifierHandler import groowt.util.di.QualifierHandler
import com.jessebrault.di.QualifierHandlerContainer import groowt.util.di.QualifierHandlerContainer
import com.jessebrault.di.RegistryExtension import groowt.util.di.RegistryExtension
import java.lang.annotation.Annotation import java.lang.annotation.Annotation

View File

@ -2,7 +2,7 @@ package com.jessebrault.ssg.di
import com.jessebrault.ssg.page.Page import com.jessebrault.ssg.page.Page
import groovy.transform.TupleConstructor import groovy.transform.TupleConstructor
import com.jessebrault.di.* import groowt.util.di.*
import java.lang.annotation.Annotation import java.lang.annotation.Annotation

View File

@ -1,6 +1,6 @@
package com.jessebrault.ssg.di; package com.jessebrault.ssg.di;
import com.jessebrault.di.*; import groowt.util.di.*;
import jakarta.inject.Named; import jakarta.inject.Named;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;

View File

@ -1,7 +1,7 @@
package com.jessebrault.ssg.di package com.jessebrault.ssg.di
import com.jessebrault.di.DefaultRegistryObjectFactory import groowt.util.di.DefaultRegistryObjectFactory
import com.jessebrault.di.RegistryObjectFactory import groowt.util.di.RegistryObjectFactory
final class SsgObjectFactoryUtil { final class SsgObjectFactoryUtil {

View File

@ -1,9 +1,9 @@
package com.jessebrault.ssg.di package com.jessebrault.ssg.di
import com.jessebrault.ssg.text.Text import com.jessebrault.ssg.text.Text
import com.jessebrault.di.QualifierHandler import groowt.util.di.QualifierHandler
import com.jessebrault.di.QualifierHandlerContainer import groowt.util.di.QualifierHandlerContainer
import com.jessebrault.di.RegistryExtension import groowt.util.di.RegistryExtension
import java.lang.annotation.Annotation import java.lang.annotation.Annotation

View File

@ -1,7 +1,7 @@
package com.jessebrault.ssg.model package com.jessebrault.ssg.model
import com.jessebrault.fp.provider.NamedProvider import groowt.util.fp.provider.NamedProvider
import com.jessebrault.fp.provider.Provider import groowt.util.fp.provider.Provider
import java.util.function.Supplier import java.util.function.Supplier

View File

@ -4,7 +4,7 @@ import groovy.transform.EqualsAndHashCode
import groovy.transform.NullCheck import groovy.transform.NullCheck
import groovy.transform.PackageScope import groovy.transform.PackageScope
import groovy.transform.TupleConstructor import groovy.transform.TupleConstructor
import com.jessebrault.fp.provider.Provider import groowt.util.fp.provider.Provider
@PackageScope @PackageScope
@TupleConstructor(includeFields = true, defaults = false) @TupleConstructor(includeFields = true, defaults = false)

View File

@ -5,8 +5,8 @@ import com.jessebrault.ssg.util.Diagnostic
import com.jessebrault.ssg.view.PageView import com.jessebrault.ssg.view.PageView
import com.jessebrault.ssg.view.WvcCompiler import com.jessebrault.ssg.view.WvcCompiler
import com.jessebrault.ssg.view.WvcPageView import com.jessebrault.ssg.view.WvcPageView
import com.jessebrault.di.RegistryObjectFactory import groowt.util.di.RegistryObjectFactory
import com.jessebrault.fp.either.Either import groowt.util.fp.either.Either
class DefaultWvcPage extends AbstractPage implements Page { class DefaultWvcPage extends AbstractPage implements Page {

View File

@ -2,7 +2,7 @@ package com.jessebrault.ssg.page
import com.jessebrault.ssg.util.Diagnostic import com.jessebrault.ssg.util.Diagnostic
import com.jessebrault.ssg.view.PageView import com.jessebrault.ssg.view.PageView
import com.jessebrault.fp.either.Either import groowt.util.fp.either.Either
interface Page { interface Page {

View File

@ -1,7 +1,7 @@
package com.jessebrault.ssg.util package com.jessebrault.ssg.util
import com.jessebrault.fp.property.Property import groowt.util.fp.property.Property
import com.jessebrault.fp.provider.Provider import groowt.util.fp.provider.Provider
import static java.util.Objects.requireNonNull import static java.util.Objects.requireNonNull

View File

@ -2,32 +2,18 @@ package com.jessebrault.ssg.view
import com.jessebrault.ssg.util.Diagnostic import com.jessebrault.ssg.util.Diagnostic
import groovy.transform.TupleConstructor import groovy.transform.TupleConstructor
import com.jessebrault.fp.either.Either import groowt.util.fp.either.Either
import groowt.view.component.ComponentTemplate import groowt.view.component.ComponentTemplate
import groowt.view.component.ViewComponent import groowt.view.component.ViewComponent
import groowt.view.component.compiler.ComponentTemplateClassFactory import groowt.view.component.compiler.ComponentTemplateClassFactory
import groowt.view.component.compiler.ComponentTemplateCompilerConfiguration
import groowt.view.component.compiler.source.ComponentTemplateSource import groowt.view.component.compiler.source.ComponentTemplateSource
import groowt.view.component.web.compiler.DefaultWebViewComponentTemplateCompileUnit import groowt.view.component.web.compiler.DefaultWebViewComponentTemplateCompileUnit
@TupleConstructor @TupleConstructor
class WvcCompiler { class WvcCompiler {
private static class SsgWvcTemplateCompileUnit extends DefaultWebViewComponentTemplateCompileUnit { final ComponentTemplateCompilerConfiguration compilerConfiguration
SsgWvcTemplateCompileUnit(
String descriptiveName,
Class<? extends ViewComponent> forClass,
ComponentTemplateSource source,
String defaultPackageName,
GroovyClassLoader groovyClassLoader
) {
super(descriptiveName, forClass, source, defaultPackageName)
this.groovyCompilationUnit.setClassLoader(groovyClassLoader)
}
}
final GroovyClassLoader groovyClassLoader
final ComponentTemplateClassFactory templateClassFactory final ComponentTemplateClassFactory templateClassFactory
Either<Diagnostic, ComponentTemplate> compileTemplate( Either<Diagnostic, ComponentTemplate> compileTemplate(
@ -41,14 +27,13 @@ class WvcCompiler {
)) ))
} }
def source = ComponentTemplateSource.of(templateUrl) def source = ComponentTemplateSource.of(templateUrl)
def compileUnit = new SsgWvcTemplateCompileUnit( def compileUnit = new DefaultWebViewComponentTemplateCompileUnit(
source.descriptiveName, source.descriptiveName,
componentClass, componentClass,
source, source,
componentClass.packageName, componentClass.packageName
this.groovyClassLoader
) )
def compileResult = compileUnit.compile() def compileResult = compileUnit.compile(compilerConfiguration)
def templateClass = templateClassFactory.getTemplateClass(compileResult) def templateClass = templateClassFactory.getTemplateClass(compileResult)
def componentTemplate = templateClass.getConstructor().newInstance() def componentTemplate = templateClass.getConstructor().newInstance()
return Either.right(componentTemplate) return Either.right(componentTemplate)

View File

@ -23,5 +23,5 @@ repositories {
} }
dependencies { dependencies {
implementation 'com.jessebrault.jbarchiva:jbarchiva:0.2.2' implementation 'com.jessebrault.jbarchiva:jbarchiva:0.1.0'
} }

View File

@ -1,18 +1,13 @@
plugins { plugins {
id 'com.jessebrault.jbarchiva'
id 'java' id 'java'
id 'maven-publish'
} }
group 'com.jessebrault.ssg' group 'com.jessebrault.ssg'
version '0.6.0-SNAPSHOT' version '0.4.1'
repositories { repositories {
mavenCentral() mavenCentral()
maven {
name = 'Gitea'
url = uri('https://git.jessebrault.com/api/packages/jessebrault/maven')
}
} }
configurations { configurations {
@ -47,21 +42,3 @@ testing {
} }
} }
} }
publishing {
repositories {
maven {
name = 'Gitea'
url = uri('https://git.jessebrault.com/api/packages/jessebrault/maven')
credentials(HttpHeaderCredentials) {
name = "Authorization"
value = "token ${System.getenv("GITEA_ACCESS_TOKEN")}"
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
}

View File

@ -8,6 +8,7 @@ plugins {
repositories { repositories {
mavenCentral() mavenCentral()
maven { url 'https://repo.gradle.org/gradle/libs-releases' } maven { url 'https://repo.gradle.org/gradle/libs-releases' }
mavenLocal()
} }
dependencies { dependencies {
@ -16,7 +17,7 @@ dependencies {
implementation libs.picocli implementation libs.picocli
implementation libs.log4j2.api implementation libs.log4j2.api
implementation libs.log4j2.core implementation libs.log4j2.core
implementation "org.gradle:gradle-tooling-api:8.14.1" implementation "org.gradle:gradle-tooling-api:8.7"
runtimeOnly libs.log4j2.slf4j2.impl runtimeOnly libs.log4j2.slf4j2.impl
} }
@ -31,11 +32,7 @@ java {
} }
jar { jar {
archivesBaseName = 'ssg-cli' archivesBaseName = "ssg-cli"
}
sourcesJar {
archiveBaseName = 'ssg-cli'
} }
distributions { distributions {
@ -48,7 +45,7 @@ distributions {
publishing { publishing {
publications { publications {
create('ssgCli', MavenPublication) { create('ssgCli', MavenPublication) {
artifactId = 'cli' artifactId = 'ssg-cli'
from components.java from components.java
} }
} }

View File

@ -1,39 +1,26 @@
[versions] [versions]
classgraph = '4.8.179' commonmark = '0.22.0'
commonmark = '0.24.0' groovy = '4.0.21'
di = '0.1.0' groowt = '0.1.2'
fp = '0.1.0' log4j2 = '2.23.1'
groovy = '4.0.27' mockito = '5.12.0'
groowt = '0.1.4' junit = '5.10.2'
jetbrains-annotations = '26.0.2'
jsoup = '1.20.1'
junit = '5.13.0'
log4j2 = '2.24.3'
mockito = '5.18.0'
picocli = '4.7.7'
slf4j = '2.0.17'
[libraries] [libraries]
classgraph = { module = 'io.github.classgraph:classgraph', version.ref = 'classgraph' } classgraph = 'io.github.classgraph:classgraph:4.8.172'
commonmark = { module = 'org.commonmark:commonmark', version.ref = 'commonmark' } commonmark = { module = 'org.commonmark:commonmark', version.ref = 'commonmark' }
commonmark-frontmatter = { module = 'org.commonmark:commonmark-ext-yaml-front-matter', version.ref = 'commonmark' } commonmark-frontmatter = { module = 'org.commonmark:commonmark-ext-yaml-front-matter', version.ref = 'commonmark' }
di = { module = 'com.jessebrault.di:di', version.ref = 'di' }
fp = { module = 'com.jessebrault.fp:fp', version.ref = 'fp' }
groovy = { module = 'org.apache.groovy:groovy', version.ref = 'groovy' } groovy = { module = 'org.apache.groovy:groovy', version.ref = 'groovy' }
groovy-yaml = { module = 'org.apache.groovy:groovy-yaml', version.ref = 'groovy' } groovy-yaml = { module = 'org.apache.groovy:groovy-yaml', version.ref = 'groovy' }
groowt-v = { module = 'groowt:views', version.ref = 'groowt' } groowt-all = { module = 'groowt:groowt-all', version.ref = 'groowt' }
groowt-vc = { module = 'groowt:view-components', version.ref = 'groowt' } groowt-wvcCompiler = { module = 'groowt:web-view-components-compiler', version.ref = 'groowt' }
groowt-wvc= { module = 'groowt:web-view-components', version.ref = 'groowt' } jetbrains-anontations = 'org.jetbrains:annotations:24.1.0'
groowt-wvcc = { module = 'groowt:web-view-components-compiler', version.ref = 'groowt' } jsoup = 'org.jsoup:jsoup:1.17.2'
groowt-fp = { module = 'groowt:util-fp', version.ref = 'groowt' }
groowt-di = { module = 'groowt:util-di', version.ref = 'groowt' }
jetbrains-anontations = { module = 'org.jetbrains:annotations', version.ref = 'jetbrains-annotations' }
jsoup = { module = 'org.jsoup:jsoup', version.ref = 'jsoup' }
junit-jupiter-api = { module = 'org.junit.jupiter:junit-jupiter-api', version.ref = 'junit' } junit-jupiter-api = { module = 'org.junit.jupiter:junit-jupiter-api', version.ref = 'junit' }
log4j2-api = { module = 'org.apache.logging.log4j:log4j-api', version.ref = 'log4j2' } log4j2-api = { module = 'org.apache.logging.log4j:log4j-api', version.ref = 'log4j2' }
log4j2-core = { module = 'org.apache.logging.log4j:log4j-core', version.ref = 'log4j2' } log4j2-core = { module = 'org.apache.logging.log4j:log4j-core', version.ref = 'log4j2' }
log4j2-slf4j2-impl = { module = 'org.apache.logging.log4j:log4j-slf4j2-impl', version.ref = 'log4j2' } log4j2-slf4j2-impl = { module = 'org.apache.logging.log4j:log4j-slf4j2-impl', version.ref = 'log4j2' }
mockito-core = { module = 'org.mockito:mockito-core', version.ref = 'mockito' } mockito-core = { module = 'org.mockito:mockito-core', version.ref = 'mockito' }
mockito-junit-jupiter = { module = 'org.mockito:mockito-junit-jupiter', version.ref = 'mockito' } mockito-junit-jupiter = { module = 'org.mockito:mockito-junit-jupiter', version.ref = 'mockito' }
picocli = { module = 'info.picocli:picocli', version.ref = 'picocli' } picocli = 'info.picocli:picocli:4.7.6'
slf4j-api = { module = 'org.slf4j:slf4j-api', version.ref = 'slf4j' } slf4j-api = 'org.slf4j:slf4j-api:2.0.13'

Binary file not shown.

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

6
gradlew vendored
View File

@ -15,8 +15,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# SPDX-License-Identifier: Apache-2.0
#
############################################################################## ##############################################################################
# #
@ -57,7 +55,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@ -86,7 +84,7 @@ done
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum

2
gradlew.bat vendored
View File

@ -13,8 +13,6 @@
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################

View File

@ -1,5 +1,4 @@
# Targeting 0.4.0: Ideas and Plans # Targeting 0.4.0: Ideas and Plans
**This file is old as of 06/14/2024.**
Have the following layout of dirs and files. It is a combined gradle/ssg project. Have the following layout of dirs and files. It is a combined gradle/ssg project.
- bin: a folder for shell scripts - bin: a folder for shell scripts

View File

@ -162,8 +162,8 @@ public class SsgGradlePlugin implements Plugin<Project> {
Configuration ssgApiConfiguration, Configuration ssgApiConfiguration,
Configuration ssgCliConfiguration Configuration ssgCliConfiguration
) { ) {
final Dependency ssgApi = project.getDependencies().create("com.jessebrault.ssg:api:0.5.0-SNAPSHOT"); final Dependency ssgApi = project.getDependencies().create("com.jessebrault.ssg:ssg-api:0.4.0");
final Dependency ssgCli = project.getDependencies().create("com.jessebrault.ssg:cli:0.5.0-SNAPSHOT"); final Dependency ssgCli = project.getDependencies().create("com.jessebrault.ssg:ssg-cli:0.4.0");
ssgApiConfiguration.getDependencies().add(ssgApi); ssgApiConfiguration.getDependencies().add(ssgApi);
ssgCliConfiguration.getDependencies().add(ssgCli); ssgCliConfiguration.getDependencies().add(ssgCli);
} }

View File

@ -1,35 +0,0 @@
package com.jessebrault.ssg.gradle;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.io.TempDir;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
/**
* This is just a scaffolding test file for the future.
*/
public class SsgGradlePluginTests {
@TempDir
private Path tempDir;
private Path buildFile;
@BeforeEach
public void beforeEach() throws IOException {
buildFile = tempDir.resolve("build.gradle");
Files.writeString(buildFile, """
plugins {
id 'com.jessebrault.ssg'
}
dependencies {
implementation 'org.apache.groovy:groovy:4.0.25'
}
"""
);
}
}

5
test-ssg-project/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
bin
.ssg
testBuild
dist
default

View File

@ -0,0 +1,12 @@
plugins {
id 'com.jessebrault.ssg' version '0.4.0'
}
dependencies {
implementation 'org.apache.groovy:groovy:4.0.21'
}
repositories {
mavenCentral()
mavenLocal()
}

View File

@ -0,0 +1,14 @@
package com.jessebrault.site
import groowt.view.component.web.BaseWebViewComponent
class Head extends BaseWebViewComponent {
final String title
Head(Map attr) {
super(Head.getResource('HeadTemplate.wvc'))
this.title = attr.title
}
}

View File

@ -0,0 +1,6 @@
---
package com.jessebrault.site
---
<head>
<title>$title</title>
</head>

Binary file not shown.

View File

@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

249
test-ssg-project/gradlew vendored Executable file
View File

@ -0,0 +1,249 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

92
test-ssg-project/gradlew.bat vendored Normal file
View File

@ -0,0 +1,92 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@ -0,0 +1,21 @@
package com.jessebrault.site
import com.jessebrault.ssg.di.InjectText
import com.jessebrault.ssg.page.PageSpec
import com.jessebrault.ssg.text.Text
import com.jessebrault.ssg.view.WvcPageView
import jakarta.inject.Inject
@PageSpec(name = 'Biography', path = '/biography')
class Biography extends WvcPageView {
static final String greeting = 'Hello, World!'
final Text biographyText
@Inject
Biography(@InjectText('/Biography.md') Text biographyText) {
this.biographyText = biographyText
}
}

View File

@ -0,0 +1,14 @@
---
package com.jessebrault.site
---
<html lang="en">
<Head title={pageTitle} />
<body>
<h1>$pageTitle</h1>
<h2>$url</h2>
<p>$greeting</p>
<section>
<%= biographyText.render() %>
</section>
</body>
</html>

View File

@ -0,0 +1,7 @@
---
package com.jessebrault.site
---
$pageTitle
$url
Hello, World!

View File

@ -0,0 +1,8 @@
pluginManagement {
repositories {
mavenCentral()
mavenLocal()
}
}
rootProject.name = 'test-ssg-project'

View File

@ -0,0 +1,10 @@
import com.jessebrault.ssg.buildscript.BuildScriptBase
import groovy.transform.BaseScript
@BaseScript
BuildScriptBase base
build {
siteName 'My Test Site'
baseUrl 'https://hello.com'
}

View File

@ -0,0 +1,3 @@
# Biography
Hello! My name is Jesse Brault.