Forum: Ruby on Rails Subversion and tmp directory in Rails 1.1 project

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
06e1b396407b733b4b3d825cb2c57856?d=identicon&s=25 Leo -- (leopardus)
on 2006-05-03 19:20
(Received via mailing list)
Hello everyone!

I'm thinking of the right way to store tmp/ directory of Rails 1.1
project in Subversion. It has cache, session and sockets
subdirectories. To me, it looks good to have

svn delete tmp/*
svn propset svn:ignore "*" tmp

So it will ignore all directories and files in tmp/. Even if you
create sessions/ and put some files in it, tmp/ content is still
ignored.

But I'm not sure whether it is safe to assume that Rails will recreate
(at least in Webrick I run they are recreated on start-up) these
cache/ sessions/ and sockets/ directories in future? Is is safe to
remove them?

The second way is to set svn:ignore 4 times, and it is not safe, if
more directories will be introduced in future.

svn propset svn:ignore "*" tmp
svn propset svn:ignore "*" tmp/cache
svn propset svn:ignore "*" tmp/sessions
svn propset svn:ignore "*" tmp/sockets

What do you think of it? What is your experience with non-webrick
deployment?

Peace,
olegf
Eea3feaacbe44706164289d068d94828?d=identicon&s=25 Peter Michaux (Guest)
on 2006-05-03 19:29
(Received via mailing list)
I just noticed the tmp directory. What is it?

Thanks,
Peter
27c57aaa4bda5ac8b0593659573b522f?d=identicon&s=25 Blair Zajac (Guest)
on 2006-05-03 19:51
(Received via mailing list)
Oleg Frolov wrote:
> create sessions/ and put some files in it, tmp/ content is still
> ignored.
>
> But I'm not sure whether it is safe to assume that Rails will recreate
> (at least in Webrick I run they are recreated on start-up) these
> cache/ sessions/ and sockets/ directories in future? Is is safe to
> remove them?
>
> The second way is to set svn:ignore 4 times, and it is not safe, if
> more directories will be introduced in future.

> svn propset svn:ignore "*" tmp
> svn propset svn:ignore "*" tmp/cache
> svn propset svn:ignore "*" tmp/sessions
> svn propset svn:ignore "*" tmp/sockets

I would use this one, so when you get a fresh checkout of your project,
you get
all the directories that Rails needs.  Otherwise, Rails may not start
correctly
when you move from development to production, and finding out why your
app isn't
running correctly in production (say with lighttpd) is a little harder.

Blair

--
Blair Zajac, Ph.D.
<blair@orcaware.com>
Subversion training, consulting and support
http://www.orcaware.com/svn/
3dd4b52a0946bd698b1d1635a46ea3a3?d=identicon&s=25 François Beausoleil (fbeausoleil)
on 2006-05-03 22:57
(Received via mailing list)
Hello Oleg,

2006/5/3, Oleg Frolov <leopardus.vulgaris@gmail.com>:
> I'm thinking of the right way to store tmp/ directory of Rails 1.1
> project in Subversion. It has cache, session and sockets
> subdirectories. To me, it looks good to have

Please take a look at my Subversion primer:
http://blog.teksol.info/articles/2006/03/09/subver...

It explains this concept and other ones as well.

Hope that helps !
06e1b396407b733b4b3d825cb2c57856?d=identicon&s=25 Leo -- (leopardus)
on 2006-05-03 23:09
(Received via mailing list)
Hi,

Thanks for the link. Actually it was this material I started from. You
are doing
svn propset svn:ignore "*" tmp
it means that files and folders in tmp/ will be ignored. But cache/,
sessions/ and sockets/ are already there and they will not inherit
this property (svn:ignore is not inherited). So if you create, say,
ruby_sess.da832dc557430c1e in tmp/sessions/ this file will be known as
? to subversion. I use subversion client 1.3.1 on windows and server
1.3.0 on linux. But I believe this is expected behaviour.

I understand now, that this question really should go to the Rails
core team. Will Rails recreate the tmp/ stucture on startup and we can
do

svn delete tmp/*
svn propset svn:ignore "*" tmp/

or we could expect that auto-create tmp structure can be changed in
future?

Peace,
olegf
3dd4b52a0946bd698b1d1635a46ea3a3?d=identicon&s=25 François Beausoleil (fbeausoleil)
on 2006-05-03 23:37
(Received via mailing list)
Hello Oleg !

2006/5/3, Oleg Frolov <leopardus.vulgaris@gmail.com>:
> it means that files and folders in tmp/ will be ignored. But cache/,
> sessions/ and sockets/ are already there and they will not inherit
> this property (svn:ignore is not inherited). So if you create, say,
> ruby_sess.da832dc557430c1e in tmp/sessions/ this file will be known as
> ? to subversion. I use subversion client 1.3.1 on windows and server
> 1.3.0 on linux. But I believe this is expected behaviour.

Nope, that's normal.  Since we told Subversion to ignore anything in
tmp/, it WILL ignore everything, including children of said folder.

> I understand now, that this question really should go to the Rails
> core team. Will Rails recreate the tmp/ stucture on startup and we can
> do
>
> svn delete tmp/*
> svn propset svn:ignore "*" tmp/
>
> or we could expect that auto-create tmp structure can be changed in future?

Rails does recreate the structure, which is why it the primer doesn't
put anything in tmp/ under VC.

Bye !
06e1b396407b733b4b3d825cb2c57856?d=identicon&s=25 Leo -- (leopardus)
on 2006-05-04 11:56
(Received via mailing list)
Hi,

On 5/4/06, Francois Beausoleil <francois.beausoleil@gmail.com> wrote:
> Nope, that's normal.  Since we told Subversion to ignore anything in
> tmp/, it WILL ignore everything, including children of said folder.

I do not agree. Please take a look at Subversion documentation
http://svnbook.red-bean.com/en/1.1/ch07s02.html#id3022585. Footnote
[29]. Your solution is incomplete and shouldn't work. Here is the
proof.

1. I create project
d:\> rails testapp2
2. I import this project
d:\testapp2\> svn import svn://localhost/testapp2/trunk
3. I remove folder out of the way
d:\> move testapp2 testapp2.old
4. I checkout the project
d:\> svn co svn://localhost/testapp2/trunk testapp2
5. I set up to ignore everything in tmp/
d:\testapp2\> svn propset svn:ignore "*" tmp/
6. I commit changes
d:\testapp2\> svn commit -m "ignore tmp from now"

Now, as you say, files in subfolders will be ignored. But this is not
true. svn:ignore is not inherited by subfolders. You are ignoring
cache/ sessions/ and sockets/ and every file and child directory in
tmp/, but not *subchildrens*. Here is the proof.

7. I create text file in tmp/
tmp/sess1

8. I do svn stat and this file is ignored. This is expected.
d:\testapp2\> svn stat

9. I create text file in sessions
tmp/sessions/sess2

10. I do svn stat and this file is not ignore. This is expected too
for svn:ignore is *not* inherited by subchild folders.
d:\testapp2\> svn stat
?      tmp\sessions\sess2


I use subversion 1.3.1 on windows xp (i tested linux server too).

Peace,
olegf

P.S.
I mean no offence to you. I found your tutorial very valuable, but I
believe you made a mistake with tmp/ directory :)
3dd4b52a0946bd698b1d1635a46ea3a3?d=identicon&s=25 François Beausoleil (fbeausoleil)
on 2006-05-04 17:12
(Received via mailing list)
Hello Oleg !

2006/5/4, Oleg Frolov <leopardus.vulgaris@gmail.com>:
> I do not agree. Please take a look at Subversion documentation
> http://svnbook.red-bean.com/en/1.1/ch07s02.html#id3022585. Footnote
> [29]. Your solution is incomplete and shouldn't work. Here is the
> proof.

I do not agree again :)  Your recipe is incorrect.  In my own recipe,
I do not checkin tmp/sessions, tmp/cache and friends.  They do not
exist in the repository.

> d:\> rails testapp2
> d:\testapp2\> svn import svn://localhost/testapp2/trunk

This is your problem.  You should revert tmp/sessions, tmp/cache and
friends before you commit.

> d:\> move testapp2 testapp2.old
> d:\> svn co svn://localhost/testapp2/trunk testapp2
> d:\testapp2\> svn propset svn:ignore "*" tmp/
> d:\testapp2\> svn commit -m "ignore tmp from now"

Here is a recipe I used to test this:

rd /s/q repos wc
cls
svn --version
svnadmin create repos
svn co file:///repos wc
cd wc
svn mkdir tmp
svn ci -m ""
svn ps svn:ignore "*" tmp
svn up
svn ci -m ""
mkdir tmp\sessions
touch tmp\sessions\asdf
svn st

Run that from the drive's root and you'll see the difference.  At the
end of this E-Mail, you'll see a sample run of this recipe.

> I mean no offence to you. I found your tutorial very valuable, but I
> believe you made a mistake with tmp/ directory :)

No offense taken !  Healthy disagreement is fine, as long as it's
civil and all parties are having fun :)

Have a nice day !
--
François Beausoleil
http://blog.teksol.info/

SAMPLE RUN
===========

$ svn --version
svn, version 1.3.0 (r17949)
   compiled Jan 15 2006, 23:18:48

$ svnadmin create repos

$ svn co file:///repos wc
A    wc\tmp
Checked out revision 2.

$ cd wc

$ svn mkdir tmp
svn: Can't create directory 'tmp'

$ svn ci -m ""

$ svn ps svn:ignore "*" tmp
property 'svn:ignore' set on 'tmp'

$ svn up
At revision 2.

$ svn ci -m ""

$ mkdir tmp\sessions

$ touch tmp\sessions\asdf

$ svn st

$
06e1b396407b733b4b3d825cb2c57856?d=identicon&s=25 Leo -- (leopardus)
on 2006-05-05 09:57
(Received via mailing list)
Yes, if you are not checking in tmp/ content (sessions, cache and
friends) then your solution will work. Actually, that what my first
post was about: is it the right way to assume, that sessions/ cache/
and friends will be recreated by future Rails versions or I need to
keep them (empty) in repository.
This topic is locked and can not be replied to.