Class: Thin::Commands::Server::Start

Inherits:
Base show all
Defined in:
lib/thin/commands/server/start.rb

Instance Attribute Summary collapse

Attributes inherited from Thin::Command

#args

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#cwd

Methods inherited from Thin::Command

command_name, #initialize

Constructor Details

This class inherits a constructor from Thin::Command

Instance Attribute Details

#addressObject

Returns the value of attribute address.



3
4
5
# File 'lib/thin/commands/server/start.rb', line 3

def address
  @address
end

#daemonizeObject

Returns the value of attribute daemonize.



3
4
5
# File 'lib/thin/commands/server/start.rb', line 3

def daemonize
  @daemonize
end

#environmentObject

Returns the value of attribute environment.



3
4
5
# File 'lib/thin/commands/server/start.rb', line 3

def environment
  @environment
end

#groupObject

Returns the value of attribute group.



3
4
5
# File 'lib/thin/commands/server/start.rb', line 3

def group
  @group
end

#log_fileObject

Returns the value of attribute log_file.



3
4
5
# File 'lib/thin/commands/server/start.rb', line 3

def log_file
  @log_file
end

#pid_fileObject

Returns the value of attribute pid_file.



3
4
5
# File 'lib/thin/commands/server/start.rb', line 3

def pid_file
  @pid_file
end

#portObject

Returns the value of attribute port.



3
4
5
# File 'lib/thin/commands/server/start.rb', line 3

def port
  @port
end

#timeoutObject

Returns the value of attribute timeout.



3
4
5
# File 'lib/thin/commands/server/start.rb', line 3

def timeout
  @timeout
end

#traceObject

Returns the value of attribute trace.



3
4
5
# File 'lib/thin/commands/server/start.rb', line 3

def trace
  @trace
end

#userObject

Returns the value of attribute user.



3
4
5
# File 'lib/thin/commands/server/start.rb', line 3

def user
  @user
end

Class Method Details

.detailed_helpObject



24
25
26
27
28
29
30
31
# File 'lib/thin/commands/server/start.rb', line 24

def self.detailed_help
  <<-EOF
usage: thin start [PATH] [options]

  Starts a new Thin web server for the Rails application in PATH
  (default to current directory).
EOF
end

.helpObject



20
21
22
# File 'lib/thin/commands/server/start.rb', line 20

def self.help
  "Starts a new Thin web server for a Rails application."
end

Instance Method Details

#runObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/thin/commands/server/start.rb', line 5

def run
  Dir.chdir cwd
  server = Thin::RailsServer.new(address, port)

  server.log_file = log_file
  server.pid_file = pid_file
  server.trace    = trace
  server.timeout  = timeout.to_i

  server.change_privilege user, group || user if user
  server.start
  server.daemonize if daemonize
  server.listen!
end