diff --git a/.gitignore b/.gitignore index 362414e7e4..68df555f07 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,6 @@ Factor/factor *.image factor.image.fresh *.dylib -factor factor.com *#*# .DS_Store diff --git a/extra/zealot/authors.txt b/extra/zealot/authors.txt new file mode 100644 index 0000000000..7c1b2f2279 --- /dev/null +++ b/extra/zealot/authors.txt @@ -0,0 +1 @@ +Doug Coleman diff --git a/extra/zealot/factor/authors.txt b/extra/zealot/factor/authors.txt new file mode 100644 index 0000000000..7c1b2f2279 --- /dev/null +++ b/extra/zealot/factor/authors.txt @@ -0,0 +1 @@ +Doug Coleman diff --git a/extra/zealot/factor/factor.factor b/extra/zealot/factor/factor.factor new file mode 100644 index 0000000000..6a79a7b94d --- /dev/null +++ b/extra/zealot/factor/factor.factor @@ -0,0 +1,43 @@ +! Copyright (C) 2017 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: arrays bootstrap.image cli.git combinators formatting fry +http.client io.directories io.launcher kernel math.parser +sequences system-info zealot ; +IN: zealot.factor + +: download-boot-checksums ( path branch -- ) + '[ _ "http://downloads.factorcode.org/images/%s/checksums.txt" sprintf download ] with-directory ; + +: download-boot-image ( path branch image-name -- ) + '[ _ _ "http://downloads.factorcode.org/images/%s/%s" sprintf download ] with-directory ; + +: download-my-boot-image ( path branch -- ) + my-boot-image-name download-boot-image ; + +: compile-factor ( path -- process ) + [ { "make" "-j" } cpus number>string suffix run-process ] with-directory ; + +: bootstrap-factor ( path -- ) + [ "./factor" "-i=" my-boot-image-name append 2array try-output-process ] with-directory ; + +: build-sh-update-factor ( path -- process ) + [ { "build.sh" "update" } run-process ] with-directory ; + +: factor-load-all ( path -- ) + [ + "./factor" "-e=\"USE: vocabs.hierarchy load-all USE: memory save\"" 2array + run-process drop + ] with-directory ; + +: build-new-factor ( branch -- ) + [ "factor" "factor" zealot-github-clone-paths nip ] dip + { + [ drop "factor" "factor" zealot-github-add-build-remote drop ] + [ drop [ git-fetch-all* ] with-directory drop ] + [ zealot-build-checkout-branch drop ] + [ download-my-boot-image ] + [ download-boot-checksums ] + [ drop compile-factor drop ] + [ drop bootstrap-factor ] + [ drop factor-load-all ] + } 2cleave ; \ No newline at end of file diff --git a/extra/zealot/zealot.factor b/extra/zealot/zealot.factor new file mode 100644 index 0000000000..9664313622 --- /dev/null +++ b/extra/zealot/zealot.factor @@ -0,0 +1,64 @@ +! Copyright (C) 2017 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: cli.git fry io.directories io.pathnames kernel sequences +web-services.github zealot.utils uuid ; +IN: zealot + +: default-zealot-directory ( chunk -- path ) [ home ".zealot" ] dip 3append-path ; +: default-zealot-source-directory ( -- path ) "source" default-zealot-directory ; +: default-zealot-builds-directory ( -- path ) "builds" default-zealot-directory ; + +: zealot-source-directory ( chunk -- path ) [ default-zealot-source-directory ] dip append-path ; +: zealot-builds-directory ( chunk -- path ) [ default-zealot-builds-directory ] dip append-path ; + +: with-default-zealot-source-directory ( chunk quot -- ) + [ default-zealot-source-directory ] dip with-ensure-directory ; inline + +: with-default-zealot-builds-directory ( chunk quot -- ) + [ default-zealot-builds-directory ] dip with-ensure-directory ; inline + +: with-zealot-source-directory ( chunk quot -- ) + [ zealot-source-directory ] dip with-ensure-directory ; inline + +: with-zealot-builds-directory ( chunk quot -- ) + [ zealot-builds-directory ] dip with-ensure-directory ; inline + + +: with-zealot-github-directory ( quot -- ) + [ "github" ] dip with-zealot-source-directory ; inline + +: with-zealot-github-project-directory ( user project quot -- ) + [ "github" ] 3dip [ 3append-path ] dip with-zealot-source-directory ; inline + +: zealot-github-clone ( user project -- process ) + '[ _ _ 2dup "/" glue github-git-clone-as ] with-zealot-github-directory ; inline + +: zealot-github-source-path ( user project -- path ) + [ "github" ] 2dip 3append-path zealot-source-directory ; + +: zealot-github-builds-path ( user project -- path ) + [ "github" ] 2dip 3append-path uuid1 append-path zealot-builds-directory ; + +: zealot-github-fetch-all ( user project -- process ) + [ git-fetch-all* ] with-zealot-github-project-directory ; + +: zealot-github-fetch-tags ( user project -- process ) + [ git-fetch-tags* ] with-zealot-github-project-directory ; + +: zealot-github-pull ( user project -- process ) + [ git-pull* ] with-zealot-github-project-directory ; + + +: zealot-github-set-build-remote ( path user project -- process ) + '[ "origin" _ _ github-ssh-uri git-change-remote* ] with-directory ; + +: zealot-github-add-build-remote ( path user project -- process ) + '[ "github" _ _ github-ssh-uri git-remote-add* ] with-directory ; + +: zealot-github-clone-paths ( user project -- process builds-path ) + [ zealot-github-source-path ] + [ zealot-github-builds-path ] 2bi + [ git-clone-as ] keep ; + +: zealot-build-checkout-branch ( path branch -- process ) + '[ _ git-checkout-existing-branch* ] with-directory ;