My book Merb in Action, is available now in Early Access from Manning Publications

Saturday, March 01, 2008

Quickie: sake tasks for Merb hackers

If you hack around on Merb itself, take a look at these sake tasks


$ sake -T http://merbivore.com/merb-dev.sake
sake merb:clone          # Clone a copy of all 3 of the Merb repositories
sake merb:update         # Update your local Merb repositories.  Run from
 inside the top-level merb directory.
sake merb:gems:wipe      # Uninstall all RubyGems related to Merb
sake merb:gems:refresh   # Pull fresh copies of Merb and refresh all the
 gems
sake merb:install:core   # Install merb-core
sake merb:install:more   # Install merb-more
sake merb:install        # Install merb-core and merb-more
sake merb:sake:refresh   # Remove and reinstall Merb sake recipes

The code is served piping hot direct from GitHub so it’s always current. If you’d like to contribute, let me know and I’ll add you.

Tags:  

Wednesday, February 13, 2008

Merb 0.9.0 (developer release)

A few minutes ago I pushed the gems for Merb 0.9.0 “All you need, none you don’t” to merbivore.com. Before you run off to “gem update” there’s some things you should know.

As wycats explained earlier we’ve chopped Merb up a little bit. merb-core is small, fast and just the stuff you need to build a basic web application. merb-more is a collection of things that make it cooler and more useful, like mailers and generators and template engines. Together, merb-core and merb-more make up “merb”. You’ll still be able to gem install merb and have it work, or you can cherrypick just the pieces you want for your application.

We’ve also got a decent collection of “official” plugins, including all the ORM plugins, and some additional rspec and test/unit support.

Anytime you gut a codebase like we did with Merb after 0.5, there’s stuff that doesn’t shake out properly. We had planned to release 0.9.0 last weekend during acts_as_conference, but there’s still some little stuff that needs shaking.

Normally, we’d just get people to use trunk and see what needed doing, and then call it a release. This time, we don’t really have a good sense of exactly where the rough spots are between all the moving parts.

We need your help.

Here’s 0.9.0, and it’s a real release. It’s official. It’s just not on the Rubyforge gem repository yet. We’re calling it a “developer release” and it’s like a release candidate, except we don’t think we’ll actually release it. Once people use it, and we oil some of those squeaky spots, we’ll push an 0.9.1. We may do a few of these developer releases before we decide we’re ready to push it to Rubyforge for general consumption.

These developer releases are here to make sure that Merb 1.0 is as good as it can be, so if you want to see an awesome Merb 1.0, please use these 0.9.0 gems, and future dev releases, and give us feedback.

If you have RubyGems 1.0.1, and want to always use these developer releases whenever they’re available:


$ gem sources -a http://merbivore.com
$ gem install merb

If you don’t, or you don’t:


$ gem install --source http://merbivore.com merb

As always, put your bugs and patches in Lighthouse and join the discussion on #merb.

PS: Want to see something cool?


$ merb-gen myflatapp --flat
$ merb-gen mysinglefileapp --very-flat

Tags:  

Monday, February 04, 2008

Merb Monday

jp_n9 from #merb has started a series he calls Merb Monday where he compiles questions and answers from the IRC channel. This is an awesome idea. I was thinking last night that we needed a “Kernel Traffic” style summary for Merb stuff, and this is an excellent start! Go subscribe, or just check it out on Mondays.

Tags:  

Thursday, January 31, 2008

Contributing to Merb (Part 1)

I’ve seen several people ask “How can I help with merb-core?” and so, here’s a little guide. (Updated 2/14 w/ notes on rebasing. Thanks ReinH.)

This is part 1 of 2, for people who don’t want to run their own public fork.

Step 1: Get a Lighthouse account

All of the Merb development is moving to Lighthouse instead of Trac, so you’re going to need an account. Go register and then come back here.

Step 2: Get git

Merb is using git for development now. There’s information on the main git site about downloading and installing. There’s also some guides for installing on Mac. Google is your friend.

You should also configure git with your email address:


git config --global user.name "Mike Tester" 
git config --global user.email "mtester@gweezlebur.com" 

These are global config settings that will apply to every project you checkout.

Step 3: Get Merb

Using git is different from using SVN. Every repository, whether published or not, is on equal footing with every other one. All of the official Merb releases will be coming out of wycats’ repository, though, so you probably want to get that one. Do that with “git clone”


