Skip to content

Commit

Permalink
Merge pull request #11 from tfandkusu/command_line
Browse files Browse the repository at this point in the history
PC 向けコマンドラインアプリケーションリポジトリの作成
  • Loading branch information
tfandkusu authored Aug 11, 2024
2 parents f95bf04 + 9ebb220 commit 77be330
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 135 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: check
on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
- reopened
jobs:
check:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- uses: gradle/gradle-build-action@v2
- run: ./gradlew spotlessCheck
- run: ./gradlew test
- run: ./gradlew run --args validate
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ build/
!**/src/test/**/build/

### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
.idea
*.iws
*.iml
*.ipr
Expand Down
16 changes: 0 additions & 16 deletions .idea/gradle.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/kotlinc.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/misc.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

90 changes: 0 additions & 90 deletions .idea/workspace.xml

This file was deleted.

18 changes: 15 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
plugins {
kotlin("jvm") version "2.0.0"
kotlin("jvm") version libs.versions.kotlin
application
alias(libs.plugins.spotless)
}

group = "com.tfandkusu"
Expand All @@ -11,11 +13,21 @@ repositories {

dependencies {
testImplementation(kotlin("test"))
testImplementation(libs.junit)
}

tasks.test {
useJUnitPlatform()
useJUnit()
}
kotlin {
jvmToolchain(17)
}
}
application {
mainClass.set("com.tfandkusu.ga913yaml.MainKt")
}
spotless {
kotlin {
target("**/*.kt")
ktlint("1.3.1")
}
}
6 changes: 6 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[versions]
kotlin = "2.0.0"
[libraries]
junit = "junit:junit:4.13.2"
[plugins]
spotless = { id = "com.diffplug.spotless", version = "6.25.0" }
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
}
rootProject.name = "ga913yaml"
rootProject.name = "ga913-yaml"

14 changes: 12 additions & 2 deletions src/main/kotlin/com/tfandkusu/ga913yaml/Main.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
package com.tfandkusu.ga913yaml

fun main() {
println("Hello World!")
fun main(args: Array<String>) {
if (args.isEmpty()) {
println("./gradlew run --args validate")
println("./gradlew run --args make")
return
}
val command = args[0]
when (command) {
"validate" -> println("Validate")
"make" -> println("Make")
else -> println("Unknown command")
}
}
17 changes: 17 additions & 0 deletions src/test/kotlin/com/tfandkusu/ga913yaml/MainTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.tfandkusu.ga913yaml

import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test

class MainTest {
@Before
fun setup() {
println("setup")
}

@Test
fun test() {
assertTrue(true)
}
}

0 comments on commit 77be330

Please sign in to comment.