app_path = ARGV[0]
app_type = ARGV[1]

unless app_path
  puts "Usage: aspnet <application_path> [rails|sinatra]"
  puts <<EOS

Generate a new Rack application capable of running on ASP.NET-enabled
web-servers. Given an application_path, it generates the appropriate
web.config and copies IronRuby binaries to the bin directory, along with
Cassini, a local ASP.NET development web-server. Also, given a optional
application type, it generates the appropriate config.ru file for that
web-framework; 'rails' and 'sinatra' are supported today, and leaving it
blank generates a raw rack config.ru.
EOS
  exit(1)
end

lib = File.dirname(__FILE__) + '/../lib'
aspnet_lib = 'rack/deploy/aspnet'
if File.directory? lib
  require File.join(lib, aspnet_lib)
else
  require 'rubygems'
  gem 'ironruby-rack'
  require aspnet_lib
end

Rack::Deploy::ASPNETApplication.new(app_path, app_type).generate
