Sunday, March 8, 2009

Bleeding Edge Rails

‹prev | My Chain | next›

I have the sneaking suspicion that I ought to punt and try to implement EEE Cooks in Sinatra + CouchDB, but I really would like to give Rails3 a least a cursory go. The chain is not about getting it done, but doing something, so...

Some Git Yak Shavin


I again start the night with rm -rf * (to get rid of rails edge) in my main application code directory. I then git checkout . to get to my clean repository, but a quick git status reveals:
cstrom@jaynestown:~/repos/eee-code$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: .gitmodules
# new file: vendor/rails
#
Dang it. My submodule checkout of rails edge is still hanging about. Since the lightweight revert did not work, may the higher powered git reset might?
cstrom@jaynestown:~/repos/eee-code$ git reset --soft HEAD^
cstrom@jaynestown:~/repos/eee-code$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: .gitmodules
# new file: features/browse_meals.feature
# new file: vendor/rails
#
Aw crap. Now git thinks that my browse_meal feature definition is a new file. I am beyond my depth with git, so time for brute force:
cstrom@jaynestown:~/repos/eee-code$ cd ..
cstrom@jaynestown:~/repos$ rm -rf eee-code/
cstrom@jaynestown:~/repos$ git clone git://github.com/eee-c/eee-code.git
Initialized empty Git repository in /home/cstrom/repos/eee-code/.git/
remote: Counting objects: 7, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 7 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (7/7), 1.06 KiB, done.
cstrom@jaynestown:~/repos$ cd eee-code/
cstrom@jaynestown:~/repos/eee-code$ ls
features README.rdoc
cstrom@jaynestown:~/repos/eee-code$ git status
# On branch master
nothing to commit (working directory clean)
Hopefully, I can figure out how to really do this before I need to delete the Rails3 spike.

On To Rails 3?

At least I would like to move on to Rails 3, but how to get it? There is no clone URL for Rails 3 on github—the URL is the same as the master (yes, I really am pretty much a git newb). The answer is to clone the repository URL, but to specify the desired branch:
cstrom@jaynestown:~/repos/eee-code$ git submodule add -b 3-0-unstable git://github.com/rails/rails.git vendor/rails
Initialized empty Git repository in /home/cstrom/repos/eee-code/vendor/rails/.git/
remote: Counting objects: 95428, done.
remote: Compressing objects: 100% (21582/21582), done.
remote: Total 95428 (delta 73746), reused 94376 (delta 72754)
Receiving objects: 100% (95428/95428), 17.18 MiB | 128 KiB/s, done.
Resolving deltas: 100% (73746/73746), done.
Branch 3-0-unstable set up to track remote branch refs/remotes/origin/3-0-unstable.
After that, I ran into problems with Rails (they call it unstable for a reason). Specifically, I kept getting errors along the lines of NameError: uninitialized constant ActionController::RewindableInput, which I ultimately resolved with this patch:
cstrom@jaynestown:~/repos/eee-code/vendor/rails$ git diff railties/lib/initializer.rb
diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb
index da064c8..26b90f0 100644
--- a/railties/lib/initializer.rb
+++ b/railties/lib/initializer.rb
@@ -545,7 +545,7 @@ Run `rake gems:install` to install the missing gems.

def initialize_metal
configuration.middleware.insert_before(
- :"ActionController::RewindableInput",
+ :"ActionDispatch::RewindableInput",
Rails::Rack::Metal, :if => Rails::Rack::Metal.metals.any?)
end
Unfortunately, I have to call it a night at this point. Hopefully I can make a bit more progress on Rails3 tomorrow. If not, I may have to abandon this trail...

No comments:

Post a Comment