lib/plezi/base/dsl.rb in plezi-0.7.3 vs lib/plezi/base/dsl.rb in plezi-0.7.4

- old
+ new

@@ -151,10 +151,23 @@ # accepts same options as route. def shared_route(path, controller = nil, &block) Plezi::DSL.shared_route(path, controller, &block) end +# defines a method with a special name, such as "humens.txt". +# +# this could be used in controller classes, to define special routes which might defy +# normal Ruby naming conventions, such as "/welcome-home", "/play!", etc' +# +# could also be used to define methods with special formatting, such as "humans.txt", +# until a more refined way to deal with formatting will be implemented. +def def_special_method name, obj=self, &block + obj.instance_eval { define_method name.to_s.to_sym, &block } +end + + + # finishes setup of the servers and starts them up. This will hange the proceess. # # this method is called automatically by the Plezi framework. # # it is recommended that you DO NOT CALL this method. @@ -168,10 +181,19 @@ undef shared_route undef start_services Plezi.start_services end +# restarts the Plezi app with the same arguments as when it was started. +# +# EXPERIMENTAL +def restart_plezi_app + exec "/usr/bin/env ruby #{$PL_SCRIPT} #{$PL_ARGV.join ' '}" +end + # sets to start the services once dsl script is finished loading. at_exit { start_services } unless ( defined?(NO_PLEZI_AUTO_START) || defined?(BUILDING_PLEZI_TEMPLATE) || defined?(PLEZI_ON_RACK) ) # sets a name for the process (on some systems). +$PL_SCRIPT = $0 +$PL_ARGV = $*.dup $0="Plezi (Ruby)"