$ git clone git://github.com/wycats/merb-core.git
Initialized empty Git repository in /tmp/merb-core/.git/
remote: Generating pack...
remote: Done counting 1684 objects.
remote: Deltifying 1684 objects...
remote:  100% (1684/1684) done
Indexing 1684 objects...
remote: Total 1684 (delta 800), reused 57 (delta 8)
 100% (1684/1684) done
Resolving 800 deltas...
 100% (800/800) done

This will create a new repository in the directory merb-core, set up the remote repository links, fetch the latest copy of the upstream repository into your repository. and set up a tracking branch for upstream.

Step 4: Fix something

This is the whole point, right? There’s a bug you’re dying to fix, or a feature you’re dying to add. So let’s do that. First, we create what git users calls a “topic branch” to hold the changes for this particular bug


$ git checkout -b my_bugfix 
Switched to a new branch "my_bugfix" 

This creates the branch, and switches us to it. Now change whatever needs changing, of course running the specs to make sure they still pass.

There’s a lot of git commands you may use here that are beyond the scope of this guide, like diff and status. Consult your favorite git tutorial.

Now we need to commit the changes. Remember, in git every repository is equal, so you’re committing to your local repo, not trying to commit to wycats’.


$ git commit -a -v

This will pop open an editor for us to type a commit message. It should have a short, very descriptive first line, a blank line, then any other information that’s relevant.

Added bug zapper library

This loads in the bugzapper library,
which removes some common bugs,
like the ones in ticket #343.

Save and quit, and you’ll see something like this:


Created commit 14626c1: Added bug zapper library
 1 files changed, 2 insertions(+), 1 deletions(-)

The important bit is “14626c1” ... it’s the first part of the unique identifier for this commit. If you ever need to refer to this exact commit, you’ll need that.

However, since we used a topic branch, we know that every commit on this branch is part of the intended changes. So we can use a shorthand to actually generate our patch(es). First, though, let’s make sure we’re current with upstream


$ git checkout master
$ git pull
$ git checkout my_bugfix
$ git rebase master
$ git format-patch master..
0001-Added-bug-zapper-library.patch
0002-initialize-zapper.patch

This says “make patch files for every commit that is in this branch and not in master” (master is the default branch you started with). You can see that I committed another fix, so there are 2 patches.

If the rebase fails, it means your patches don’t apply cleanly with the latest upstream changes. You’ll have to fix that (either manually or using git merge-tool), and then


$ git rebase --continue

After that, continue with formatting the patch.

Step 5: Submit the patche(es)

Go to Lighthouse. Create a ticket. Tag it with “patch”. Attach your patch(es). Wait for them to be applied.

Step 6: Cleanup

You should switch back to the master branch now.


$ git checkout master
Switched to branch "master" 

If your patches have been accepted, you can delete your branch, too:


$ git branch -D my_bugfix
Deleted branch my_bugfix.

Branches are cheap, so you can leave it around for a while, if you think you might come back to it.

You should also pull down the latest changes, so your next patch will apply cleanly:


$ git pull

Tags:  

Monday, January 28, 2008

The last of the Merb 0.5.x line

Just a few minutes ago I tagged and released Merb 0.5.3 “Inexperienced With Girls”, and it should be on the gem servers soon. This is (hopefully) the last of the 0.5.x releases of Merb. It’s the last unless something horrible is wrong with it.

Starting …. now .... we’re really focusing on the 0.9 code, which has some significant changes in terms of process. First and foremost, we’re using git to manage the development, instead of Subversion. Also, we’re splitting the codebase up into merb-core and merb-more, to balance that delicate line of “super small and focused yet feature-rich”.

If you’d like to see where things are headed, here’s the repos on GitHub:

One of the super cool things about GitHub is that it makes hosting a fork of a project trivial. One of the super cool things about git is that it makes cherry-picking changesets from one tree to another really easy. Combine those two things, and you get a completely different development style than with central-repo projects.

Right now, my experimental merb-core is the same as upstream, but I’ll be doing stuff in there that may or may not be ready for official merb. I’ll let you know if there’s anything interesting in there.

The release of 0.9 is planned for February 8th, IIRC. There’s a lot to do, but we’ve made a lot of progress. My next task is to make sure the preliminary 0.9 upgrade checklist that wycats made is all that’s needed (it can’t be that easy, can it?) and then go through merb-core and make sure all the HTTP compliance and support is good.

Tags: