[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

webrick help

Eko Budi Setiyo

2/25/2005 12:52:00 AM

Hi all,
Need help from you all
#+++++++++++++++++++++++++++++++++++++++=
#file start_webrick.rb

require 'webrick'
include WEBrick
load('class.index.rb')

def start_webrick(config = {})
config.update(:Port => 80)
config.update(:DirectoryIndex => 'coreLoader.rb')
$server = HTTPServer.new(config)
yield server if block_given?
['INT','TERM'].each { |signal|
trap(signal) {server.shutdown}
}
$server.mount('/index',Index)
$server.start
end

start_webrick(:DocumentRoot => File.dirname(__FILE__))

#++++++++++++++++++++++++++++++++++++++++
#file class.index.rb
class Index < HTTPServlet::AbstractServlet

def do_GET(req,resp)
$Layout = ''
load('coreLoader.rb')
resp.body = $Layout
end

def Index.get_instance config, *options
load __FILE__
load('coreLoader.rb')
Index.new config, *options
end

end


#+++++++++++++++++++++++++++++++++++++++++++

Any body know how to make file 'coreLoader.rb' always 're-loaded' when
browser visit http://localhost/index/xxx/yyy
The reason is 'coreLoader.rb' is the only entry for my website
framework. so the result of load('coreLoader.rb') not always the same

regards
Eko



3 Answers

Alexander Kellett

2/25/2005 9:30:00 AM

0

try using require "auto-reload.rb"
can be found in mod_ruby distribution.
btw, your email client is buggy. all
your lines are wrapping. so the source
is nonsensical.

Alex

On Feb 25, 2005, at 1:51 AM, Eko Budi Setiyo wrote:
> Hi all,
> Need help from you all
> #+++++++++++++++++++++++++++++++++++++++=
> #file start_webrick.rb
>
> require 'webrick'
> include WEBrick
> load('class.index.rb')
>
> def start_webrick(config = {}) config.update(:Port => 80)
> config.update(:DirectoryIndex => 'coreLoader.rb')
> $server = HTTPServer.new(config)
> yield server if block_given?
> ['INT','TERM'].each { |signal|
> trap(signal) {server.shutdown}
> }
> $server.mount('/index',Index) $server.start
> end
> start_webrick(:DocumentRoot => File.dirname(__FILE__))
>
> #++++++++++++++++++++++++++++++++++++++++
> #file class.index.rb
> class Index < HTTPServlet::AbstractServlet
> def do_GET(req,resp)
> $Layout = ''
> load('coreLoader.rb')
> resp.body = $Layout end
> def Index.get_instance config, *options
> load __FILE__
> load('coreLoader.rb') Index.new config,
> *options end
> end
>
>
> #+++++++++++++++++++++++++++++++++++++++++++
>
> Any body know how to make file 'coreLoader.rb' always 're-loaded' when
> browser visit http://localhost/index/xxx/yyy
> The reason is 'coreLoader.rb' is the only entry for my website
> framework. so the result of load('coreLoader.rb') not always the same
>
> regards
> Eko
>



Eko Budi Setiyo

2/25/2005 9:40:00 AM

0

Alexander Kellett wrote:

> try using require "auto-reload.rb"
> can be found in mod_ruby distribution.
> btw, your email client is buggy. all
> your lines are wrapping. so the source
> is nonsensical.
>
> Alex
>
> On Feb 25, 2005, at 1:51 AM, Eko Budi Setiyo wrote:
>
>> Hi all,
>> Need help from you all
>> #+++++++++++++++++++++++++++++++++++++++=
>> #file start_webrick.rb
>>
>> require 'webrick'
>> include WEBrick
>> load('class.index.rb')
>>
>> def start_webrick(config = {}) config.update(:Port => 80)
>> config.update(:DirectoryIndex => 'coreLoader.rb')
>> $server = HTTPServer.new(config)
>> yield server if block_given?
>> ['INT','TERM'].each { |signal|
>> trap(signal) {server.shutdown}
>> }
>> $server.mount('/index',Index) $server.start
>> end
>> start_webrick(:DocumentRoot => File.dirname(__FILE__))
>>
>> #++++++++++++++++++++++++++++++++++++++++
>> #file class.index.rb
>> class Index < HTTPServlet::AbstractServlet
>> def do_GET(req,resp)
>> $Layout = ''
>> load('coreLoader.rb')
>> resp.body = $Layout end
>> def Index.get_instance config, *options
>> load __FILE__
>> load('coreLoader.rb') Index.new config,
>> *options end
>> end
>>
>>
>> #+++++++++++++++++++++++++++++++++++++++++++
>>
>> Any body know how to make file 'coreLoader.rb' always 're-loaded'
>> when browser visit http://localhost/index/xxx/yyy
>> The reason is 'coreLoader.rb' is the only entry for my website
>> framework. so the result of load('coreLoader.rb') not always the same
>>
>> regards
>> Eko
>>
>
>
>
>
thanks

I will try using it



Eko Budi Setiyo

2/28/2005 1:21:00 AM

0

Eko Budi Setiyo wrote:

> Alexander Kellett wrote:
>
>> try using require "auto-reload.rb"
>> can be found in mod_ruby distribution.
>> btw, your email client is buggy. all
>> your lines are wrapping. so the source
>> is nonsensical.
>>
>> Alex
>>
>> On Feb 25, 2005, at 1:51 AM, Eko Budi Setiyo wrote:
>>
>>> Hi all,
>>> Need help from you all
>>> #+++++++++++++++++++++++++++++++++++++++=
>>> #file start_webrick.rb
>>>
>>> require 'webrick'
>>> include WEBrick
>>> load('class.index.rb')
>>>
>>> def start_webrick(config = {}) config.update(:Port => 80)
>>> config.update(:DirectoryIndex => 'coreLoader.rb')
>>> $server = HTTPServer.new(config)
>>> yield server if block_given?
>>> ['INT','TERM'].each { |signal|
>>> trap(signal) {server.shutdown}
>>> }
>>> $server.mount('/index',Index) $server.start
>>> end
>>> start_webrick(:DocumentRoot => File.dirname(__FILE__))
>>>
>>> #++++++++++++++++++++++++++++++++++++++++
>>> #file class.index.rb
>>> class Index < HTTPServlet::AbstractServlet
>>> def do_GET(req,resp)
>>> $Layout = ''
>>> load('coreLoader.rb')
>>> resp.body = $Layout end
>>> def Index.get_instance config, *options
>>> load __FILE__
>>> load('coreLoader.rb') Index.new config,
>>> *options end
>>> end
>>>
>>>
>>> #+++++++++++++++++++++++++++++++++++++++++++
>>>
>>> Any body know how to make file 'coreLoader.rb' always 're-loaded'
>>> when browser visit http://localhost/index/xxx/yyy
>>> The reason is 'coreLoader.rb' is the only entry for my website
>>> framework. so the result of load('coreLoader.rb') not always the same
>>>
>>> regards
>>> Eko
>>>
>>
>>
>>
>>
> thanks
>
> I will try using it
>
>
>
>
Doesn't work

regards
Eko