public
Description: Merb More: The Full Stack. Take what you need; leave what you don't.
Homepage: http://www.merbivore.com
Clone URL: git://github.com/wycats/merb-more.git
bitbckt (author)
Sun May 11 22:37:03 -0700 2008
commit  904311ecd361fcd8ba6c0a73d1496d2194a5403b
tree    10b340cb990ce751288b71935b12826e99b30020
parent  5790d79ee3ba63de69bdf242ea66a877ded703f6
merb-more / merb-freezer / bin / frozen-merb
100644 59 lines (53 sloc) 1.71 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env ruby
 
root = nil
%w[-m --merb-root].detect { |o| root = ARGV.index(o) }
__DIR__ = root ? ARGV[root+1] : Dir.getwd
framework = File.join(__DIR__,"framework")
 
# load merb from the framework folder
if File.directory?(framework)
  puts "Running from frozen framework"
  core = File.join(framework,"merb-core")
  if File.directory?(core)
    puts "using merb-core from #{core}"
    $:.unshift 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|
      $:.unshift 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|
      $:.unshift File.join(plugins,d,'lib')
    end
  end
  require "merb-core/core_ext/kernel"
  require "merb-core/core_ext/rubygems"
else
  # load from the gems folder
  gem = Dir["./gems/gems/merb-core-*"].last
  if 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")
  else
    puts "Can't run frozen Merb from framework/ and/or gems/ please freeze Merb"
    puts "Merb will try to start using the system gems"
  end
end
 
# load submodule gems
gem_submodules_dir = File.join(__DIR__,"gems/submodules")
if File.directory?(gem_submodules_dir)
  Dir["#{gem_submodules_dir}/*"].each do |dir|
    $:.unshift File.join(dir,"lib")
  end
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! if (File.directory?(framework) || gem)
Merb.start