RailsCasts Pro episodes are now free!
Learn more or hide this
Markús from Spain, here.
I thing you have forgotten a crucial step in this chapter, it's about setting up svn:executable in the script/ directory and the dispath.* files. This is very important when you are using different machines, Windows workstation for dev and test and Linux server for production. Not everybody uses MacOSX and TextMate (I do, but I have had to work with Windows + RadRails in the past).
Perhaps you might let it to a chapter about deploying rails apps in remote machines, but I miss that in this chapter because it covers all the steps I do when I start a rails app, except that point.
My congratulations for your contribution and your excelent screencasts. You are worthy of generous donations for this.
For those that want to automate the ignores and stuff, I've been happy with the configure_for_svn rake task @ http://snippets.dzone.com/tag/configure_for_svn (just make sure you read all that that task does before using it. I tweak my copy a smidge).
The 'add' task in there is handy too.
This website is definitely the best Rails ressource on the web. Thank you for your railscasts. I've been watching them for a while and they keep getting better and better.
@Markús, thanks for pointing that out. I didn't know about this step.
As usual, another helpful screencast. Maybe you could have one about Capistrano to complement Subversion? Great work as always, Ryan.
Great video, Ryan. I'm hoping there's more in the works on subversion. (I've read a few "get started with" tutorials -- but the odd thing is _none_ of them cover how to roll back changes and checkout older versions of your app).
One last question: Where do most folks keep their repository? Locally or on a remote server? It makes more sense to me to keep everything off your local box, but I'm not sure if this is the way it is "supposed" to be done.
Thanks again for all your hard work!
A good source for the svn steps is
@Rebort, I generally keep it on a remote server, but I setup subversion on my local for testing purposes. If you want to deploy the project it's pretty necessary to host it remotely so the web server can access the repository.
Nice work once again Ryan. I second the idea of a rake script to handle this. Rake scripts are very under–rated.
Great screencast Ryan! I've been meaning to use subversion though I mostly just wanted to 'jump right in' to Rails. Now I don't have an excuse to not use it!
wow, great!... congratulations ryan, is the best podcast of ruby ;), simple and short.
good luck ;)
tss.. i'm mistake writing the post, .."is the bes postcast of rails..." sorry jajajaja...
another resource: http://railswatcher.com/past/2007/3/15/putting_rails_on_svn/
Hey Ryan, these screencasts are excellent. However, as is often the case with anything to do with Rails, this screencast assumes an awful lot and this means, for newbies like me, it can create as many questions as it answers.
Some of the issues I experienced are:
- subversion on my computer doesnt work with localhost. perhaps this requires some additional setup steps which i havent got to in the manual yet.
- my rails project has all the rails stuff in the same directory. should it? there is a huge vendor directory which is now in the repository but i am not sure that is right.
- i dont really understand whether my repository should be on my notebook or on my webserver. or both? do the two repositories interact?
- where should subversion be installed in the first place in a rails development environment? or doesnt it matter?
I printed out a 330+ page manual entitled "Version Control with Subversion". It is quite a nice manual, but its not Rails-centric. Still, I am assuming this is the manual you would recommend to anyone installing Subversion for the first time?
If so, what would be very helpful, is if your screencast (or a new one) dovetailed in with this manual, so that the newbie user can go through the installation and setup process but then turn to the screencast at the appropriate point.
For example: on page 16 of the manual there is a section entitled "getting data into your repository" but because I knew there was a railscast i decided to use your method, being rails-centric. But, the directory structure you are using doesnt really seem to fit in with what the manual suggests, and of course there is no localhost support at this point of the installation.
It seems to me that much of the information available on Rails (including nearly all the books) are aimed at an audience familiar with command line unix, and object oriented programming techniques. This makes it very difficult for anyone to string together all the things they need to know.
While I know it is not possible to include everything in a railscast, i think it would be good to keep in mind that many people coming here will be new to one or other part of this environment - and maybe, like me, new to all of it. I hear much about people moving to Linux/Unix/Mac and Rails, but when we get here we find a community which ignores the needs of the newbies!
If you think about a new Rails developer, then the environment of Apache/Mongrel/Capistrano/Subversion etc is quite a lot to contend with - and necessary, it seems, in order to deploy a Rails application.
There is no need to include everything in one railscasts as long as you can link in with manuals etc which are already out there, and make it clear where your stuff hooks in to that.
@Sydney, I can't answer everything, but I'll try to tackle a few of your questions.
Although I used "localhost" in this episode, you should use whatever server you are hosting the repository on. This is probably your web server. Rarely do you host the repository on your local, and I don't recommend it for a real project since it will make deployment more difficult. I just have a repository set up on my local which I use for examples and testing.
While it would be nice to go more in depth and provide a complete beginners screencast, doing so on a topic like this is near impossible. That is because it is different for almost everyone. Some web hosts allow you to easily setup a repository through an admin interface, some you have to do it from scratch. Also the installation varies depending upon your platform.
After you get the repository setup and subversion installed you should be able to follow along with the screencast. I only covered the parts which are Rails specific to keep these screencasts on topic.
If people are having problems getting subversion started you can use it locally without any server running by using the file:// protocol.
Here are a list of steps to create a new repository and add something to it.
This was a very useful episode. Even though I am an experienced SVN user. I never really had a good process for Rails projects. This was great! To add a quick suggestion, I think you should continue to not assume that people know things. The more that's explained the better.
I've been doing something similar except the -c option - that was nice to learn (i've been using svn add * --force instead). 2 question -
1. if you ignore database.yml and also use the deprec gem to deploy, how would you then upload database.yml for production?
2. i think i remember you host your rails app at slicehost (i do too) - where do you host your SVN repository though?
1. After the initial deploy you need to copy over the database_example.yml to the "shared" directory capistrano provides. Then you just need to configure it properly and tell capistrano to copy that file to the config folder for each deployment.
2. I use dreamhost for subversion hosting. I also use it to host the media files and the email. I think the two (slicehost and dreamhost) compliment each other really well.
Great screencast Ryan. As a learner to rails I have found your screencasts to be really helpful. Keep up the great work.
When you selected the project folder in textmate and pressed control+shift+a it gave you a nice svn menu. For me, it only does a horn sound and nothing happens. Do I need to somehow enable the subversion bundle in textmate? Thank you!
@Kristen, it should just work. Check your Bundles menu and see if there's a Subversion bundle. See if the key commands are set properly in that bundle, perhaps they somehow got reset?
It works now. Very odd. Yesterday everything in the Subversion Bundles menu was grayed out and the control + shift + a works as well. Great tip! Thanks!
Ryan, thank you for all the railscasts! I always enjoy watching, and Ihave learned a ton.
I'm curious about your slicehost/dreamhost config. Do you use dreamhost's DNS and just point web traffic this way? Or??
@Javan, at first I tried using Dreamhost's DNS but had some trouble with it, so right now I'm using Slicehost's DNS and pointing media.railscasts.com and mail.railscasts.com back to Dreamhost. Feel free to email me if you want more details.
@Kristen: TextMate is a weird editor. You need to have at least one file open for the Subversion bundle to be active. Otherwise, the Subversion bundle will appear greyed out. That makes it confusing, because to checkout a repository to get a working copy, you need to open at least one new file. Hope that helps.
Great stuff. I wrote a shell script that automates the initial svn import and sets the ignores for new projects. Check it out and please comment. http://randomutterings.com/articles/2007/09/19/subversion-script-for-rails-developers
You just use rails-svn to create your new apps and pass it the repo url and username after the new project name.
Maybe you could do a future show about Mercurial on Rails?
I've been enjoying all your screencasts and learning incrementally from each...not only on the given subjects but getting some clue to context, procedure, and conventions.
I am completely new to programming, read a ruby book 6 months ago or so, and read the agile rails books and a few others(I had read some html stuff a couple years ago).
I must echo Sydney's comments that there is a big hole out there in the literature in terms of giving absolute newbies to computing the knowledge to finish and deploy rails projects following good conventions.
Not saying that is your job but it would be nice for someone to write a bigger primer on all the stuff circulating outside of the code and assuming that someone will be writing an application on a home computer they previously only wrote Word files on (and perhaps computer games), and browsed the internet on...and plan to host their application externally and a rails hosting provider.
While learning subversion seems necessary at some point a whole new learning curve and the need to work with all that command line stuff just to get to you documents is bit of a hurdle and a drain. And I guess I'm going to need to learn capistrano and a few other things.
Step by step inch by inch I'll get closer and so many people like you are sharing so generously on topics that there are resources available here and there. I'd like a few more showing how you actually work and where programs are kept.
Do I understand that I create a subversion directory where I eventually will host the application and check out files to work on from there and bring them to my home computer? Will the working production copy be a checked out copy or will it be running from the subversion directory?
(ok, I guess those questions show how cluesless I still am about systems stuff)
Thanks for this screencast - it has been really useful. One thing I don't understand is why you take the database.yml file out of version control. And what is the point of renaming it? Do I just upload this separately and then treat them as 2 separate entities?
Not sure why, but i'm having trouble with this line:
svn import . svn://localhost/blab -m "initial import" --username
I'll put every username / password (perm) i can think of under the sun and all i get is:
svn: Can't connect to host 'localhost': Connection refused
dam! I'm running a fresh install of rail in leopard with mongel & mysql (no apache).
Thank you for the great bite sized tutorials. I've been trying to figure out subversion for awhile. To all who want to practice this with a free remote subversion service, check out: http://www.beanstalkapp.com/ You can setup of a free account that comes with 1 repository. I followed this tut using beanstalk. Worked great!
Thanks. I purchased peepcode stuff too so advertising works... My question on this has to do with copying the yml file to the config/database_example.yml file. Isn't it still the the project directory that you commit? I looks like this step just changes the name in the same dir?
brilliant as always...
I have little experience with SVN but I have never setup a repository before. This railscast was very helpful. The use Windows for local development and a Linux server. I had no problems in following the steps.
Question: If I install a plugin that is specific to windows (like Rmagik) , would the plugin store any windows specific files in the vendor folder. If yes then I will have to exclude that folder from svn as well.
Ничего не получается!
при импорте пишет:
svn: No repository found
svn propset svn:ignore "*.sqlite3" db/
Great cast. Hints will definitely prove useful.
I have an error at string svn propset svn:ignore "*.sqlite3" db/
What is wrong?