3 Gem.path.unshift(File.join(File.dirname(__FILE__), "gems"))
6 require 'rake/rdoctask'
7 require 'rake/testtask'
8 require 'spec/rake/spectask'
14 ##############################################################################
16 ##############################################################################
18 # Load the basic runtime dependencies; this will include
19 # any plugins and therefore plugin rake tasks.
20 init_env = ENV['MERB_ENV'] || 'rake'
21 Merb.load_dependencies(:environment => init_env)
23 # Get Merb plugins and dependencies
24 Merb::Plugins.rakefiles.each { |r| require r }
26 desc "start runner environment"
28 Merb.start_environment(:environment => init_env, :adapter => 'runner')
31 ##############################################################################
32 # ADD YOUR CUSTOM TASKS BELOW
33 ##############################################################################
35 unless Rake::Task.task_defined? "radiant:release"
36 Dir["#{MERB_RADIANT_ROOT}/lib/tasks/**/*.rake"].sort.each { |ext| load ext }
45 "core" => "git://github.com/wycats/merb-core.git",
46 "more" => "git://github.com/wycats/merb-more.git",
47 "plugins" => "git://github.com/wycats/merb-plugins.git"
52 # Should allow customization of this directory's location?
53 File.join(File.dirname(__FILE__), "framework")
57 File.join(File.dirname(__FILE__), ".gitmodules")
60 def freeze(component, update = false)
61 new(component, update).freeze
66 def initialize(component, update)
67 @component = "merb-" + component
72 # Ensure that required git commands are available
73 %w(git-pull git-submodule).each do |bin|
75 $stderr.puts "ERROR: #{bin} must be avaible in PATH"
79 unless File.directory?(framework_dir)
80 puts "Creating framework directory ..."
81 FileUtils.mkdir_p(framework_dir)
85 puts "#{@component} seems to be already managed by git-submodule."
87 puts "Trying to update #{@component} ..."
88 sh "cd #{framework_dir}/#{@component} && git-pull"
91 puts "Creating submodule for #{@component} ..."
92 sh "git-submodule --quiet add #{components[@component.gsub("merb-", '')]} #{File.basename(framework_dir)}/#{@component}"
94 sh("git-submodule init")
96 # Should this instead be a raise?
97 $stderr.puts("ERROR: unable to create submodule for #{@component}")
105 return false unless File.exists?(gitmodules)
106 File.read(gitmodules) =~ %r![submodule "#{framework_dir}/#{@component}"]!
110 File.directory?(File.join(framework_dir, @component)) || in_submodule?
115 !$?.nil? && $?.success?
120 task :freeze => Freezer.components.keys.map { |component| "freeze:#{component}" }
122 Freezer.components.each do |component, git_repository|
123 desc "Freeze #{component} from #{git_repository}"
125 Freezer.freeze(component, ENV["UPDATE"])