Thank you Steve and Hugh,

My anxiety won over my laziness so I've spent a lot of hours figuring
out how to do what I wanted.

So far, I've created my own set of helpers that abstract Gem::TestCase
ones for my purpose:

* Create a fake gem
* Bundle a extension (files) inside the fake gem

https://github.com/luislavena/gem-compiler/blob/master/test/rubygems/test_gem_compiler.rb#L90-144

A few things I noticed:

new_spec returns the gemspec of the new gem you created, but
internally it relocates the gem so you can't use spec.cache_file
because that file doesn't exist.

I needed to workaround that here:
https://github.com/luislavena/gem-compiler/blob/master/test/rubygems/test_gem_compiler.rb#L98

With these helpers, I can:

Create a gem and obtain the path to the gem file (cache_file):

    gem_file = util_bake_gem { |s| s.platform = Gem::Platform::CURRENT }

Add a no-op extension to it:

    gem_file = util_bake_gem { |spec|
      util_fake_extension spec
    }

Or add a almost-real extension that generates an empty artifact
combining above with util_custom_configure helper.

One last thing I'm missing is a way to check gem contents and see if I
have one particular file inside the generated gem.

I guess will have to figure it out ;-)

On Tue, Jun 12, 2012 at 1:34 PM, Hugh Sasse <h...@dmu.ac.uk> wrote:
> Whilst I'm not familiar enough with the structure and many details
> of Rubygems (as I should be) in order to give you an answer, this
> re-raises the issue of Software Archeology.  My own weak attempt to
> tackle to this might be of some very limited help in exploring the
> space.  See the code at, and remarks below
>
> http://www.tech.dmu.ac.uk/~hgs/ruby/index.html#rdescriber.rb
>
> Among other things, this produces diagrams of which classes create
> instances of which other classes, using GraphViz.  The parser is
> very, very crude.  It should probably be rewritten using some of the
> excellent work from Rubinius, etc.  I've not touched the code in a
> long time, so it is probably frightful, but if it helps, then that's
> something at least.
>
>        HTH
>        Hugh
> _______________________________________________
> RubyGems-Developers mailing list
> http://rubyforge.org/projects/rubygems
> RubyGems-Developers@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rubygems-developers



-- 
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry
_______________________________________________
RubyGems-Developers mailing list
http://rubyforge.org/projects/rubygems
RubyGems-Developers@rubyforge.org
http://rubyforge.org/mailman/listinfo/rubygems-developers

Reply via email to