Maven for ruby?

Hello, I come from the Java world and really enjoyed using maven:

http://maven.apache.org/

The big pluses maven gave us were:

  1. Easily maintain version numbers for projects.
    Maven would start you at 1.0 and after each release bump your project to
    1.1, 1.2 etc. It would also tag the version in SVN for you, and make
    your current working version 1.2-SNAPSHOT until your next 1.3 release.

  2. Central repository for all projects with dependency management.
    You can just say I need projectX version 1.2 and it’ll magically get
    that for you AND get projectY version 1.1 because it knowns projectX
    depends on projectY.

Both these features made it very easy to break any large project into
many smaller projects. The more smaller projects you have with well
defined API’s make everything better. One team can work on projectA,
while another works on projectB. ProjectA guys will often say, “Hey I
need this from ProjectB…” and in a few minutes there’s a new version
of B ready on the central repository.

I’m just learning Rails, but so far I have a huge rails project with
many controllers, many models, many plugins, a large lib folder, etc.

Is there a good maven for ruby yet? Is capistrano the answer? I want
to split my large rails project into like 20 separate projects and then
have a small skeleton rails app that just pulls the 20 together.

Thanks.

On 2/23/07, Andrew A. [email protected] wrote:

Is there a good maven for ruby yet? Is capistrano the answer? I want
to split my large rails project into like 20 separate projects and then
have a small skeleton rails app that just pulls the 20 together.

Fortunately, Ruby doesn’t need something as overengineered as Maven.
If you need to subdivide your projects, just do so. Make them Ruby
libraries that you can install yourself. Divide them logically; when
you find out that it doesn’t work, join them back together as you need
to. Use the advantages of your source control tool without being tied
to the concept of something like Maven.

Capistrano is a deployment tool. Rake is a build tool. There’s at
least three cruise-control-like solutions. If you decide that, even
internally, hoe gives you amazing tools that you don’t have to use
entirely (you can use hoe to test each component, package it as a gem,
and then extend it to copy it to your deployment server instead of
uploading it to RubyForge).

And … do you really need a “huge” rails project? If your project can
be divided into twenty sub-projects, shouldn’t you be doing it
properly (making proper libs, etc.) and not depending on something
like Maven to do it for you?

-austin

So, I’m coming from the same place you are, as a big proponent of
Maven 2, trying to figure out the Ruby world.

First, RubyGems plays the role of the package management tool: there’s
a central repository of packages, it handles transitive dependencies,
and you can run your own gem server for your own repository. Unlike
the Java world, when you deploy your app, you would install the gems
on the server, and use them as gems, vs. Java/Maven where your local
Maven repo is only used during development, and the app is deployed
with the dependencies in a jar, war, or ear. Also RubyGems defaults
to installing gems system-wide, as opposed to the per-user local
repository of Maven.

