diff --git a/setup.go b/setup.go new file mode 100644 index 0000000..b2e453f --- /dev/null +++ b/setup.go @@ -0,0 +1,20 @@ +package main + +import ( + "database/sql" + "fmt" + "io" + "net/http" + "os" + + _ "github.com/mattn/go-sqlite3" +) + +func setup() { + fmt.Println("Initializing the database") + os.MkdirAll("assets/config/", 0755) +} + +func Unzip(file string, dest string) { + +} diff --git a/webserver.go b/webserver.go index 5d3fc2e..0c15df5 100644 --- a/webserver.go +++ b/webserver.go @@ -10,12 +10,21 @@ import ( "fmt" "log" "net/http" + "os" "github.com/gmemstr/pogo/router" ) // Main function that defines routes func main() { + // Check if this is the first time Pogo has been run + // with a lockfile + + if _, err := os.Stat("run.lockfile"); os.IsNotExist(err) { + fmt.Println("This looks like your first time running Pogo,\ngive me a second to set myself up.") + setup() + } + // Start the watch() function in generate_rss.go, which // watches for file changes and regenerates the feed go watch()