Sha256: 1278584bdb0c6321b2bbc7520d4e86b6d4a34e097024db5b60141dbf5b468bae
Contents?: true
Size: 850 Bytes
Versions: 3
Compression:
Stored size: 850 Bytes
Contents
#!/usr/bin/env ruby command = ARGV[0] ROOT = Dir.pwd FOLDER = Dir.pwd.split('/').last @local_conf = './config/nginx.conf' @target_conf = '/etc/nginx/sites-enabled/%s.conf' % FOLDER 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 = conf.gsub(/`([^`]+)`/) { `#{$1}`.chomp } conf = conf.gsub('$ROOT', ROOT) conf = conf.gsub('$FOLDER', FOLDER) conf 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' % @target_conf else puts ' show # show rendered config' puts ' install # install config/nginx.conf to %s' % @target_conf end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lux-fw-0.2.3 | ./bin/cli/nginx |
lux-fw-0.2.1 | ./bin/cli/nginx |
lux-fw-0.1.35 | ./bin/cli/nginx |