Created
January 16, 2014 16:33
-
-
Save nicoolas25/8458114 to your computer and use it in GitHub Desktop.
Using a subdirectory with mina.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
# | |
# This extension allows you to select a subdirectory instead of a whole repository. | |
# It is useful when you're fetching a git project and your actual code is in a | |
# subdirectory. | |
# | |
namespace :subdir do | |
desc "Select a subdirectory as the root of your project" | |
task :select do | |
commands = %[ | |
echo "-----> Using '#{subdirectory!}' as subdirectory" && | |
if [ ! -d "#{subdirectory!}" ]; then | |
echo "-----> The directory #{deploy_to}/$build_path/#{subdirectory!} hasn't been found." && | |
exit 1 | |
else | |
#{echo_cmd %[shopt -s dotglob]} && | |
#{echo_cmd %[mv ./#{subdirectory!} #{deploy_to}/tmp/subdirectory]} && | |
#{echo_cmd %[rm -fr ./*]} && | |
#{echo_cmd %[mv #{deploy_to}/tmp/subdirectory/* ./]} && | |
#{echo_cmd %[rmdir #{deploy_to}/tmp/subdirectory]} && | |
#{echo_cmd %[shopt -u dotglob]} | |
fi | |
] | |
queue commands | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment