lib/resque/server.rb in mongo-resque-1.19.0.1 vs lib/resque/server.rb in mongo-resque-1.20.0

- old
+ new

@@ -2,16 +2,26 @@ require 'erb' require 'resque' require 'resque/version' require 'time' +if defined? Encoding + Encoding.default_external = Encoding::UTF_8 +end + module Resque class Server < Sinatra::Base dir = File.dirname(File.expand_path(__FILE__)) set :views, "#{dir}/server/views" - set :public, "#{dir}/server/public" + + if respond_to? :public_folder + set :public_folder, "#{dir}/server/public" + else + set :public, "#{dir}/server/public" + end + set :static, true helpers do include Rack::Utils alias_method :h, :escape_html @@ -175,35 +185,35 @@ get "/?" do redirect url_path(:overview) end %w( overview workers ).each do |page| - get "/#{page}.poll" do + get "/#{page}.poll/?" do show_for_polling(page) end - get "/#{page}/:id.poll" do + get "/#{page}/:id.poll/?" do show_for_polling(page) end end %w( overview queues working workers key ).each do |page| - get "/#{page}" do + get "/#{page}/?" do show page end - get "/#{page}/:id" do + get "/#{page}/:id/?" do show page end end post "/queues/:id/remove" do Resque.remove_queue(params[:id]) redirect u('queues') end - get "/failed" do + get "/failed/?" do if Resque::Failure.url redirect Resque::Failure.url else show :failed end @@ -219,36 +229,36 @@ Resque::Failure.requeue(num) end redirect u('failed') end - get "/failed/requeue/:index" do + get "/failed/requeue/:index/?" do Resque::Failure.requeue(params[:index]) if request.xhr? return Resque::Failure.all(params[:index])['retried_at'] else redirect u('failed') end end - get "/failed/remove/:index" do + get "/failed/remove/:index/?" do Resque::Failure.remove(params[:index]) redirect u('failed') end - get "/stats" do + get "/stats/?" do redirect url_path("/stats/resque") end - get "/stats/:id" do + get "/stats/:id/?" do show :stats end - get "/stats/keys/:key" do + get "/stats/keys/:key/?" do show :stats end - get "/stats.txt" do + get "/stats.txt/?" do info = Resque.info stats = [] stats << "resque.pending=#{info[:pending]}" stats << "resque.processed+=#{info[:processed]}"