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.18.0 bin/apache-site
geordi-0.17.4 bin/apache-site
geordi-0.17.3 bin/apache-site
geordi-0.16.3 bin/apache-site
geordi-0.16.2 bin/apache-site
geordi-0.16.1 bin/apache-site
geordi-0.16.0 bin/apache-site
geordi-0.15.7 bin/apache-site
geordi-0.15.6 bin/apache-site
geordi-0.15.5 bin/apache-site
geordi-0.15.4 bin/apache-site
geordi-0.15.3 bin/apache-site
geordi-0.15.2 bin/apache-site
geordi-0.15.1 bin/apache-site
geordi-0.15.0 bin/apache-site
geordi-0.14.9 bin/apache-site
geordi-0.14.8 bin/apache-site
geordi-0.14.7 bin/apache-site
geordi-0.14.6 bin/apache-site
geordi-0.14.5 bin/apache-site