aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-07-30 17:28:26 +0100
committerLouise Crow <louise.crow@gmail.com>2013-07-30 17:28:26 +0100
commit5d9d46aec1bf4a6b77ccea635eaa089a5f271b88 (patch)
tree92ae114ddd6c084460aee3d53511f799e51eac14
parent4b7a2726deb1bdca94b39a65d32beb6f9ca90492 (diff)
Add a rake task to print a warning if the state of a submodule is not what we expect it to be.
-rw-r--r--lib/tasks/submodules.rake27
-rwxr-xr-xscript/rails-post-deploy2
2 files changed, 29 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
diff --git a/script/rails-post-deploy b/script/rails-post-deploy
index a3257cf35..d20bf0472 100755
--- a/script/rails-post-deploy
+++ b/script/rails-post-deploy
@@ -93,6 +93,8 @@ bundle install $bundle_install_options
bundle exec rake themes:install
+bundle exec rake submodules:check
+
# upgrade database
bundle exec rake db:migrate #--trace