Forum: Ruby on Rails script/server script

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Seb (Guest)
on 2007-03-10 17:51
(Received via mailing list)
Hi all,

I'm new to rails (and ruby) so bear with me.

I've analysed script/server (and subsequent scripts) and as far as I
can tell, the actions performed in a newly created rails app (on my
GNU/Linux box running lighttpd) when

  $ script/server lighttpd

is called, can be summarised thus (ignoring the 'requires'):

    RAILS_ROOT = '/home/<your_home>/rails/<your_app>'

    Rails::Initializer.run(:set_load_path)

    FileUtils.mkdir_p(%w( tmp/sessions tmp/cache tmp/sockets ))

    server = 'lighttpd'
    configuration =
Rails::Initializer.run(:initialize_logger).configuration
    detach = false
    config_file = "#{RAILS_ROOT}/config/lighttpd.conf'
    config  = IO.read(config_file)
    default_port, default_ip = 3000, '0.0.0.0'
    port = config.scan(/^\s*server.port\s*=\s*(\d+)/).first rescue
default_port
    ip   = config.scan(/^\s*server.bind\s*=\s*"([^"]+)"/).first rescue
default_ip

    puts "=> Rails application started on http://#{ip ||
default_ip}:#{port || default_port}"

Having saved some 'state' in these local variables, it then 'rakes'
the tmp/sockets directory and fires up lighttpd.

My question is why save this state in the local variables?  How is
this information useful, and to what processes?

Any help much appreciated.

Sebastian
Gordon (Guest)
on 2007-03-14 18:02
(Received via mailing list)
Sebastian,

I'm fairly new here too, but my impression is that questions like
these (design/architecture questions) are better directed to the
rails-core list. I think this list is more for usage questions.

Gordon
Marcelo (Guest)
on 2007-03-14 20:21
I agree with Gordon... mostly because this is a user list, and I don''t
think many of the rails core members read the list on a regular basis,
so your point, as valid as it could be, would go unnoticed by the core
members Seb.

Cheers.
This topic is locked and can not be replied to.