Sha256: 09e59cb53db098bf49f772f76f7541391eaaa31092fa71824c198dac6417e5e8

Contents?: true

Size: 713 Bytes

Versions: 1

Compression:

Stored size: 713 Bytes

Contents

#!/usr/bin/env ruby

command = ARGV[0]

@local_conf = './config/nginx.conf'
@nginx_conf = '/etc/nginx/sites-enabled/%s.conf' % Dir.pwd.split('/').last

def build_conf
  conf = File.read(@local_conf) rescue LuxCli.die('Local conf %s not found' % @local_conf)

  LuxCli.die('$ROOT not found in config') unless conf.include?('$ROOT')

  conf.gsub('$ROOT', Dir.pwd)
end

case command
  when 'show'
    puts build_conf
  when 'install'
    File.write './tmp/nginx.conf', build_conf
    puts '# run this manualy'
    puts
    puts 'sudo cp ./tmp/nginx.conf %s && sudo nginx -t' % @nginx_conf
  else
    puts ' show      # show rendered config'
    puts ' install   # install config/nginx.conf to %s' % @nginx_conf
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lux-fw-0.1.17 ./bin/cli/nginx