Tozier and I met Tuesday to do some work on my idea of writing site articles on the iPad. We began by settling some rough criteria for what we’re about, pretty much along the lines we talked about in the prior article.

  • We talked about where the build should be done, such as on my home computer, where I do it manually, or on a cloud site such as Heroku. We decided to do it on my home machine, because otherwise we have an additional project to make the build work elsewhere, and an additional place where the site source code resides.

  • We considered using things like GitHub hooks and GitLab and other setups that would send an http message to something running somewhere, versus a file watcher that checks some trigger file. We chose a file watcher.

  • We talked about how the file watcher would trigger, and decided that when I’m ready on the iPad, I’ll save into a trigger file, which will set off the action. There will be a master folder in Dropbox, where sub-folders contain proposed articles. They’ll be copied into the actual site folders for the build.

  • We talked about how to do the file transfer, considering using Automater to run Transmit. We considered sft, a ssh connection, and curl. Of those, we were able to make curl work. The others wouldn’t connect, which we attribute to the setup on my ISP. We wound up with this working:
    curl -T scp-content.txt --user user:password

  • We talked about whether I should have a task running on a file watcher, or whether to use a cron job. We think cron is better but in learning about it I find that Apple has at least deprecated cron and possibly disabled it.

We’re somewhat settled on cron (or launchd if we must), triggering a Ruby program every now and then. The Ruby program will check the trigger file, do the build, and if the build succeeds, will ftp the files up to the site. We know where all the indexes live and will just send them all. This will be slightly inefficient but less than 40 little directories and files so we’ll accept that. There will be details to sort out, as we go along. We considered a shell script, but Ruby can do what we need, the main site build is already in Ruby, and we like Ruby.

Today I’ll try an experiment or two, starting with finding out whether cron works.

I manage to edit my crontab file:

* * * * * touch ron.touch

And that does in fact touch ron.touch every minute. Life is good. Despite Apple deprecating cron I doubt they’d really remove it, so I feel pretty safe using it. And it seems that if we write a Ruby program that does the work, we can execute it.

One thing to learn is how to find out what the program has done, but clearly I can update a file and I gather that cron optionally writes log files, so we could use those. Checking, I find that it’s not logging now. Also I learn that I can redirect stdout and stderr for my job if i care to. Anyway I consider this something we can solve later.

Well, it’s coming up on lunch time, possibly because Chet and I have been catching up on Certified Agile Leadership, Model T driving, and the like.

Anyway, a little progress and thus, this report.