Sha256: 8681b979f22fc44388682bebf851f204b36c26cc6a3a34e33db28782261e3f7d

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

command 'start gateway server' do |c|
  c.option '--host HOSTNAME', nil, 'What hostname to listen on'
  c.option '--port PORT', nil, 'What port to listen on'

  c.action do |args, options|
    options.default(root: Brief.pwd, port: 9094, host: '0.0.0.0')

    require 'thin'
    require 'rack/handler/thin'
    require 'brief/server/gateway'
    Brief::Server::Gateway.start(port: options.port, host: options.host, root: Pathname(options.root))
  end
end

command 'start drb server' do |c|
  c.option '--host HOSTNAME', String, 'What hostname to listen on'
  c.option '--port PORT', String, 'What port to listen on'
  c.option '--gateway', 'Create a gateway instead of a briefcase'

  c.action do |args, options|
    options.default(root: Brief.pwd)

    require 'drb'

    root = Pathname(options.root)

    object = if options.gateway
               Brief::Server::Distributed.new(root: root, briefcase_options: {eager: true})
             else
               Brief::Briefcase.new(root: root, eager: true)
             end

    puts "== starting distributed service"
    DRb.start_service "druby://:#{ options.port || 9000 }", object
    trap("INT") { DRb.stop_service }
    DRb.thread.join()
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
brief-1.9.8 lib/brief/cli/server.rb