lib/plezi/common/api.rb in plezi-0.12.18 vs lib/plezi/common/api.rb in plezi-0.12.19

- old
+ new

@@ -11,9 +11,14 @@ host parameters.delete(:host) || :default, parameters end # adds a route to the last server created def route(path, controller = nil, &block) + if controller == :client + client_path = File.expand_path(File.join('..','..','..','..','resources','plezi_client.js'), __FILE__) + controller = nil + block = Proc.new { Plezi.cache_needs_update?(client_path) ? Plezi.reload_file(client_path) : Plezi.load_file(client_path) } + end ::Plezi::Base::HTTPRouter.add_route path, controller, &block end # adds a shared route to all existing services and hosts. \ No newline at end of file