A very common pattern for settings that must change per deployed environment is
exactly what Manuel suggests.
Lets say it's config.php; then you add config.php to .gitignore; but check in a
config.php.template that established safe defaults and is ok for public
consumption.
When a new Dev starts with it tell them to copy the template to the real name
and modify to suit.
In your deploy scripts I've done various things to populate that file.
1) copy the template to the final location; and sed -i that file until it's
what I want.
2) upload a copy of exactly what I want from a different location in the deploy
scripts.
3) build a string and upload that with 'put' as the file.
4) my favorite and what I do 98% of the time. Build a template in the
deployscripts utilizing erb markup; use a helper to upload the erb processed
template to the server.
# Upload a file running it through ERB
def upload_template(src,dst,options = {})
raise Capistrano::Error, "upload_template requires Source and Destination"
if src.nil? or dst.nil?
put ERB.new(File.read(src)).result(binding), dst, options
end
On Aug 11, 2011, at 5:29 AM, Manuel Vázquez Acosta <[email protected]> wrote:
> Maybe you just need to have a config.php file which kind of concentrate all
> the possible differences in deployment; then you may put that file in the
> shared_path and link it elsewhere.
>
> I have deployed both codeigniter and symfony apps with Capistrano and never
> have to change a file on the file.
>
> Probably you may override deploy:setup (or create a hook with after
> "deploy:setup") in order to create your custom files on the shared_path if
> their are missing.
>
> Best regards,
> Manuel.
>
> On 08/11/2011 03:29 AM, sawan talreja wrote:
>> If i want to change something in files before deploying on production
>> server....like a filter which will change some variables???
>>
>
> --
> * 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
> <manuelva.vcf>
--
* 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