Saturday, September 12, 2009

Getting Started Using Beanstalk With Xcode

I have lived in a data-managed world for years. I-DEAS has long distinguished itself as one of, if not THE, only CAD programs with an integrated data manager. So I am quite comfortable with the concepts of access control, version control, and pretty much any other -controls that go along with data management.

When I first got started coding, I quickly realized that it sure would be nice to have the backups that go along with regular check-ins into a managed database. I did some poking around, and it sounded like Subversion was a pretty safe way to go. But as far as actually implementing it, well, that sounded like a bigger hurdle than I was willing to tackle at the time.

I don't remember the specifics, but I was doing some Googling for hosted Subversion services, and landed on Beanstalk. I knew nearly nothing about it, and don't know much more today, but most importantly they offer a freebie account. It's a nice way to try out Subversion; it doesn't cost anything other than time.

The question then became how do I get the work I've already done into Beanstalk, and then how do I use it? If there is a handy guide out there, I didn't find it. So allow me to present my attempt at providing that guide.

I should preface this by saying that beyond initial setup, I don't know a whole about Subversion. I'm only working by myself; I'm not trying to coordinate efforts with a whole team of people. I don't know how to branch. I really only use it to commit my changes regularly, and if necessary revert back to an older version of something.

Preamble out of the way, let's begin...

Repository Configuration



Once you have created your Beanstalk account, using your web browser go to the Repositories tab.

Click on the desired repository

Then copy your repository URL.

You are now finished with your web browser, as pretty much everything else is done in Xcode. So, fire it up.

You will be using the SCM menu a lot, so find it now, and select Configure SCM Repositories.

This takes you into Xcode's preferences under the SCM tab.

Here you can see that I have several repositories already. Click the + button at the bottom of the Repositories list to create a new one. Keep your eye on the green dot that says 'Authenticated', as that will be important.

Xcode will prompt you for a name for this repository, so call it whatever you want. This does not need to be the same name as your project, but you will probably want it to at least be related. Select 'Subversion' for the SCM System.

We now have a new blank repository.

Notice that our green dot is no longer a green dot. By the time we're done, it should be, and that's the indication that everything is set up correctly.

If that Beanstalk URL isn't in your clipboard anymore, go back and copy it. Paste it into the URL field. Any time you make a change to a text field here, tab out of it to see the result.

Notice that the scheme, host, and path were automatically determined from the URL. And our green dot is now an angry red dot. Fear not, you merely need to provide your username and password. Don't forget to hit tab after each text field change.

Once your information is correct, you should have a green dot. If not, verify your login and password.

Initial Upload



At this point, Xcode can talk to Beanstalk. However, there aren't any files in there yet to talk to. You can exit the Preferences panel, and go back up to the SCM menu and hit Repositories.

You'll see a listing of your repositories, and if you select one, you'll see the files and folders contained therein. This is looking at Beanstalk; these are not local files. The existing folders - branches, tags, trunk - I believe are relatively standard for Subversion.

We are interested in the trunk folder, so select that.

To add your project, hit the 'Import' button.


Select the folder that contains your project.

If you want, enter in a comment indicating what you are doing. But since this is the first time you are doing anything, it should probably be pretty easy to figure out later.

After you hit 'Import', Xcode will begin uploading your local files into Beanstalk.

You can click around to verify that all of your files are there.

Initial Download



I don't know if this next part is actually required, or if you can continue working with your local files. For the sake of this blog post, we're going to assume it is required. If you poke around in Subversion documentation, you may see the phrase "Working Copy". This refers to the local files on your hard drive that you have retrieved from Subversion. So, we need to create that working copy.

In the Repositories window, select the same folder that we just uploaded. Then hit the 'Checkout' button.


Xcode will prompt you for a download location. I personally use my Dropbox folder for an additional layer of protection.

When the download is complete, Xcode will provide an option to open that project. Go ahead and do so, because we aren't quite done yet.

Final Setup



Once the project is open, right-click on Groups & Files, and turn on the SCM option.


This will reveal a new column that displays status information about the files.



There isn't much to see yet, since we haven't done anything. But the key thing to notice is that the SCM icon has an X through it. I don't really know why, but there is one thing left to do. Select the project file, then right-click, Get Info.



This will take you to the project info panel. I'm taking these screenshots using Xcode 3.2, and this panel did see some slight modifications, but the core element we're looking for is still there in previous versions, you just may have to poke around for it a bit.

Select the 'General' tab.

Then hit the 'Configure Roots & SCM' button.

Make sure the pull-down menu says Subversion. In the Repository column, hit the pull-down there to select your repository. The name will most likely have "Recommended" next to it. I honestly don't know why this step is necessary; Xcode seems to know this stuff already, so you'd think it could set itself up. Oh well.

Once that is done, the X should disappear from the column's icon.


At last we are set up!

Come back later for part 2, at which point I'll discuss some usage basics.

1 comment:

Anonymous said...

The information here is great. I will invite my friends here.

Thanks