Sha256: 2117d20e760cc1761c96678bd01f9ead57d64fda45cb16271ee4de83dd95d62e

Contents?: true

Size: 933 Bytes

Versions: 6

Compression:

Stored size: 933 Bytes

Contents

if ARGV[0] == 's'
  ARGV[0] = 'server'
elsif ARGV[0] == 'ss'
  # production mode with logging
  ARGV = %w{server -m log }
end

LuxCli.class_eval do
  desc :server, 'Start web server'
  method_option :port,  aliases: '-p', default: 3000,  desc: 'Port to run app on', type: :numeric
  method_option :mode,  aliases: '-m', default: 'dev', desc: 'One of the server modes(dev, log, production)'
  method_option :env,   aliases: '-e', default: 'd',   desc: 'Environemnt, only first chart counts'
  method_option :rerun, aliases: '-r', default: false, desc: 'rerun app on every file chenge', type: :boolean
  def server
    mode  = 'LUX_MODE=%s' % options[:mode]
    env   = options[:env][0,1] == 'p' ? 'production' : 'development'

    if options[:rerun]
      Cli.run "#{mode} rerun -p '**/*.{rb,ru}' -d . -d #{LUX_ROOT} 'lux s -p #{options[:port]}'"
    else
      Cli.run "#{mode} puma -e #{env} -p #{options[:port]}"
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
lux-fw-0.5.37 ./bin/cli/server.rb
lux-fw-0.5.36 ./bin/cli/server.rb
lux-fw-0.5.35 ./bin/cli/server.rb
lux-fw-0.5.34 ./bin/cli/server.rb
lux-fw-0.5.33 ./bin/cli/server.rb
lux-fw-0.5.32 ./bin/cli/server.rb