Peter,
 There's no reason you can't use something like the the put() helper to
upload the addendum for the .htaccess file to a temporary filename/loaction,
then cat the new one onto the end of the other...

How far have you got so far? This strikes me as a good idea for a blog-post
solution mini-write-up, so I'll walk you through getting it running.

- Lee

2009/2/28 Peter Zingg <[email protected]>

>
> I am using a recipe based on the the standard mt-capistrano
> distribution for deployments to Media Temple grid servers (http://
> gems.mediatemple.net/deploy.rb, mt-capistrano gem).  Part of the
> deployment cycle for my ruby on rails application requires that Media
> Temple create a new .htaccess file after code is updated and the
> release directory is symlinked.
>
> That task is "mt:generate_htaccess", which makes a call to "mtr
> generate_access" on the server, resulting in an .htaccess file in the
> public folder of my rails app.  The .htaccess file has "#MTSTART --
> Automatically generated, don't modify --" written into it!
>
> Is there an example of a task to add additional apache directives to
> the newly minted .htaccess file that I can just crib, or will I be the
> first to try this?  I would like to use this example from the Media
> Temple knowledge base, for instance:
>
> # An easy to way to always redirect the user to secure connection
> # (https://) can be accomplished with the following lines:
> RewriteEngine On
> RewriteCond %{SERVER_PORT} 80
> RewriteRule ^(.*)$ https://www.mt-example.com/$1 [R,L]
>
> I suppose I can create a task that will merge my stuff (in "htaccess-
> extras.txt") like this:
>
> # if first time, create copy of the .htaccess file generated by Media
> Temple
> run "if [[ test ! -f #{release_path}/htaccess.mt ]]; then cp #
> {release_path}/public/.htaccess #{release_path}/htaccess.mt; fi""
> # concatenate my changes and put back into release path
> run "cat #{release_path}/htaccess.mt #{release_path}/htaccess-
> extras.txt > #{release_path}/public/.htaccess"
>
> Anyone try this?
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---

Reply via email to