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(/^\sserver.port\s=\s*(\d+)/).first rescue
default_port
ip = config.scan(/^\sserver.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