0
-namespace :merb_freezer do
0
- desc "Do something for merb-freezer"
0
- puts "merb-freezer doesn't do anything"
0
+ "core" => "git://github.com/wycats/merb-core.git",
0
+ "more" => "git://github.com/wycats/merb-more.git",
0
+ "plugins" => "git://github.com/wycats/merb-plugins.git"
0
+ # Should allow customization of this directory's location?
0
+ File.join(File.dirname(__FILE__), "framework")
0
+ File.join(File.dirname(__FILE__), ".gitmodules")
0
+ def freeze(component, update = false)
0
+ new(component, update).freeze
0
+ def initialize(component, update)
0
+ @component = "merb-" + component
0
+ # Ensure that required git commands are available
0
+ %w(git-pull git-submodule).each do |bin|
0
+ $stderr.puts "ERROR: #{bin} must be avaible in PATH"
0
+ unless File.directory?(framework_dir)
0
+ puts "Creating framework directory ..."
0
+ FileUtils.mkdir_p(framework_dir)
0
+ puts "#{@component} seems to be already managed by git-submodule."
0
+ puts "Trying to update #{@component} ..."
0
+ sh "cd #{framework_dir}/#{@component} && git-pull"
0
+ puts "Creating submodule for #{@component} ..."
0
+ sh "git-submodule --quiet add #{components[@component.gsub("merb-", '')]} #{File.basename(framework_dir)}/#{@component}"
0
+ sh("git-submodule init")
0
+ # Should this instead be a raise?
0
+ $stderr.puts("ERROR: unable to create submodule for #{@component}")
0
+ return false unless File.exists?(gitmodules)
0
+ File.read(gitmodules) =~ %r![submodule "#{framework_dir}/#{@component}"]!
0
+ File.directory?(File.join(framework_dir, @component)) || in_submodule?
0
+ !$?.nil? && $?.success?
0
+task :freeze => Freezer.components.keys.map { |component| "freeze:#{component}" }
0
+ Freezer.components.each do |component, git_repository|
0
+ desc "Freeze #{component} from #{git_repository}"
0
+ Freezer.freeze(component, ENV["UPDATE"])
0
\ No newline at end of file
Comments
No one has commented yet.