Sha256: 150997bf62ed3d9acdf1df217cf313393110d66e24a50f2cccde5a0c77975327

Contents?: true

Size: 937 Bytes

Versions: 10

Compression:

Stored size: 937 Bytes

Contents

namespace :websocket_rails do
  desc 'Start the WebsocketRails standalone server.'
  task :start_server do
    require "thin"
    load "#{Rails.root}/config/initializers/events.rb"

    options = WebsocketRails.config.thin_options

    warn_if_standalone_not_enabled!

    fork do
      Thin::Controllers::Controller.new(options).start
    end

    puts "Websocket Rails Standalone Server listening on port #{options[:port]}"
  end

  desc 'Stop the WebsocketRails standalone server.'
  task :stop_server do
    require "thin"
    load "#{Rails.root}/config/initializers/events.rb"

    options = WebsocketRails.config.thin_options

    warn_if_standalone_not_enabled!

    Thin::Controllers::Controller.new(options).stop
  end
end

def warn_if_standalone_not_enabled!
  return if WebsocketRails.standalone?
  puts "Fail!"
  puts "You must enable standalone mode in your events.rb initializer to use the standalone server."
  exit 1
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
websocket-rails-0.4.9 lib/rails/tasks/websocket_rails.tasks
websocket-rails-0.4.8 lib/rails/tasks/websocket_rails.tasks
websocket-rails-0.4.7 lib/rails/tasks/websocket_rails.tasks
websocket-rails-0.4.6 lib/rails/tasks/websocket_rails.tasks
websocket-rails-0.4.5 lib/rails/tasks/websocket_rails.tasks
websocket-rails-0.4.4 lib/rails/tasks/websocket_rails.tasks
websocket-rails-0.4.3 lib/rails/tasks/websocket_rails.tasks
websocket-rails-0.4.2 lib/rails/tasks/websocket_rails.tasks
websocket-rails-0.4.1 lib/rails/tasks/websocket_rails.tasks
websocket-rails-0.4.0 lib/rails/tasks/websocket_rails.tasks