-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
490 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* This file was generated by the Gradle 'init' task. | ||
* | ||
* This generated file contains a sample Kotlin application project to get you started. | ||
* For more details on building Java & JVM projects, please refer to https://docs.gradle.org/8.3/userguide/building_java_projects.html in the Gradle documentation. | ||
*/ | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
plugins { | ||
kotlin("jvm") version "1.9.0" | ||
application | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation("org.apache.commons:commons-exec:1.3") | ||
implementation("com.fasterxml.jackson.core:jackson-annotations:2.14.0") | ||
implementation("com.fasterxml.jackson.core:jackson-databind:2.14.0") | ||
implementation("org.slf4j:slf4j-api:2.0.9") | ||
implementation("org.apache.commons:commons-compress:1.21") | ||
implementation(project(mapOf("path" to ":helper"))) | ||
// Use the Kotlin JUnit 5 integration. | ||
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5") | ||
// Use the JUnit 5 integration. | ||
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.9.3") | ||
testRuntimeOnly("org.junit.platform:junit-platform-launcher") | ||
} | ||
|
||
// Apply a specific Java toolchain to ease working on different environments. | ||
java { | ||
toolchain { | ||
languageVersion.set(JavaLanguageVersion.of(11)) | ||
} | ||
} | ||
|
||
application { | ||
// Define the main class for the application. | ||
mainClass.set("cfig.lazybox.AppKt") | ||
} | ||
|
||
tasks.named<Test>("test") { | ||
// Use JUnit Platform for unit tests. | ||
useJUnitPlatform() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package cfig.lazybox | ||
|
||
import cfig.lazybox.sysinfo.CpuInfo | ||
import cfig.lazybox.sysinfo.SysInfo | ||
import com.fasterxml.jackson.databind.ObjectMapper | ||
import org.slf4j.LoggerFactory | ||
import java.io.File | ||
import kotlin.system.exitProcess | ||
|
||
class App | ||
|
||
fun main(args: Array<String>) { | ||
val log = LoggerFactory.getLogger(App::class.java) | ||
if (args.isEmpty()) { | ||
println("Usage: args: (Array<String>) ...") | ||
println(" or: function [arguments]...") | ||
println("\nCurrently defined functions:") | ||
println("\tcpuinfo sysinfo") | ||
exitProcess(0) | ||
} | ||
if (args.get(0) == "cpuinfo") { | ||
val ret = CpuInfo.construct() | ||
File("cpuinfo.json").writeText( | ||
ObjectMapper() | ||
.writerWithDefaultPrettyPrinter() | ||
.writeValueAsString(ret) | ||
) | ||
log.info("cpuinfo.json is ready") | ||
} | ||
if (args.get(0) == "sysinfo") { | ||
SysInfo().run() | ||
} | ||
} |
Oops, something went wrong.