Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitFicus committed Mar 25, 2024
0 parents commit 02ea637
Show file tree
Hide file tree
Showing 1,021 changed files with 187,249 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .g8/form/app/controllers/$model__Camel$Controller.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package controllers

import javax.inject._
import play.api.mvc._

import play.api.data._
import play.api.data.Forms._

case class $model;format="Camel"$Data(name: String, age: Int)

// NOTE: Add the following to conf/routes to enable compilation of this class:
/*
GET /$model;format="camel"$ controllers.$model;format="Camel"$Controller.$model;format="camel"$Get
POST /$model;format="camel"$ controllers.$model;format="Camel"$Controller.$model;format="camel"$Post
*/

/**
* $model;format="Camel"$ form controller for Play Scala
*/
class $model;format="Camel"$Controller @Inject()(mcc: MessagesControllerComponents) extends MessagesAbstractController(mcc) {

val $model;format="camel"$Form = Form(
mapping(
"name" -> text,
"age" -> number
)($model;format="Camel"$Data.apply)($model;format="Camel"$Data.unapply)
)

def $model;format="camel"$Get() = Action { implicit request: MessagesRequest[AnyContent] =>
Ok(views.html.$model;format="camel"$.form($model;format="camel"$Form))
}

def $model;format="camel"$Post() = Action { implicit request: MessagesRequest[AnyContent] =>
$model;format="camel"$Form.bindFromRequest.fold(
formWithErrors => {
// binding failure, you retrieve the form containing errors:
BadRequest(views.html.$model;format="camel"$.form(formWithErrors))
},
$model;format="camel"$Data => {
/* binding success, you get the actual value. */
/* flashing uses a short lived cookie */
Redirect(routes.$model;format="Camel"$Controller.$model;format="camel"$Get()).flashing("success" -> ("Successful " + $model;format="camel"$Data.toString))
}
)
}
}
12 changes: 12 additions & 0 deletions .g8/form/app/views/$model__camel$/form.scala.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@($model;format="camel"$Form: Form[$model;format="Camel"$Data])(implicit request: MessagesRequestHeader)

<h1>$model;format="camel"$ form</h1>

@request.flash.get("success").getOrElse("")

@helper.form(action = routes.$model;format="Camel"$Controller.$model;format="camel"$Post()) {
@helper.CSRF.formField
@helper.inputText($model;format="camel"$Form("name"))
@helper.inputText($model;format="camel"$Form("age"))
<input type="submit" value="submit"/>
}
2 changes: 2 additions & 0 deletions .g8/form/default.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
description = Generates a Controller with form handling
model = user
71 changes: 71 additions & 0 deletions .g8/form/test/controllers/$model__Camel$ControllerSpec.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package controllers

import play.api.mvc._
import play.api.i18n._
import org.scalatestplus.play._
import org.scalatestplus.play.guice.GuiceOneAppPerTest
import play.api.http.FileMimeTypes
import play.api.test._
import play.api.test.Helpers._
import play.api.test.CSRFTokenHelper._

import scala.concurrent.ExecutionContext

