mirror of
https://github.com/ethauvin/kobalt-line-count.git
synced 2025-04-25 03:07:11 -07:00
Update
This commit is contained in:
parent
83dbbc9fe1
commit
c3ba642496
2 changed files with 7 additions and 4 deletions
|
@ -20,7 +20,7 @@ val project = project {
|
||||||
version = "0.23"
|
version = "0.23"
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile("com.beust:kobalt-plugin-api:0.930")
|
compile("com.beust:kobalt-plugin-api:0.939")
|
||||||
}
|
}
|
||||||
|
|
||||||
assemble {
|
assemble {
|
||||||
|
|
|
@ -12,7 +12,10 @@ import java.nio.file.attribute.BasicFileAttributes
|
||||||
// com.beust.kobalt.main(argv)
|
// com.beust.kobalt.main(argv)
|
||||||
//}
|
//}
|
||||||
|
|
||||||
public class LineCountPlugin : BasePlugin(), ITaskContributor {
|
/**
|
||||||
|
* A simple line counting plug-in for Kobalt.
|
||||||
|
*/
|
||||||
|
class LineCountPlugin : BasePlugin(), ITaskContributor {
|
||||||
// ITaskContributor
|
// ITaskContributor
|
||||||
override fun tasksFor(project: Project, context: KobaltContext) = listOf(
|
override fun tasksFor(project: Project, context: KobaltContext) = listOf(
|
||||||
DynamicTask(this,
|
DynamicTask(this,
|
||||||
|
@ -44,7 +47,7 @@ public class LineCountPlugin : BasePlugin(), ITaskContributor {
|
||||||
val path = Paths.get(it)
|
val path = Paths.get(it)
|
||||||
if (path.toFile().exists()) {
|
if (path.toFile().exists()) {
|
||||||
Files.walkFileTree(path, object : SimpleFileVisitor<Path>() {
|
Files.walkFileTree(path, object : SimpleFileVisitor<Path>() {
|
||||||
override public fun visitFile(path: Path, attrs: BasicFileAttributes): FileVisitResult {
|
override fun visitFile(path: Path, attrs: BasicFileAttributes): FileVisitResult {
|
||||||
if (matcher.matches(path)) {
|
if (matcher.matches(path)) {
|
||||||
fileCount++
|
fileCount++
|
||||||
lineCount += Files.lines(path).count()
|
lineCount += Files.lines(path).count()
|
||||||
|
@ -63,7 +66,7 @@ public class LineCountPlugin : BasePlugin(), ITaskContributor {
|
||||||
data class LineCountInfo(var suffix: String = "**kt")
|
data class LineCountInfo(var suffix: String = "**kt")
|
||||||
|
|
||||||
@Directive
|
@Directive
|
||||||
public fun lineCount(init: LineCountInfo.() -> Unit): LineCountInfo {
|
fun lineCount(init: LineCountInfo.() -> Unit): LineCountInfo {
|
||||||
with(LineCountInfo()) {
|
with(LineCountInfo()) {
|
||||||
init()
|
init()
|
||||||
(Kobalt.findPlugin(LineCountPlugin.NAME) as LineCountPlugin).info = this
|
(Kobalt.findPlugin(LineCountPlugin.NAME) as LineCountPlugin).info = this
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue