# 50sp.rb - select-plugins plugin SP_PREFIX = 'sp' @sp_path = [( @conf["#{SP_PREFIX}.path"] || "#{TDiary.root}/misc/plugin" )].flatten @sp_path = @sp_path.collect do |path| /\/$/ =~ path ? path.chop : path end @sp_path << "#{TDiary.root}/misc/plugin" if @sp_path.include?('misc/plugin') @sp_path.concat TDiary::Extensions::constants.map {|extension| TDiary::Extensions::const_get( extension ).sp_path }.flatten.compact.uniq # 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 ) "https://github.com/tdiary/tdiary-docs-#{@conf.lang}/wiki/#{CGI::escape( file )}" end #