Skip to content

Commit

Permalink
First working version with CakePHP 2.0
Browse files Browse the repository at this point in the history
- Change "config" by "Config"

- Remove `core_config_path` introduced in 68c2bdf - gets copied from the repo, deleted from the clone and symlink-ed back into the clone - useless, no?
  • Loading branch information
jadb committed Jan 27, 2012
1 parent cf42bc9 commit 2c14127
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/capcake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
set :scm, :git
set :git_enable_submodules, 1
set :deploy_via, :checkout
set :shared_children, %w(config system tmp)
set :shared_children, %w(Config System tmp)

set :git_flag_quiet, ""

Expand All @@ -44,8 +44,7 @@
def capcake()
set :deploy_to, "/var/www/#{application}" if (deploy_to.empty?)
set(:current_path) { File.join(deploy_to, current_dir) }
set(:database_path) { File.join(File.join(shared_path, "config"), "database.php") }
set(:core_config_path) { File.join(File.join(shared_path, "config"), "core.php") }
set(:database_path) { File.join(File.join(shared_path, "Config"), "database.php") }
set(:shared_path) { File.join(deploy_to, shared_dir) }
_cset(:cake_path) { shared_path }
_cset(:tmp_path) { File.join(shared_path, "tmp") }
Expand Down Expand Up @@ -164,7 +163,6 @@ def remote_file_exists?(full_path)
end
run "ln -s #{shared_path}/system #{latest_release}/webroot/system && ln -s #{shared_path}/tmp #{latest_release}/tmp";
run "rm -f #{current_path} && ln -s #{latest_release} #{current_path}"
run "cp #{latest_release}/config/core.php #{core_config_path}" if (!remote_file_exists?(core_config_path))
cake.database.symlink if (remote_file_exists?(database_path))
end

Expand Down Expand Up @@ -522,8 +520,7 @@ def remote_file_exists?(full_path)
#{deploy_to}/shared/config/database.php
DESC
task :symlink, :roles => :web, :except => { :no_release => true } do
run "#{try_sudo} rm -f #{current_path}/config/database.php && #{try_sudo} ln -s #{database_path} #{current_path}/config/database.php"
run "#{try_sudo} rm -f #{current_path}/config/core.php && #{try_sudo} ln -s #{core_config_path} #{current_path}/config/core.php"

This comment has been minimized.

Copy link
@damusnet

damusnet Mar 9, 2012

Contributor

Actually, the core.php got copied from the repo, deleted from the clone and symlink-ed back into the shared_path/config/core.php which allowed to have a separate core config file on your local repo and your production box. Same as for the database. I find this very convenient so that I can have debug level 2 while coding, and don't have to think about switching back to 0 before deploying. Maybe you have another trick?

This comment has been minimized.

Copy link
@jadb

jadb Mar 13, 2012

Author Owner

Well, in CakePHP 2.0 at least, I am using a local *.ini file to override any core configuration I would like (thus saving me from having 2 versions of core.php). I know there are other ways of doing it as well, this one seems to work for me.

run "#{try_sudo} rm -f #{current_path}/Config/database.php && #{try_sudo} ln -s #{database_path} #{current_path}/Config/database.php"
end
end

Expand Down

0 comments on commit 2c14127

Please sign in to comment.