Sha256: da16f09b93620ab5efd8cce5d44751d4cda0cc52b593a38faa39e25ce578120f

Contents?: true

Size: 542 Bytes

Versions: 57

Compression:

Stored size: 542 Bytes

Contents

#!/usr/bin/env ruby

site = ARGV[0]
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

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
geordi-0.9.12 bin/apache-site
geordi-0.9.11 bin/apache-site
geordi-0.9.10 bin/apache-site
geordi-0.9.9 bin/apache-site
geordi-0.9.8 bin/apache-site
geordi-0.9.7 bin/apache-site
geordi-0.9.6 bin/apache-site
geordi-0.9.5 bin/apache-site
geordi-0.9.4 bin/apache-site
geordi-0.9.3 bin/apache-site
geordi-0.9.2 bin/apache-site
geordi-0.9.1 bin/apache-site
geordi-0.9.0 bin/apache-site
geordi-0.8.1 bin/apache-site
geordi-0.8.0 bin/apache-site
geordi-0.7.0 bin/apache-site
geordi-0.6.1 bin/apache-site