Created
June 5, 2017 15:17
-
-
Save brandondrew/e361f60f84f46916419e7fe606309c27 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# This is a very rough proof-of-concept for an interactive automated checklist | |
# of things that you need to check to get iHat running properly. | |
# | |
# A new item can be easily added as a manual step for the developer to check. | |
# But each step can also have an automated check added to it, so that the | |
# developer doesn't need to spend time checking, or even know how to check | |
# a particular item in the list. | |
# | |
# This way items that are very hard (or impossible) to automate can still be | |
# added to the list. But also this way it becomes far more useful than a | |
# static checklist on a wiki page or README (which is more likely to go | |
# out of date, anyway). | |
# | |
# It can also be easily adapted for multiple different approaches to | |
# running iHat: things that only apply to one approach can be skipped, or | |
# a different method of checking something can be done based on the | |
# approach chosen. | |
# | |
# It can also be extended to check things other than just iHat. In fact, | |
# it is intended to be extended to cover everything not already checked | |
# elsewhere. | |
# | |
require "faraday" | |
def check(question, &block) | |
puts question | |
if block | |
yield | |
else | |
puts " -- hit [return] to continue -- " | |
reply = gets.chomp | |
end | |
end | |
def ihat_approach | |
@ihat_approach ||= begin | |
puts "Which approach to running iHat are you using?" | |
puts " 1) Everything on a local VM, managed by Valdo π± " | |
puts " 2) Everything running remotely π " | |
puts " 3) iHat running locally, hitting a remote Grobid and Ox Garage π π " | |
puts "The third way is recommended." | |
[:zero, :local_vm, :fully_remote, :hybrid ][gets.chomp.to_i] | |
end | |
end | |
# TODO: use highline, or something newer if there is something maintained | |
check("Are you connected to the VPN?") | |
check "Is iHat running?" do | |
# TODO: get URL from .env.development, to allow a higher degree of confidence. | |
if Faraday.head("http://localhost:3000/").status == 200 | |
puts "Yes, probably." | |
else | |
puts "No, probably not." | |
end | |
end | |
check "Is iHat configured to hit Grobid?" | |
check "Is iHat configured to hit Ox Garage?" | |
check "Do you have your Tahi environment variables set up?" | |
check "Do you have your iHat environment variables set up?" | |
check "Are your Tahi credentials for S3 working?" | |
check "Are your iHat credentials for S3 working?" | |
if ihat_approach == :local_vm | |
check "Is your ~/.ploprc set up?" | |
check "Are all of your Valdo repositories up-to-date?" | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment