Most likely you can’t wait to get started with these new features, especially when you’re about to start a new project, which doesn’t have to be stable yet, but will be by the time 2.3⁄3.0 come out. This post shows you the way to create a new Rails app based on the most current Rails code, also called Edge Rails.
mkdir -p myapp/vendor cd myapp git init git submodule add git://github.com/rails/rails.git vendor/rails git commit -m "Frozen Rails Edge as submodule" ruby vendor/rails/railties/bin/rails . # Add generated files to git, and code on...
First, you create a new directory for your app, including the
vendor directory. Easy, right?
Next, you initialize a Git repository for your empty project. We’ll be using Git to track the remote Rails Edge code. Stay with me.
By adding a Git submodule we tell git to clone the code from
git://github.com/rails/rails.git into the
vendor/rails directory. Nice! If you check the current git status with
git status you see git has already staged two files for you,
vendor/rails. Commit them now to attach the submodule to your local git repository.
Git will not automatically update your submodule, you’ll have to do that by hand. I’ll show you this in a minute.
vendor/rails containing Rails Edge, you can now generate your Rails Edge application. In you project directory (
myapp/), you call
ruby vendor/rails/railties/bin/rails .. This will generate a new Rails Edge application in the current directory.
Now it’s up to you to create a fitting
.gitignore file and commit the files to your repository.
That’s all, you now have a new Rails Edge application. Try
ruby script/server to see it all in action. Enjoy!
Cloning your project
At some point you’ll push your
myapp project to a remote git server. When you clone a fresh copy, you’ll have to initialize the git submodules. This is quite easy:
git submodule init git submodule update
Updating Rails Edge
As I said earlier, Git will not keep your submodules up-to-date for you, but will stick with the revision you added. To keep track of Rails Edge’s progress, you’ll need to update the submodule. This is done like this:
cd myapp/vendor/rails git remote update git merge origin/master
This will update your Rails Edge code. Make a commit, stating you updated the code!
Good luck! And happy coding!
Learn more about git!
If you're seeing this message you've probably enabled some form of adblocker. I respect that.
I use this space to show recommended books on Amazon.com in relation to the post you just read. This generates a small income that allows me to buy a book every now and then.