#!/usr/bin/env ruby
#
# This file was generated by Merb's GemManagement
#
# The application 'merb-core' is installed as part of a gem, and
# this file is here to facilitate running it.

begin 
  require 'minigems'
rescue LoadError 
  require 'rubygems'
end

# use gems dir if ../gems exists - eg. only for ./bin/merb
if File.directory?(gems_dir = File.join(File.dirname(__FILE__), '..', 'gems'))
  $BUNDLE = true; Gem.clear_paths; Gem.path.replace([File.expand_path(gems_dir)])
  ENV["PATH"] = "#{File.dirname(__FILE__)}:#{gems_dir}/bin:#{ENV["PATH"]}"
  if (local_gem = Dir[File.join(gems_dir, "specifications", "merb-core-*.gemspec")].last)
    version = File.basename(local_gem)[/-([\.\d]+)\.gemspec$/, 1]
  end
end

version ||= ">= 0"

if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
  version = $1
  ARGV.shift
end

gem 'merb-core', version
load 'merb'
