d69d74b71d8f

Build this thing
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Mon, 16 Jan 2017 21:20:27 +0000
parents 04d22df531ca
children ce9a7a79f999
branches/tags (none)
files Makefile build/magitek.ros magitek.asd package.lisp src/database.lisp src/main.lisp

Changes

--- a/Makefile	Mon Jan 16 21:19:45 2017 +0000
+++ b/Makefile	Mon Jan 16 21:20:27 2017 +0000
@@ -5,3 +5,21 @@
 	cd vendor && sbcl --noinform --load make-quickutils.lisp  --eval '(quit)'
 
 vendor: vendor/quickutils.lisp
+
+
+# Build -----------------------------------------------------------------------
+lisps := $(shell ffind '\.(asd|lisp|ros)$$')
+
+build/magitek: $(lisps)
+	ros build build/magitek.ros
+
+update-deps:
+	hg -R /home/sjl/chancery -v pull -u
+
+/opt/antipodes/antipodes: update-deps build/antipodes
+	rm -f /opt/antipodes/antipodes
+	cp build/antipodes /opt/antipodes/antipodes
+
+deploy: build/magitek
+	rsync --exclude=build/magitek --exclude=.hg --exclude=database.sqlite -avz . silt:/home/sjl/magitek
+	ssh silt make -C /home/sjl/magitek build/magitek
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build/magitek.ros	Mon Jan 16 21:20:27 2017 +0000
@@ -0,0 +1,16 @@
+#!/bin/sh
+#|-*- mode:lisp -*-|#
+#|
+exec ros -Q -- $0 "$@"
+|#
+
+
+(unless (find-package :ap)
+  (ql:quickload '(:magitek) :silent t))
+
+(declaim (optimize (debug 2) (safety 2) (speed 1)))
+
+(defun main (&rest argv)
+  (declare (ignore argv))
+  (magitek:main)
+  t)
--- a/magitek.asd	Mon Jan 16 21:19:45 2017 +0000
+++ b/magitek.asd	Mon Jan 16 21:20:27 2017 +0000
@@ -20,8 +20,8 @@
                              (:file "quickutils")))
                (:file "package")
                (:module "src" :serial t
-                :components ((:file "auth")
-                             (:file "database")
+                :components ((:file "database")
+                             (:file "twitter")
                              (:module "robots"
                               :components ((:file "git-commands")))
                              (:file "main")))))
--- a/package.lisp	Mon Jan 16 21:19:45 2017 +0000
+++ b/package.lisp	Mon Jan 16 21:20:27 2017 +0000
@@ -19,6 +19,7 @@
     :magitek.quickutils)
   (:export
     :db-connect
+    :db-initialize
     :db-insert-tweet
     :db-tweeted-since-p))
 
--- a/src/database.lisp	Mon Jan 16 21:19:45 2017 +0000
+++ b/src/database.lisp	Mon Jan 16 21:20:27 2017 +0000
@@ -6,7 +6,7 @@
   (setf *database* (connect path))
   (values))
 
-(defun initialize-database ()
+(defun db-initialize ()
   (execute-non-query *database*
     "CREATE TABLE IF NOT EXISTS tweets(
         id INTEGER PRIMARY KEY,
--- a/src/main.lisp	Mon Jan 16 21:19:45 2017 +0000
+++ b/src/main.lisp	Mon Jan 16 21:20:27 2017 +0000
@@ -11,6 +11,7 @@
 
 
 (defun run-bot (name generator &key (hours 12))
+  (format t "Running ~S~%" name)
   (when (not (db-tweeted-since-p name (hours-to-minutes hours)))
     (let ((tweet (generate-tweet generator)))
       (if (null tweet)
@@ -23,7 +24,7 @@
 
 (defun main ()
   (db-connect)
+  (db-initialize)
   (tt-load-credentials)
   (run-bot :git-commands #'magitek.robots.git-commands:random-string
-           :hours 12)
-  t)
+           :hours 12))