/**
* $model;format="Camel"$ form controller specs
*/
class $model;format="Camel"$ControllerSpec extends PlaySpec with GuiceOneAppPerTest with Injecting {

// Provide stubs for components based off Helpers.stubControllerComponents()
class StubComponents(cc:ControllerComponents = stubControllerComponents()) extends MessagesControllerComponents {
override val parsers: PlayBodyParsers = cc.parsers
override val messagesApi: MessagesApi = cc.messagesApi
override val langs: Langs = cc.langs
override val fileMimeTypes: FileMimeTypes = cc.fileMimeTypes
override val executionContext: ExecutionContext = cc.executionContext
override val actionBuilder: ActionBuilder[Request, AnyContent] = cc.actionBuilder
override val messagesActionBuilder: MessagesActionBuilder = new DefaultMessagesActionBuilderImpl(parsers.default, messagesApi)(executionContext)
}

"$model;format="Camel"$Controller GET" should {

"render the index page from a new instance of controller" in {
val controller = new $model;format="Camel"$Controller(new StubComponents())
val request = FakeRequest().withCSRFToken
val home = controller.$model;format="camel"$Get().apply(request)

status(home) mustBe OK
contentType(home) mustBe Some("text/html")
}

"render the index page from the application" in {
val controller = inject[$model;format="Camel"$Controller]
val request = FakeRequest().withCSRFToken
val home = controller.$model;format="camel"$Get().apply(request)

status(home) mustBe OK
contentType(home) mustBe Some("text/html")
}

"render the index page from the router" in {
val request = CSRFTokenHelper.addCSRFToken(FakeRequest(GET, "/$model;format="camel"$"))
val home = route(app, request).get

status(home) mustBe OK
contentType(home) mustBe Some("text/html")
}
}

"$model;format="Camel"$Controller POST" should {
"process form" in {
val request = {
FakeRequest(POST, "/$model;format="camel"$")
.withFormUrlEncodedBody("name" -> "play", "age" -> "4")
}
val home = route(app, request).get
status(home) mustBe SEE_OTHER
}
}
}
73 changes: 73 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [INSERT EMAIL ADDRESS]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org
40 changes: 40 additions & 0 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build dev documentations

on:
push:
paths:
- 'manual/**'
- '.github/workflows/doc.yml'
branches:
- main
workflow_dispatch:


jobs:
build_dev_manual:
name: Build developer documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Generate documentation website
id: doc
run: |
cd manual
npm ci
npm run build
rm -rf ../docs
mv ./build ../docs
- name: Commit files
run: |
git config --local user.email "izanami-release-bot@users.noreply.github.com"
git config --local user.name "izanami release bot"
git add --all
git commit -am "Update dev documentation"
- name: Push documentation
uses: ad-m/github-push-action@master
with:
branch: main
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN}}
38 changes: 38 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Playwright

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

permissions:
contents: read


jobs:
tests_e2e:
name: Run end-to-end tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Install dependencies
run: npm ci
working-directory: ./izanami-frontend
- name: Install playwright browsers
run: npx playwright install --with-deps chromium
working-directory: ./izanami-frontend
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
cache: 'sbt'
- name: Start docker
run: docker-compose up -d
- name: start backend
run: sbt "bgRun -Dconfig.resource=dev.conf"
- name: Run tests
run: npx playwright test --project chromium
working-directory: ./izanami-frontend
53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: release

on:
workflow_dispatch:
inputs:
releaseVersion:
description: 'release version'
required: true

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.2.0
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
- uses: coursier/cache-action@v5
# install node lts
- name: setup node
uses: actions/setup-node@v3
with:
node-version: '20.x'
cache: 'npm'
cache-dependency-path: izanami-frontend/package-lock.json
- name: build frontend
run: |
cd izanami-frontend
npm ci
npm run build
- name: build backend
run: sbt "set test in assembly := {}" clean assembly
- name: release
run: |
git checkout .
git config --global user.email "izanami@users.noreply.github.com"
git config --global user.name "izanami release bot"
sbt "release release-version ${{ github.event.inputs.releaseVersion }} with-defaults skip-tests"
ls target
ls target/scala-2.13
- name: github release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ github.event.inputs.releaseVersion }}
files: |
target/scala-2.13/izanami.jar
- name: next version
run: |
git add .
git commit -am "Next dev version"
git push
38 changes: 38 additions & 0 deletions .github/workflows/scala.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Scala CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
cache: 'sbt'
#- name: Start docker
# run: docker-compose up -d
#- name: debug wasmo
# run: curl -L 127.0.0.1:5001/api/plugins
- name: Run tests
run: sbt test
#- name: Stop docker
# run: docker-compose down
# Optional: This step uploads information to the GitHub dependency graph and unblocking Dependabot alerts for the repository
#- name: Upload dependency graph
# uses: scalacenter/sbt-dependency-submission@ab086b50c947c9774b70f39fc7f6e20ca2706c91
Loading

0 comments on commit 02ea637

Please sign in to comment.