diff options
Diffstat (limited to 'lib/tasks/submodules.rake')
-rw-r--r-- | lib/tasks/submodules.rake | 27 |
1 files changed, 27 insertions, 0 deletions
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 |