Using Merb with the New Bundler (0.6.0)

23 views
Skip to first unread message

Jacques Crocker

unread,
Sep 28, 2009, 8:13:48 PM9/28/09
to me...@googlegroups.com
Thanks to the efforts of Pavel (github.com/pk), you can now use Merb with Carl & Yehuda's awesome new gem bundler (github.com/wycats/bundler). If you're working on a merb app, I would highly recommend trying this out and if it works ok, ditching the old thor tasks.

These steps are a work in progress so let us know how it works out for you. I'll try and get some pages up on the Merb wiki soon that has a better step by step tutorial.

First step, install bundler (latest 0.6.0)
gem install bundler

Install Merb 1.1 from Edge
cd merb
gem install rspec extlib # required for merb's rake install

New Project
# generate new project using merb 1.1
merb-gen app bookstore
cd bookstore

# create bundled app 
gem bundle

# now you can run the bundled merb console
bin/merb -i

# you'll want to use bin/rake to use the app's rake tasks with the bundled gems
bin/rake -T

# you'll probably also want to install mongrel/thin to the bundle
echo 'gem "mongrel"' >> Gemfile
gem bundle

# now you can run bin/merb to start the server
bin/merb

Migrate an Existing Project
Pavel has pretty good instructions here:

cd existing_app

# copy old dependencies to be the basis of the new Gemfile
cp config/dependencies.rb ./Gemfile

# tweak the Gemfile to the new format
mate Gemfile
    # add line: bundle_path "gems"
    # add line: disabled_system_gems
    # update merb version to 1.1
    # find/replace "dependency" with "gem"

# remove old junk
rm config/dependencies.rb
rm -Rf tasks/merb.thor

# fix init.rb
mate config/init.rb
    # --remove line: require 'config/dependencies.rb'

Using Bundler with Merb 1.0.12
If you'd rather not upgrade to Merb 1.1 and still use the new bundler, let us know. Shouldn't be too difficult so I'll trying to come up with a solution for you.

Chris Hoeppner

unread,
Sep 30, 2009, 5:03:55 PM9/30/09
to me...@googlegroups.com
Jacques Crocker escribió:
> Thanks to the efforts of Pavel (github.com/pk <http://github.com/pk>),
> you can now use Merb with Carl & Yehuda's awesome new gem bundler
> (github.com/wycats/bundler <http://github.com/wycats/bundler>). If
> you're working on a merb app, I would highly recommend trying this out
> and if it works ok, ditching the old thor tasks.
I've not yet tried myself, but how does this play with Phusion
Passenger? Any sort of changes to deploy a bundled app?

Nicholas Orr

unread,
Sep 30, 2009, 10:13:38 PM9/30/09
to me...@googlegroups.com
My experience with merb 1.0.11 and bundler 0.6.0 = fail

Things go awry inside bootstrap.rb looking for Gem::Version

http://github.com/MagnitudeCMS/magnitudecms/tree/bundler

Nick

Nicholas Orr

unread,
Sep 30, 2009, 10:15:19 PM9/30/09
to me...@googlegroups.com
Looks like I'm behind the times.
Let me try merb 1.0.12

Jacques Crocker

unread,
Sep 30, 2009, 10:16:33 PM9/30/09
to me...@googlegroups.com
Hi Nick. Yeah, using the bundler will require Merb 1.1 (edge). Pavel
and I were discussing backporting the changes to 1.0.x, but it
probably makes more sense to focus on getting 1.1 done and released.

Martin Gamsjaeger

unread,
Sep 30, 2009, 10:42:33 PM9/30/09
to me...@googlegroups.com
Jacques and Pavel,

I think backporting bundler support for 1.0.x makes no sense. The
primary features in 1.1 will be bundler, ruby 1.9 support,
active_model compliance and some bugfixes. There is nothing else
groundbreaking that would make an update more involved, so it seems to
me it's not worth taking the effort to backport the bundler stuff.
People should just switch to 1.1. Also, I wouldn't be surprised if
1.0.13 were the last release in the 1.0.x series.

cheers
snusnu

Nicholas Orr

unread,
Sep 30, 2009, 11:44:47 PM9/30/09
to me...@googlegroups.com
Sound good to me.

I haven't figured out a workflow for keeping up with edge so I'll just
wait for 1.1 to land.

Thanks all :)

Jacques Crocker

unread,
Oct 1, 2009, 2:20:05 AM10/1/09
to me...@googlegroups.com
Hey Nick, I've updated MagnitudeCMS to use the Merb 1.1 bundler. Give
it a try at:
http://github.com/merbjedi/magnitudecms

You just need to run this in place of "thor merb:gem:redeploy":
gem bundle --cached

Let me know how it works out for you.

Pavel Kunc

unread,
Oct 1, 2009, 6:08:14 AM10/1/09
to merb
As Martin said. It doesn't make any sense to me to backport Bundler to
1.0.x. To much work, and we have actually a lot of work to do for 1.1
not even looking to Lighthouse :-) and 1.9.1 support.

