]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/broadcast-server/broadcast-server.factor
factor: add newlines to .factor files
[factor.git] / extra / broadcast-server / broadcast-server.factor
index 3d5b80f6644ff931bffd6a57e8246cd38be6f67f..37ace19cdcd451972a24067e87564b0433fc7910 100644 (file)
@@ -1,11 +1,10 @@
 ! Copyright (C) 2021 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays assocs calendar combinators
-combinators.extras continuations destructors io
-io.encodings.string io.encodings.utf8 io.files.info io.sockets
-io.streams.string kernel layouts make parser prettyprint
-prettyprint.config sequences splitting system system-info
-threads ;
+continuations destructors io io.encodings.string
+io.encodings.utf8 io.files.info io.sockets io.streams.string
+kernel layouts make parser prettyprint prettyprint.config
+sequences splitting system system-info threads ;
 IN: broadcast-server
 
 TUPLE: broadcast-server < disposable
@@ -64,7 +63,7 @@ SINGLETONS: command data ;
             ] [
                 [
                     receive-socket>> receive
-                    [ utf8 decode "\n" split parse-lines ] dip
+                    [ utf8 decode split-lines parse-lines ] dip
                 ] keep handle-data t
             ] if
         ] loop
@@ -75,15 +74,24 @@ SINGLETONS: command data ;
         computer-name "computer-name" ,,
         os unparse "os" ,,
         os-version "os-version" ,,
-        username "username" ,,
+        cpu unparse "cpu" ,,
         cell-bits "cell-bits" ,,
-        physical-mem "physical-mem" ,,
+        username "username" ,,
+
         build "build" ,,
-        vm-path "vm-path" ,,
-        vm-path file-info size>> "vm-size" ,,
         vm-git-id "git-id" ,,
         version-info "version-info" ,,
+        vm-path "vm-path" ,,
+        vm-path file-info size>> "vm-size" ,,
+        image-path "image-path" ,,
         image-path file-info size>> "image-size" ,,
+
+        cpus "cpus" ,,
+        cpu-mhz "cpu-mhz" ,,
+        physical-mem "physical-mem" ,,
+        vm-path file-system-info
+        [ total-space>> "disk-total-size" ,, ]
+        [ free-space>> "disk-free-size" ,, ] bi
     ] { } make ;
 
 : send-loop ( broadcast-server -- )
@@ -109,4 +117,5 @@ SINGLETONS: command data ;
     ] with-destructors ;
 
 ! "192.168.88.255" 7777 start-broadcast-server
-! "USE: math 2 2 + ." over send-broadcast-command
\ No newline at end of file
+! "USE: math 2 2 + ." over send-broadcast-command
+