Hah, if you hadn't found the difference and posted I was going to set you straight.
_cset is a method to do a conditional set. It's used for ensuring a safe default value is present for a capistrano built in. Theres very few legitimate reasons you would need/want/benifit from _cset in your tasks; thus the leading _. I guess meant to signify an internal method. In your code if you want to set a default value using fetch(:myvar,"my default") But the code you've presented you'll want to just use plain ole set. On Nov 16, 2011, at 2:55 PM, Craig White <[email protected]> wrote: > duh.... recipes/deploy.rb (right near the top too...) > > def _cset(name, *args, &block) > unless exists?(name) > set(name, *args, &block) > end > end > > I can change them until the cows come home but once they are set during a > run, they're not going to change unless I hack capistrano itself. ;-( > > Craig > > On Nov 16, 2011, at 2:24 PM, Craig White wrote: > >> >> On Nov 16, 2011, at 10:52 AM, Lee Hambley wrote: >> >>> Based on what I saw he is not forking; he is creating a sub shell via a >>> system() call; so there will be no sharing of anything from the run time >>> parent cap. >>> >>> Acknowledged, bit of a shame, would be possible to set up the variables, >>> fork and load the individual depoys, I expect… but honestly I've never had >>> to try that. >> ---- >> OK - going at it from a different angle where I don't create a sub shell at >> all and stay entirely in a single namespace... >> >> task :dep_to_code do >> set :deploy_to, "#{deploy_path}" >> set :copy, "#{deploy_to}/shared/cached-copy" >> strategy.deploy! >> run "rm -f #{current_path} && ln -s #{latest_release} #{current_path}" >> end >> >> task :dep_to_i18n do >> _cset(:deploy_to, lambda { "#{deploy_path}/i18n" } ) >> set :copy, "#{deploy_to}/shared/cached-copy" >> _cset :version_dir, "releases" >> _cset :shared_dir, "shared" >> _cset :shared_children, %w(system log pids) >> _cset :current_dir, "current" >> >> _cset(:releases_path) { File.join(deploy_to, version_dir) } >> _cset(:shared_path) { File.join(deploy_to, shared_dir) } >> _cset(:current_path) { File.join(deploy_to, current_dir) } >> _cset(:release_path) { File.join(releases_path, release_name) } >> >> _cset(:releases) { capture("ls -x #{releases_path}", :except => { >> :no_release => true }).split.sort } >> _cset(:current_release) { releases.length > 0 ? File.join(releases_path, >> releases.last) : nil } >> _cset(:previous_release) { releases.length > 1 ? File.join(releases_path, >> releases[-2]) : nil } >> >> _cset(:current_revision) { capture("cat #{current_path}/REVISION", >> :except => { :no_release => true }).chomp } >> _cset(:latest_revision) { capture("cat #{current_release}/REVISION", >> :except => { :no_release => true }).chomp } >> _cset(:previous_revision) { capture("cat #{previous_release}/REVISION", >> :except => { :no_release => true }).chomp >> if previous_release } >> strategy.deploy! >> run "rm -f #{current_path} && ln -s #{latest_release} #{current_path}" >> end >> end >> >> before "deploy:cold", "deploy:setup", "deploy:code", "deploy:i18n" >> after "deploy:code", "deploy:code_tag", "deploy:dep_to_code", >> "deploy:bundleit", "deploy:finalize_update", "deploy:relink" >> after "deploy:i18n", "deploy:i18n_tag", "deploy:dep_to_i18n", "deploy:relink" >> >> So - now, if I completely remove the deployment directory and... >> >> cap test2 deploy:cold >> >> deploy:setup creates the structure as intended >> deploy:code loads the 'deploy:tag' code, executes the subversion checkout >> and relinks, etc. >> but >> deploy deploy:dep_to_i18n tries to 'strategy.deploy!' back to the same >> RAILS_ROOT/shared/cached-copy directory and not in >> RAILS_ROOT/i18n/shared/cached-copy and as you can see, I am going to great >> lengths to override this in the dep_to_i18n task (which works properly if I >> execute it separately but fails consistently if I perform any type of code >> update/checkout to the 'code' base prior as if the ':copy' variable is >> absolutely immutable from a single execution once it has been set. >> >> Craig > > -- > Craig White ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [email protected] > 1.800.869.6908 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ www.ttiassessments.com > > Need help communicating between generations at work to achieve your desired > success? Let us help! > > -- > * You received this message because you are subscribed to the Google Groups > "Capistrano" group. > * To post to this group, send email to [email protected] > * To unsubscribe from this group, send email to > [email protected] For more options, visit this group at > http://groups.google.com/group/capistrano?hl=en -- * You received this message because you are subscribed to the Google Groups "Capistrano" group. * To post to this group, send email to [email protected] * To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/capistrano?hl=en
