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

Version Path
geordi-2.12.3 lib/geordi/commands/apache_site.rb
geordi-2.12.2 lib/geordi/commands/apache_site.rb
geordi-2.12.1 lib/geordi/commands/apache_site.rb
geordi-2.12.0 lib/geordi/commands/apache_site.rb
geordi-2.11.0 lib/geordi/commands/apache_site.rb
geordi-2.10.1 lib/geordi/commands/apache_site.rb
geordi-2.10.0 lib/geordi/commands/apache_site.rb
geordi-2.9.0 lib/geordi/commands/apache_site.rb
geordi-2.8.0 lib/geordi/commands/apache_site.rb
geordi-2.7.0 lib/geordi/commands/apache_site.rb
geordi-2.6.0 lib/geordi/commands/apache_site.rb
geordi-2.5.0 lib/geordi/commands/apache_site.rb
geordi-2.4.0 lib/geordi/commands/apache_site.rb
geordi-2.3.0 lib/geordi/commands/apache_site.rb
geordi-2.2.0 lib/geordi/commands/apache_site.rb
geordi-2.1.0 lib/geordi/commands/apache_site.rb
geordi-2.0.0 lib/geordi/commands/apache_site.rb
geordi-1.10.0 lib/geordi/commands/apache_site.rb
geordi-1.9.1 lib/geordi/commands/apache_site.rb
geordi-1.9.0 lib/geordi/commands/apache_site.rb