# -*- coding: utf-8; -*- # 50sp.rb - select-plugins plugin SP_PREFIX = 'sp' @sp_path = [( @conf["#{SP_PREFIX}.path"] || "#{TDiary::PATH}/misc/plugin" )].flatten @sp_path = @sp_path.collect do |path| /\/$/ =~ path ? path.chop : path end @sp_path << "#{TDiary::PATH}/misc/plugin" if @sp_path.include?('misc/plugin') # FIXME: dirty hack, it should create TDiary::Server::Config.plugin_path TDiary::Contrib::Plugin.setup( @sp_path ) if defined?(TDiary::Contrib) # get plugin option def sp_option( key ) @conf["#{SP_PREFIX}.#{key}"] end # hash of paths from array of dirs def sp_hash_from_dirs( dirs ) r = Hash.new dirs.each do |dir| Dir::glob( "#{dir}/*.rb" ).each do |path| filename = File.basename( path ) unless r[ filename ] then r[ filename ] = path end end end r end # url of the document def sp_doc_url( file ) "http://docs.tdiary.org/#{@conf.lang}/?#{CGI::escape( file )}" end #