Subversion and tmp directory in Rails 1.1 project


#1

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


#2

Oleg F. 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 Z., Ph.D.
removed_email_address@domain.invalid
Subversion training, consulting and support
http://www.orcaware.com/svn/


#3

I just noticed the tmp directory. What is it?

Thanks,
Peter


#4

Hello Oleg,

2006/5/3, Oleg F. removed_email_address@domain.invalid:

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/subversion-primer-for-rails-projects

It explains this concept and other ones as well.

Hope that helps !


#5

Hello Oleg !

2006/5/3, Oleg F. removed_email_address@domain.invalid:

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 !


#6

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


#7

Hi,

On 5/4/06, Francois B. removed_email_address@domain.invalid 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.

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

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

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

  4. 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 :slight_smile:


#8

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.


#9

Hello Oleg !

2006/5/4, Oleg F. removed_email_address@domain.invalid:

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 :slight_smile: 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 :slight_smile:

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

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

$