Sha256: 961544bc4c9dc6f6deec3383c3b9bbc9b796c83a92d9b4211bf0be9587765734

Contents?: true

Size: 1.49 KB

Versions: 5

Compression:

Stored size: 1.49 KB

Contents

#!/usr/bin/env ruby

require 'pathname'

require 'socket'
fqdn = Socket.gethostbyname(Socket.gethostname).first
port = 9292
$stdout.sync = true
@root = (Pathname.new(__FILE__).parent.parent + 'lib').expand_path
$: << @root.to_s
action = ARGV[0]

case action
when "start"
  require 'rubygems'
  require 'rack'
  require 'visage-app'

  puts ' _    ___'
  puts '| |  / (_)________ _____ ____'
  puts '| | / / / ___/ __ `/ __ `/ _ \\'
  puts '| |/ / (__  ) /_/ / /_/ /  __/'
  puts '|___/_/____/\__,_/\__, /\___/'
  puts '                 /____/'
  puts
  puts "will be running at http://#{fqdn}:#{port}/"

  if Visage::Profile.old_format?
    puts
    puts "The Visage profile format has changed!"
    puts "You need to upgrade your profiles."
    puts "Please run:"
    puts
    puts "  #{$0} upgrade"
    puts
    exit 1
  end

  puts
  puts "Looking for RRDs in #{Visage::Config.rrddir}"
  puts

  config = (@root + 'lib/visage-app/config.ru').to_s
  server = Rack::Server.new(:config => config, :Port => port, :server => "webrick")
  server.start
when "genapache"
  require 'socket'
  fqdn = Socket.gethostbyname(Socket.gethostname).first
  public_dir = (@root + 'lib/visage-app/public').to_s

  puts <<-CONFIG
<VirtualHost *>
  ServerName #{fqdn}
  ServerAdmin root@#{fqdn}

  DocumentRoot #{public_dir}

  <Directory "#{public_dir}">
    Options FollowSymLinks Indexes
    AllowOverride None
    Order allow,deny
    Allow from all
  </Directory>

</VirtualHost>
  CONFIG
else
  puts "Usage: visage <start|genapache>"
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
visage-app-2.1.0 bin/visage-app
visage-app-2.0.5 bin/visage-app
visage-app-2.0.4 bin/visage-app
visage-app-2.0.2 bin/visage-app
visage-app-2.0.0 bin/visage-app