-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Git Metrics with value source (#366)
* adding git metrics under value source * format metrics
- Loading branch information
Showing
5 changed files
with
39 additions
and
24 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
20 changes: 15 additions & 5 deletions
20
library/core/talaiot/src/main/kotlin/io/github/cdsap/talaiot/metrics/GitMetrics.kt
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 |
---|---|---|
@@ -1,12 +1,22 @@ | ||
package io.github.cdsap.talaiot.metrics | ||
|
||
import io.github.cdsap.talaiot.metrics.base.CmdMetric | ||
import io.github.cdsap.valuesourceprocess.CommandLineWithOutputValue | ||
import org.gradle.api.Project | ||
|
||
class GitBranchMetric : CmdMetric( | ||
cmd = "git rev-parse --abbrev-ref HEAD", | ||
class GitBranchMetric(val project: Project) : SimpleMetric<String>( | ||
provider = { | ||
project.providers.of(CommandLineWithOutputValue::class.java) { | ||
it.parameters.commands.set("git rev-parse --abbrev-ref HEAD") | ||
}.get().replace("\n", "") | ||
}, | ||
assigner = { report, value -> report.environment.gitBranch = value } | ||
) | ||
class GitUserMetric : CmdMetric( | ||
cmd = "git config --get user.name", | ||
|
||
class GitUserMetric(val project: Project) : SimpleMetric<String>( | ||
provider = { | ||
project.providers.of(CommandLineWithOutputValue::class.java) { | ||
it.parameters.commands.set("git config --get user.name") | ||
}.get().replace("\n", "") | ||
}, | ||
assigner = { report, value -> report.environment.gitUser = value } | ||
) |
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