File tree Expand file tree Collapse file tree 3 files changed +7
-8
lines changed
src/main/scala/gitbucket/monitoring/services Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import gitbucket.monitoring.utils._
88trait MachineResources {
99 private val fileStore = Files .getFileStore(Paths .get(" ." ))
1010
11- def cpuCore = Runtime .getRuntime().availableProcessors()
11+ val cpuCore = Runtime .getRuntime().availableProcessors()
1212
1313 def getCpu : Either [String , Cpu ] = {
1414 try {
Original file line number Diff line number Diff line change @@ -7,12 +7,12 @@ import scala.sys.process._
77import gitbucket .monitoring .utils ._
88
99trait SystemInformation {
10- def timeZone = ZoneId .systemDefault()
10+ val timeZone = ZoneId .systemDefault()
1111 def nowTime = LocalDateTime .now()
1212 def zoneOffset = timeZone.getRules().getOffset(nowTime)
1313 def dayOfWeek = nowTime.getDayOfWeek()
1414
15- def onDocker : Boolean = {
15+ val onDocker : Boolean = {
1616 try {
1717 Files .exists(Paths .get(" /.dockerenv" ))
1818 } catch {
Original file line number Diff line number Diff line change @@ -12,8 +12,7 @@ object OperatingSystem {
1212
1313 val osArch = System .getProperty(" os.arch" )
1414 val osName = System .getProperty(" os.name" )
15-
16- def osType : OSType = {
15+ val osType : OSType = {
1716 if (osName.toLowerCase.contains(" linux" )) {
1817 Linux
1918 } else if (osName.toLowerCase.contains(" windows" )) {
@@ -25,7 +24,7 @@ object OperatingSystem {
2524 }
2625 }
2726
28- def osVersion : String = osType match {
27+ val osVersion : String = osType match {
2928 case Windows => {
3029 (Process (" powershell -Command Get-WmiObject Win32_OperatingSystem | %{ $_.Version }" ) !! ).toString
3130 }
@@ -34,7 +33,7 @@ object OperatingSystem {
3433 }
3534 }
3635
37- def distribution : String = osType match {
36+ val distribution : String = osType match {
3837 case Linux => {
3938 try {
4039 val result = Process (" cat /etc/issue" ) !!
@@ -49,7 +48,7 @@ object OperatingSystem {
4948 }
5049 }
5150
52- def getInstance = osType match {
51+ val getInstance = osType match {
5352 case OperatingSystem .Linux => new Linux
5453 case OperatingSystem .Mac => new Mac
5554 case OperatingSystem .Windows => new Windows
You can’t perform that action at this time.
0 commit comments