-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
75 lines (65 loc) · 2.16 KB
/
Rakefile
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
require 'rubygems'
Gem.clear_paths
Gem.path.unshift(File.join(File.dirname(__FILE__), "gems"))
require 'rake'
require 'rake/rdoctask'
require 'rake/testtask'
require 'spec/rake/spectask'
require 'fileutils'
##
# requires frozen merb-core (from /framework)
# adds the other components to the load path
def require_frozen_framework
framework = File.join(File.dirname(__FILE__), "framework")
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")
require 'merb-core'
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
p "merb doesn't seem to be frozen in /framework"
require 'merb-core'
end
end
if ENV['FROZEN']
require_frozen_framework
else
require 'merb-core'
end
require 'merb-core/tasks/merb'
include FileUtils
# Load the basic runtime dependencies; this will include
# any plugins and therefore plugin rake tasks.
init_env = ENV['MERB_ENV'] || 'rake'
Merb.load_dependencies(:environment => init_env)
# Get Merb plugins and dependencies
Merb::Plugins.rakefiles.each { |r| require r }
# Load any app level custom rakefile extensions from lib/tasks
tasks_path = File.join(File.dirname(__FILE__), "lib", "tasks")
rake_files = Dir["#{tasks_path}/*.rake"]
rake_files.each{|rake_file| load rake_file }
desc "start runner environment"
task :merb_env do
Merb.start_environment(:environment => init_env, :adapter => 'runner')
end
##############################################################################
# ADD YOUR CUSTOM TASKS IN /lib/tasks
# NAME YOUR RAKE FILES file_name.rake
##############################################################################