Class: RakeUp::ServerTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- RakeUp::ServerTask
- Includes:
- Rake::DSL
- Defined in:
- lib/rakeup/server_task.rb
Instance Attribute Summary collapse
-
#echo_commands ⇒ Object
Returns the value of attribute echo_commands.
-
#host ⇒ Object
Returns the value of attribute host.
-
#name ⇒ Object
Returns the value of attribute name.
-
#pid_file ⇒ Object
Returns the value of attribute pid_file.
-
#port ⇒ Object
Returns the value of attribute port.
-
#rackup_bin ⇒ Object
Returns the value of attribute rackup_bin.
-
#rackup_file ⇒ Object
Returns the value of attribute rackup_file.
-
#restart_command ⇒ Object
Returns the value of attribute restart_command.
-
#run_command ⇒ Object
Commands.
-
#server ⇒ Object
Returns the value of attribute server.
-
#start_command ⇒ Object
Returns the value of attribute start_command.
-
#stop_command ⇒ Object
Returns the value of attribute stop_command.
Instance Method Summary collapse
- #host_option ⇒ Object
-
#initialize(name = :server) {|_self| ... } ⇒ ServerTask
constructor
A new instance of ServerTask.
- #rackup_command(options = nil) ⇒ Object
Constructor Details
#initialize(name = :server) {|_self| ... } ⇒ ServerTask
Returns a new instance of ServerTask.
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/rakeup/server_task.rb', line 25 def initialize(name = :server) @name = name @host = 'localhost' @port = 4567 @pid_file = "tmp/#{name}.pid" @rackup_file = "#{name}.ru" @rackup_bin = "bundle exec rackup" @server = "thin" @echo_commands = true yield self if block_given? define_tasks end |
Instance Attribute Details
#echo_commands ⇒ Object
Returns the value of attribute echo_commands.
16 17 18 |
# File 'lib/rakeup/server_task.rb', line 16 def echo_commands @echo_commands end |
#host ⇒ Object
Returns the value of attribute host.
11 12 13 |
# File 'lib/rakeup/server_task.rb', line 11 def host @host end |
#name ⇒ Object
Returns the value of attribute name.
10 11 12 |
# File 'lib/rakeup/server_task.rb', line 10 def name @name end |
#pid_file ⇒ Object
Returns the value of attribute pid_file.
14 15 16 |
# File 'lib/rakeup/server_task.rb', line 14 def pid_file @pid_file end |
#port ⇒ Object
Returns the value of attribute port.
12 13 14 |
# File 'lib/rakeup/server_task.rb', line 12 def port @port end |
#rackup_bin ⇒ Object
Returns the value of attribute rackup_bin.
17 18 19 |
# File 'lib/rakeup/server_task.rb', line 17 def rackup_bin @rackup_bin end |
#rackup_file ⇒ Object
Returns the value of attribute rackup_file.
15 16 17 |
# File 'lib/rakeup/server_task.rb', line 15 def rackup_file @rackup_file end |
#restart_command ⇒ Object
Returns the value of attribute restart_command.
23 24 25 |
# File 'lib/rakeup/server_task.rb', line 23 def restart_command @restart_command end |
#run_command ⇒ Object
Commands
20 21 22 |
# File 'lib/rakeup/server_task.rb', line 20 def run_command @run_command end |
#server ⇒ Object
Returns the value of attribute server.
13 14 15 |
# File 'lib/rakeup/server_task.rb', line 13 def server @server end |
#start_command ⇒ Object
Returns the value of attribute start_command.
21 22 23 |
# File 'lib/rakeup/server_task.rb', line 21 def start_command @start_command end |
#stop_command ⇒ Object
Returns the value of attribute stop_command.
22 23 24 |
# File 'lib/rakeup/server_task.rb', line 22 def stop_command @stop_command end |
Instance Method Details
#host_option ⇒ Object
43 44 45 |
# File 'lib/rakeup/server_task.rb', line 43 def host_option host && "-o #{host}" end |
#rackup_command(options = nil) ⇒ Object
39 40 41 |
# File 'lib/rakeup/server_task.rb', line 39 def rackup_command( = nil) [rackup_bin, "-s #{server}", host_option, "-p #{port}", "-P #{pid_file}", , rackup_file].compact.join(' ') end |