Skip to content

Instantly share code, notes, and snippets.

@nicoolas25
Created January 16, 2014 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicoolas25/8458114 to your computer and use it in GitHub Desktop.
Save nicoolas25/8458114 to your computer and use it in GitHub Desktop.
Using a subdirectory with mina.
# 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