From 5d9d46aec1bf4a6b77ccea635eaa089a5f271b88 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Tue, 30 Jul 2013 17:28:26 +0100 Subject: Add a rake task to print a warning if the state of a submodule is not what we expect it to be. --- lib/tasks/submodules.rake | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 lib/tasks/submodules.rake (limited to 'lib/tasks/submodules.rake') diff --git a/lib/tasks/submodules.rake b/lib/tasks/submodules.rake new file mode 100644 index 000000000..6da0ff4b8 --- /dev/null +++ b/lib/tasks/submodules.rake @@ -0,0 +1,27 @@ + +namespace :submodules do + + desc "Check the status of the project's submodules" + task :check => :environment do + commit_info = `git submodule status` + sha, repo, branch = commit_info.split(' ') + case sha[0] + when '+' + $stderr.puts "Warning: Currently checked out submodule commit for #{repo}" + $stderr.puts "does not match the commit expected by this version of Alaveteli." + $stderr.puts "You can update it with 'git submodule update'." + exit(1) + when '-' + $stderr.puts "Warning: Submodule #{repo} needs to be initialized." + $stderr.puts "You can do this by running 'git submodule update --init'." + exit(1) + when 'U' + $stderr.puts "Warning: Submodule #{repo} has merge conflicts." + $stderr.puts "You'll probably need to resolve these to run Alaveteli." + exit(1) + else + exit(0) + end + end + +end -- cgit v1.2.3