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-1.8.0 lib/geordi/commands/apache_site.rb
geordi-1.7.1 lib/geordi/commands/apache_site.rb
geordi-1.7.0 lib/geordi/commands/apache_site.rb
geordi-1.6.5 lib/geordi/commands/apache_site.rb
geordi-1.6.4 lib/geordi/commands/apache_site.rb
geordi-1.6.3 lib/geordi/commands/apache_site.rb
geordi-1.6.2 lib/geordi/commands/apache_site.rb
geordi-1.6.1 lib/geordi/commands/apache_site.rb
geordi-1.6.0 lib/geordi/commands/apache_site.rb
geordi-1.5.2 lib/geordi/commands/apache_site.rb
geordi-1.5.1 lib/geordi/commands/apache_site.rb
geordi-1.5.0 lib/geordi/commands/apache_site.rb
geordi-1.4.3 lib/geordi/commands/apache_site.rb
geordi-1.4.2 lib/geordi/commands/apache_site.rb
geordi-1.4.1 lib/geordi/commands/apache_site.rb
geordi-1.4.0 lib/geordi/commands/apache_site.rb
geordi-1.3.2 lib/geordi/commands/apache_site.rb
geordi-1.3.1 lib/geordi/commands/apache_site.rb
geordi-1.3.0 lib/geordi/commands/apache_site.rb
geordi-1.2.3 lib/geordi/commands/apache_site.rb