Sha256: cd3563d5bc75c9622d26d39f87672f3c38e87efce929646e2976708e9f1f953a

Contents?: true

Size: 671 Bytes

Versions: 34

Compression:

Stored size: 671 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.exist?('default')
  exec "sudo a2dissite \*; sudo a2ensite #{'default ' if has_default}#{site} && sudo apache2ctl restart"
  Dir.chdir old_cwd
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
geordi-9.3.1 lib/geordi/commands/apache_site.rb
geordi-9.3.0 lib/geordi/commands/apache_site.rb
geordi-9.2.0 lib/geordi/commands/apache_site.rb
geordi-9.1.0 lib/geordi/commands/apache_site.rb
geordi-9.0.0 lib/geordi/commands/apache_site.rb
geordi-8.0.0 lib/geordi/commands/apache_site.rb
geordi-7.0.2 lib/geordi/commands/apache_site.rb
geordi-7.0.1 lib/geordi/commands/apache_site.rb
geordi-7.0.0 lib/geordi/commands/apache_site.rb
geordi-6.1.0 lib/geordi/commands/apache_site.rb
geordi-6.0.1 lib/geordi/commands/apache_site.rb
geordi-6.0.0 lib/geordi/commands/apache_site.rb
geordi-6.0.0.pre.rc1 lib/geordi/commands/apache_site.rb
geordi-5.4.0 lib/geordi/commands/apache_site.rb
geordi-5.3.0 lib/geordi/commands/apache_site.rb
geordi-5.2.4 lib/geordi/commands/apache_site.rb
geordi-5.2.3 lib/geordi/commands/apache_site.rb
geordi-5.2.2 lib/geordi/commands/apache_site.rb
geordi-5.2.1 lib/geordi/commands/apache_site.rb
geordi-5.2.0 lib/geordi/commands/apache_site.rb