Pavel

Nicholas Orr

unread,
Oct 1, 2009, 6:14:55 AM10/1/09
to me...@googlegroups.com
That's fantastic Jacques.

Thanks a lot for spending the time to sort it out.

I've merged everything in a squashed it all down to the master branch.

Cheers,

Nick

Chris Hoeppner

unread,
Oct 3, 2009, 6:21:53 AM10/3/09
to me...@googlegroups.com
Chris Hoeppner escribió:
After tinkering a bit, it seems like I have to let passenger know about
the gemfile somehow, so that it loads all dependencies. What is the
preferred way to achieve this?

Pavel Kunc

unread,
Oct 4, 2009, 10:11:06 AM10/4/09
to merb
I don't use Passenger so I didn't tested the bundler changes on it.
Does passenger needs to know something about the dependencies?
Passenger should not care what are the app dependencies. Or I'm
completely out?

Pavel

Jacques Crocker

unread,
Oct 4, 2009, 11:51:39 AM10/4/09
to me...@googlegroups.com
Hi Chris. Here's a cleaned up working config.ru for Merb 1.1
http://gist.github.com/201443

require 'gems/environment'
require 'merb-core'

Merb::Config.setup(:merb_root => ".",
:environment => ENV['RACK_ENV'])
Merb.environment = Merb::Config[:environment]
Merb.root = Merb::Config[:merb_root]
Merb::BootLoader.run

run Merb::Rack::Application.new


Pavel, does that look ok to you?

As per merb lighthouse #893, we're going to try to ship a default
recommended config.ru in Merb 1.1 as part of merb-gen app (and also
maybe merb-gen passenger). The one I pasted in seems works, but it
probably could be cleaned up a bit further. Suggestions welcome!

Thanks

Jacques Crocker

unread,
Oct 4, 2009, 11:57:27 AM10/4/09
to me...@googlegroups.com
This also seems to work:

require 'gems/environment'
require 'merb-core'

Merb::Config.setup(:merb_root => ".", :environment => ENV
['RACK_ENV'])
Merb::BootLoader.run
run Merb::Rack::Application.new

Not sure why we were double setting Merb.environment and Merb.root
before.

Jeff Pollard

unread,
Nov 3, 2009, 12:11:32 PM11/3/09
to me...@googlegroups.com
In case it wasn't clear to anyone else, and maybe I'm just slow to pick up on this, you must clone wycats/merb and rake install it first to get the Bundler to work correctly.  Whatever version of Merb 1.1 that is at edge.merbivore.com doesn't work with the Bundler correctly.

Any news on what the timeline is for the official release of 1.1?

Jacques Crocker

unread,
Nov 5, 2009, 6:11:05 AM11/5/09
to merb
Hi Jeff. edge.merbivore.com is no longer supported for gem releases.
We'll be taking it offline shortly after our switch to gemcutter for
prerelease versions.

On Nov 3, 9:11 am, Jeff Pollard <jeff.poll...@gmail.com> wrote:
> In case it wasn't clear to anyone else, and maybe I'm just slow to pick up
> on this, you *must* clone wycats/merb and rake install it first to get the
Reply all
Reply to author
Forward
0 new messages