diff options
author | Paul Duncan <pabs@pablotron.org> | 2016-05-21 16:44:32 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2016-05-21 16:44:32 -0400 |
commit | 18d64e9d11b161bf5b06fd9c8cdf7bc1dabbc4a0 (patch) | |
tree | a7b7c459e939c2773f66a5997b2e6676c9c669cf /src | |
parent | b11313e2fe62932d1a3fa2de21a57bcfd00c2371 (diff) | |
download | guff-18d64e9d11b161bf5b06fd9c8cdf7bc1dabbc4a0.tar.bz2 guff-18d64e9d11b161bf5b06fd9c8cdf7bc1dabbc4a0.zip |
s/assets_dir/system_dir/
Diffstat (limited to 'src')
-rw-r--r-- | src/guff.cr | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/guff.cr b/src/guff.cr index 09f2372..cbedd49 100644 --- a/src/guff.cr +++ b/src/guff.cr @@ -16,7 +16,7 @@ end module Guff class Config - property :mode, :env, :host, :port, :data_dir, :assets_dir + property :mode, :env, :host, :port, :data_dir, :system_dir DEFAULTS = { mode: "help", @@ -24,7 +24,7 @@ module Guff host: "127.0.0.1", port: "8989", data_dir: "./data", - assets_dir: "/usr/local/share/guff", + system_dir: "/usr/local/share/guff", } def initialize @@ -33,7 +33,7 @@ module Guff @host = (ENV["GUFF_HOST"]? || DEFAULTS[:host]) as String @port = (ENV["GUFF_PORT"]? || DEFAULTS[:port]) as String @data_dir = (ENV["GUFF_DATA_DIR"]? || DEFAULTS[:data_dir]) as String - @assets_dir = (ENV["GUFF_ASSETS_DIR"]? || DEFAULTS[:assets_dir]) as String + @system_dir = (ENV["GUFF_SYSTEM_DIR"]? || DEFAULTS[:system_dir]) as String end VALID_MODES = %w{init run help} @@ -56,9 +56,9 @@ module Guff @port = port end - def assets_dir=(dir : String) - raise "missing assets dir: \"#{dir}\"" unless Dir.exists?(dir) - @assets_dir = dir + def system_dir=(dir : String) + raise "missing system dir: \"#{dir}\"" unless Dir.exists?(dir) + @system_dir = dir end def self.parse( @@ -109,10 +109,10 @@ module Guff end p.on( - "-A DIR", "--assets-dir DIR", - "Guff assets directory (defaults to \"#{DEFAULTS[:assets_dir]}\")" + "-S DIR", "--system-dir DIR", + "Guff system directory (defaults to \"#{DEFAULTS[:system_dir]}\")" ) do |arg| - r.assets_dir = arg + r.system_dir = arg end p.separator @@ -625,7 +625,8 @@ module Guff # build absolute path r = File.join( - @context.config.assets_dir, + @context.config.system_dir, + "assets", File.expand_path(path.gsub(PATH_RE, ""), "/") ) @@ -883,7 +884,7 @@ module Guff private def check_dirs { - "assets": @config.assets_dir, + "system": @config.system_dir, "data": @config.data_dir, }.each do |name, dir| unless Dir.exists?(dir) |