Skip to content

Commit

Permalink
Add lithium setup task that clones a fresh copy of core
Browse files Browse the repository at this point in the history
  • Loading branch information
mehlah committed Aug 13, 2011
1 parent 44b14c1 commit 1c4e649
Showing 1 changed file with 36 additions and 6 deletions.
42 changes: 36 additions & 6 deletions lib/capium.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def _cset(name, *args, &block)


_cset(:deploy_to) { "/u/apps/#{application}" } _cset(:deploy_to) { "/u/apps/#{application}" }
_cset(:revision) { source.head } _cset(:revision) { source.head }
_cset(:lithium_repo) { "git://github.com/UnionOfRAD/lithium.git"}
_cset(:lithium_branch) { "master" }


# ========================================================================= # =========================================================================
# These variables should NOT be changed unless you are very confident in # These variables should NOT be changed unless you are very confident in
Expand Down Expand Up @@ -149,7 +151,7 @@ def try_runner(*args)


def capium() def capium()
set :deploy_to, "/var/www/#{application}" if (deploy_to.empty?) set :deploy_to, "/var/www/#{application}" if (deploy_to.empty?)

after("deploy:setup", "lithium:setup")
after("deploy:symlink", "lithium:configure_library_path", "lithium:clear_cache") after("deploy:symlink", "lithium:configure_library_path", "lithium:clear_cache")
end end
# ========================================================================= # =========================================================================
Expand Down Expand Up @@ -423,13 +425,41 @@ def capium()


end end


after "deploy:finalize_update" do
lithium.configure_library_path
lithium.clear_cache
end

namespace :lithium do namespace :lithium do


desc <<-DESC
Prepares server for deployment of a Lithium application. \
By default, it will create a shallow clone of the Lithium repository \
inside {shared_path}/libraries/lithium and run deploy:lithium:update.
For more info about shallow clones: \
http://www.kernel.org/pub/software/scm/git/docs/git-clone.html \
Further customization will require that you write your own task.
DESC
task :setup do
run "cd #{shared_path}/libraries && #{try_sudo} git clone --depth 1 #{lithium_repo} lithium"
set :git_flag_quiet, "-q "
update
end
desc <<-DESC
Force Lithium installation to checkout a new branch/tag. \
By default, it will checkout the :lithium_branch you set in \
deploy.rb, but you can change that on runtime by specifying \
the BRANCH environment variable:
$ cap deploy:lithium:update \\
BRANCH="lithium-0.10"
Further customization will require that you write your own task.
DESC
task :update do
set :lithium_branch, ENV['BRANCH'] if ENV.has_key?('BRANCH')
stream "cd #{shared_path}/libraries/lithium && #{try_sudo} git checkout #{git_flag_quiet}#{lithium_branch}"
end

desc <<-DESC desc <<-DESC
Sets the path to the class libraries used by your Lithium application. \ Sets the path to the class libraries used by your Lithium application. \
This directory contain a copy of the Lithium core. This directory contain a copy of the Lithium core.
Expand Down

0 comments on commit 1c4e649

Please sign in to comment.