Hoe ( http://seattlerb.rubyforge.org/hoe/ ) can play some of the role
of Maven as well, providing some convention-over-configuration build
tools that you can use for your non-rails library projects that you’re
going to be pulling together. (Obviously, rails itself plays the
convention-based build role for a rails app).

  • Stephen

I don’t think you have a fair impression of Maven. Maven 2 is a good
tool to help someone using Java implement exactly what you advise:
splitting up your projects logically into libraries. Maven provides
the RubyGems+Hoe equivalent for Java to make that feasible to work
with.

There are some Maven functionalities that I’d like to see for Ruby (or
maybe I just don’t yet know how to do them). I’d like an easy
mechanism to have RubyGems store gems in a per-user location instead
of globally be default (I’m sure this is possible, but I just haven’t
taken the time to do it yet). Then, I want a simple way to list the
gems my project depends on and run a Rake task to install those
dependencies. The purpose here is to do the equivalent of what
running mvn eclipse:eclipse does for a Java project: allow me to check
a project out, run a single command, and then be ready to start
developing. I don’t know what the typical approach here for Ruby is.

I’d also like to have Hoe work equally well if I’m using Rspec vs.
test/unit. On the documentation front, I’m pretty certain there are
features of the Maven site tools that I’ll miss in Ruby, but I haven’t
put in the work yet to learn how it’s done in the Ruby world to say
for sure.

I do think that with Ruby there can be a better/cleaner version of
Maven, but I still feel that Ruby does need a Maven. :slight_smile:

  • Stephen

One thing I forgot to mention. I’m not familiar with the details, as
I’m mostly interested in Ruby for non-rails projects. But there’s
another technique for certain kinds of dependencies, specifically,
Rails plugins. In that case, I’ve noticed that some people advocate
using svn:externals to pull down the plugins at checkout time, which,
of course, is something that works better in Ruby than Java, since the
distinction between source & runtime artifacts goes away. It seems
“icky” to me to rely on a feature of a particular SCM implementation
for handling code-sharing, but I don’t have any pragmatic arguments
against it.

-Stephen

On 2/24/07, Austin Z. [email protected] wrote:

Nothing on the Maven website suggested that it isn’t trying to solve
problems that simple Don’t Exist in the Ruby world, and that trying to
take a Maven approach to Ruby problems is AT BEST misguided.

That may well be true. Which is why I won’t be trying to take any
action to make anything Maven-like for Ruby until I have more
experience & work on enough things / a large enough project to feel
the pain points and decide that I, in fact, think the Maven approach
needs to be brought to Ruby.

There are some Maven functionalities that I’d like to see for Ruby (or
good questions to raise on the rubygems-devel list or, better yet, to
investigate in the source and provide patches to make it happen if you
really need it.

I don’t, and I can’t see any reason to run the software that way.

Thanks for the info. On whether it’s a good idea, we’ll just have to
disagree; I really think that system-wide shouldn’t be the default. I
do pledge that if I end up working enough with Ruby to justify the
time, I will work on solutions, and not whine about it on the mailing
list. :slight_smile:

Then, I want a simple way to list the
gems my project depends on and run a Rake task to install those
dependencies.

That’s actually very simple for you to add to your own Rakefile. If it
works well enough, you can suggest it as a standard rake task or offer
it to Ryan for hoe.

Good to know.

yourself. I’m making changes to the PDF::Writer source, though, to
make it easier to run the demos from the checkout tree without getting
your already-installed version.)

Of course, I suspect that most people who would start hacking on a
project would have used the project first, so they would start by
installing a project’s gem – and get its dependencies automatically.

I’m mostly thinking about working on unreleased projects where this
wouldn’t apply.

doubt it. Documentation in Ruby is achieved primarily through rdoc.

If you want project tracking, use Trac or possibly one of the
up-and-coming Rails replacements for Trac.

For site stuff here’s what Maven does that I’m referring to. It
allows you to use plugins to generate a variety of different
documentation with little work: list of dependencies (including
transitive ones), JavaDoc (Rdoc equiv), Source cross-referenced with
JavaDoc (which I guess Rdoc does by itself), project info (how to
connect to SVN, etc.), code coverage, static analysis, and the ability
to write your own documentation in a couple different formats: APT
(wiki-like), xdoc (xml/html type), FML (for faqs), etc. For example:
http://www.stephenduncanjr.com/projects/easymock-propertyutils/index.html

As far as I know, the only thing I’d want in Ruby is the ability to
integrate my Rdoc with an Rcov report or something. Like I said, I
don’t know if there’s anything important here.

On 2/24/07, Stephen D. [email protected] wrote:

I may have a wrong impression of Maven, but if I do, it’s not my fault:

  • I don’t use Java, so I don’t need Maven.
  • The OP’s description of Maven was so overblown and useless as a
    description that I went to the Maven website.
  • The Maven website is nothing but marketing-speak on the “about
    Maven” pages. I expect to find useful information somewhere for a
    project that isn’t excessively large to deal with.

Nothing on the Maven website suggested that it isn’t trying to solve
problems that simple Don’t Exist in the Ruby world, and that trying to
take a Maven approach to Ruby problems is AT BEST misguided.

I also think that the OP is approaching his project the wrong way up
front. How large is too large? Instead, ask what the minimum
functionality can be logically delivered in each piece. Don’t look at
dividing an application in to twenty parts: look at making reusable
functionality as libraries.

These aren’t things that software can help you do; you have to do them
yourself. You can then have software help you manage those libraries,
but a good source control system can deal with them.

There are some Maven functionalities that I’d like to see for Ruby (or
maybe I just don’t yet know how to do them). I’d like an easy
mechanism to have RubyGems store gems in a per-user location instead
of globally be default (I’m sure this is possible, but I just haven’t
taken the time to do it yet).

I wouldn’t ever want this by default. However, “gem help install”
points out the --install option where you can specify a gem
repository. What I don’t know is how you would tell RubyGems about
this repository in your includes, or if RubyGems supports a per-user
repository to be read before the system repository. These would be
good questions to raise on the rubygems-devel list or, better yet, to
investigate in the source and provide patches to make it happen if you
really need it.

I don’t, and I can’t see any reason to run the software that way.

Then, I want a simple way to list the
gems my project depends on and run a Rake task to install those
dependencies.

That’s actually very simple for you to add to your own Rakefile. If it
works well enough, you can suggest it as a standard rake task or offer
it to Ryan for hoe.

The purpose here is to do the equivalent of what
running mvn eclipse:eclipse does for a Java project: allow me to check
a project out, run a single command, and then be ready to start
developing. I don’t know what the typical approach here for Ruby is.

That really depends on the project. Unless things started showing up
in hoe to enable what you’re talking about, I doubt that any of my
projects would be set up to work this way, for the most part. (That
is, if you wanted to contribute to PDF::Writer, you would have to make
sure you have Transaction::Simple and color-tools[1] installed
yourself. I’m making changes to the PDF::Writer source, though, to
make it easier to run the demos from the checkout tree without getting
your already-installed version.)

Of course, I suspect that most people who would start hacking on a
project would have used the project first, so they would start by
installing a project’s gem – and get its dependencies automatically.

I’d also like to have Hoe work equally well if I’m using Rspec vs.
test/unit. On the documentation front, I’m pretty certain there are
features of the Maven site tools that I’ll miss in Ruby, but I haven’t
put in the work yet to learn how it’s done in the Ruby world to say
for sure.

I don’t use rspec and I doubt that I ever will (I can’t see any point
to it; on the projects where testing can make any meaningful
difference, I already use TDD to a T). I’ve seen nothing that suggests
that hoe won’t run well with rspec, though. Documentation-wise, I
doubt it. Documentation in Ruby is achieved primarily through rdoc.

If you want project tracking, use Trac or possibly one of the
up-and-coming Rails replacements for Trac.

And, if I’m undersanding you correctly (and I think I am based on the
marketing speak on the Maven website), it seems that Maven is a
combination of a command-line tool to help you managed projects where
you use the projects and a website to help you manage stuff similar
to Trac. This is overengineered to me. It’s trying to do entirely too
much.

It’s a very Java approach to a problem that should be much simpler,
but because Java isn’t simple, nothing that comes out of Java is
simple.

I do think that with Ruby there can be a better/cleaner version of
Maven, but I still feel that Ruby does need a Maven. :slight_smile:

Then build one. If people agree, they’ll use it too.

-austin
[1] Soon to be color.

On Sun, Feb 25, 2007 at 12:29:09AM +0900, Stephen D. wrote:

On 2/24/07, Austin Z. [email protected] wrote:

On 2/24/07, Stephen D. [email protected] wrote:
[…]
As far as I know, the only thing I’d want in Ruby is the ability to
integrate my Rdoc with an Rcov report or something.

Could you detail how this would work in practice, and what would have to
be
added to rcov?

On 2/24/07, Stephen D. [email protected] wrote:

project that isn’t excessively large to deal with.

Nothing on the Maven website suggested that it isn’t trying to solve
problems that simple Don’t Exist in the Ruby world, and that trying to
take a Maven approach to Ruby problems is AT BEST misguided.

That may well be true. Which is why I won’t be trying to take any
action to make anything Maven-like for Ruby until I have more
experience & work on enough things / a large enough project to feel
the pain points and decide that I, in fact, think the Maven approach
needs to be brought to Ruby.

Yea, because of teh way ruby does “packages” and since it has the gems
system, a lot of the Maven stuff is not needed, or already there, ut
pulling it all together would rock.

repository to be read before the system repository. These would be
list. :slight_smile:

There is a way to set it up so taht gems are installed in your home
directory, and I think Austin may have been confused because teh term
repository means a lot of things in rubygems, but if you want to
INSTALL them to your home directory, or somewhere in it, I believe you
just set the environment variable: GEM_HOME.

The purpose here is to do the equivalent of what
make it easier to run the demos from the checkout tree without getting
test/unit. On the documentation front, I’m pretty certain there are
If you want project tracking, use Trac or possibly one of the
http://www.stephenduncanjr.com/projects/easymock-propertyutils/index.html

As far as I know, the only thing I’d want in Ruby is the ability to
integrate my Rdoc with an Rcov report or something. Like I said, I
don’t know if there’s anything important here.

I have actually been thinking of adding some stuff like this to
RDoc/Rake, to easily build install docs, FAQs, maybe Rcov, that kind
of stuff, so we can actually get content on all those default template
rubyforge sites.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs