Skip to content
Newer
Older
100644 76 lines (65 sloc) 2.16 KB
e4959ca @grempe Initial commit
grempe authored Aug 24, 2008
1 require 'rubygems'
2 Gem.clear_paths
3 Gem.path.unshift(File.join(File.dirname(__FILE__), "gems"))
4
5 require 'rake'
6 require 'rake/rdoctask'
7 require 'rake/testtask'
8 require 'spec/rake/spectask'
9 require 'fileutils'
10
11 ##
12 # requires frozen merb-core (from /framework)
13 # adds the other components to the load path
14 def require_frozen_framework
15 framework = File.join(File.dirname(__FILE__), "framework")
16 if File.directory?(framework)
17 puts "Running from frozen framework"
18 core = File.join(framework,"merb-core")
19 if File.directory?(core)
20 puts "using merb-core from #{core}"
21 $:.unshift File.join(core,"lib")
22 require 'merb-core'
23 end
24 more = File.join(framework,"merb-more")
25 if File.directory?(more)
26 Dir.new(more).select {|d| d =~ /merb-/}.each do |d|
27 $:.unshift File.join(more,d,'lib')
28 end
29 end
30 plugins = File.join(framework,"merb-plugins")
31 if File.directory?(plugins)
32 Dir.new(plugins).select {|d| d =~ /merb_/}.each do |d|
33 $:.unshift File.join(plugins,d,'lib')
34 end
35 end
36 require "merb-core/core_ext/kernel"
37 require "merb-core/core_ext/rubygems"
38 else
39 p "merb doesn't seem to be frozen in /framework"
40 require 'merb-core'
41 end
42 end
43
44 if ENV['FROZEN']
45 require_frozen_framework
46 else
47 require 'merb-core'
48 end
49
50 require 'merb-core/tasks/merb'
51 include FileUtils
52
53 # Load the basic runtime dependencies; this will include
54 # any plugins and therefore plugin rake tasks.
55 init_env = ENV['MERB_ENV'] || 'rake'
56 Merb.load_dependencies(:environment => init_env)
57
58 # Get Merb plugins and dependencies
59 Merb::Plugins.rakefiles.each { |r| require r }
60
61 # Load any app level custom rakefile extensions from lib/tasks
62 tasks_path = File.join(File.dirname(__FILE__), "lib", "tasks")
63 rake_files = Dir["#{tasks_path}/*.rake"]
64 rake_files.each{|rake_file| load rake_file }
65
66
67 desc "start runner environment"
68 task :merb_env do
69 Merb.start_environment(:environment => init_env, :adapter => 'runner')
70 end
71
72 ##############################################################################
73 # ADD YOUR CUSTOM TASKS IN /lib/tasks
74 # NAME YOUR RAKE FILES file_name.rake
75 ##############################################################################
Something went wrong with that request. Please try again.