def set_auth_path(hash)
if hash.has_key?(:auth)
warning "Command #{@template.inspect} in #{@botmodule} uses old :auth syntax, please upgrade"
end
if hash.has_key?(:full_auth_path)
warning "Command #{@template.inspect} in #{@botmodule} sets :full_auth_path, please don't do this"
else
pre = @botmodule
words = items.reject{ |x|
x == pre || x.kind_of?(Symbol) || x =~ /\[|\]/
}
if words.empty?
post = nil
else
post = words.first
end
if hash.has_key?(:auth_path)
extra = hash[:auth_path]
if extra.sub!(/^:/, "")
pre += "::" + post
post = nil
end
if extra.sub!(/:$/, "")
if words.length > 1
post = [post,words[1]].compact.join("::")
end
end
pre = nil if extra.sub!(/^!/, "")
post = nil if extra.sub!(/!$/, "")
extra = nil if extra.empty?
else
extra = nil
end
hash[:full_auth_path] = [pre,extra,post].compact.join("::")
debug "Command #{@template} in #{botmodule} will use authPath #{hash[:full_auth_path]}"
end
end