diff options
-rw-r--r-- | src/guff/cli.cr | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/guff/cli.cr b/src/guff/cli.cr index 600f5d4..3752621 100644 --- a/src/guff/cli.cr +++ b/src/guff/cli.cr @@ -31,10 +31,21 @@ module Guff::CLI @data = Data.load(@config.system_dir) end + # list of subdirectories to create in data directory + DIRS = %w{files themes cache/themes} + def run + # create data dir STDERR.puts "Initializing data directory" Dir.mkdir(@config.data_dir) unless Dir.exists?(@config.data_dir) + # create data subdirs + DIRS.each do |dir| + abs_path = File.join(@config.data_dir, dir) + Dir.mkdir_p(abs_path) unless Dir.exists?(abs_path) + end + + # create database Guff::Database.new(@config.db_path) do |db| @data.init_sql.each do |sql| db.query(sql) |