Sha256: cf348df99483990232cf028162d2cf0c3c154df4989c0d874536cca68ef000ec
Contents?: true
Size: 672 Bytes
Versions: 52
Compression:
Stored size: 672 Bytes
Contents
desc 'apache-site VIRTUAL_HOST', 'Enable the given virtual host, disabling all others' def apache_site(*args) site = args.shift old_cwd = Dir.pwd Dir.chdir '/etc/apache2/sites-available/' # show available sites if no site was passed as argument unless site puts 'ERROR: Argument site is missing.' puts 'Please call: apache-site my-site' puts puts 'Available sites:' Dir.new(".").each do |file| puts "- #{file}" if file != '.' && file != '..' end exit end has_default = File.exists?('default') exec "sudo a2dissite \*; sudo a2ensite #{"default " if has_default}#{site} && sudo apache2ctl restart" Dir.chdir old_cwd end
Version data entries
52 entries across 52 versions & 1 rubygems