aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tasks/submodules.rake
blob: 1112e443e8d0d1f7a612725993b2165727d06840 (plain)
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
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,1]
        when '+'
            $stderr.puts "Error: 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 "Error: Submodule #{repo} needs to be initialized."
            $stderr.puts "You can do this by running 'git submodule update --init'."
            exit(1)
        when 'U'
            $stderr.puts "Error: Submodule #{repo} has merge conflicts."
            $stderr.puts "You'll need to resolve these to run Alaveteli."
            exit(1)
        else
            exit(0)
        end
    end

end