Skip to content

Instantly share code, notes, and snippets.

@nicoolas25

nicoolas25/subdir.rb

Created Jan 16, 2014
Embed
What would you like to do?
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