#!/usr/bin/env ruby __DIR__ = File.join(File.dirname(__FILE__),"..") framework = File.join(__DIR__,"framework") if File.directory?(framework) puts "Running from frozen framework" core = File.join(framework,"merb-core") if File.directory?(core) $:.push File.join(core,"lib") end more = File.join(framework,"merb-more") if File.directory?(more) Dir.new(more).select {|d| d =~ /merb-/}.each do |d| $:.push File.join(more,d,'lib') end end plugins = File.join(framework,"merb-plugins") if File.directory?(plugins) Dir.new(plugins).select {|d| d =~ /merb_/}.each do |d| $:.push File.join(plugins,d,'lib') end end require "merb-core/core_ext/kernel" require "merb-core/core_ext/rubygems" else gem = Dir.glob(__DIR__ + "/gems/gems/merb-core-*").last raise "Can't run frozen without framework/ or local gem" unless gem require gem + "/lib/merb-core/core_ext/kernel" require gem + "/lib/merb-core/core_ext/rubygems" Gem.clear_paths Gem.path.unshift(__DIR__+"/gems") end require 'merb-core' unless %w[-a --adapter -i --irb-console -r --script-runner].any? { |o| ARGV.index(o) } ARGV.push *%w[-a mongrel] end Merb.frozen! Merb.start