Fat binary gems
Eric Hodel | Tue, 12 May 2009 23:10:58 GMT
Right now people who publish native gems targeting the windows platform have a problem. Our problem is supporting ruby 1.8 and 1.9 at the same time. Right now, we can’t build one gem targeting 1.8 and one gem targeting 1.9, and have rubygems differentiate the two. I have a solution: fat binary gems. We can build a gem that contains dynamic libraries that target ruby 1.8 and ruby 1.9 on windows, with no changes to rubygems whatsoever. I’ve put together a proof of concept that I want to share. I will walk through the steps for building a fat binary gem with the tools we have today. The steps I am going to present are not necessarily the best steps, they are just the steps I took to get this idea working.
— Fat binary gems make the rockin’ world go round via Tender Love Making
gmail_contacts 1.1
Eric Hodel | Fri, 01 May 2009 21:08:11 GMT
- <a href=”http://seattlerb.rubyforge.org/gmail_contacts”>Documentation
Simple Gmail contacts extraction using GData.
gmail_contacts development was sponsored by AT&T Interactive.
Changes
- 1 minor enhancement
- Allow for saved session tokens
- 1 bug fix
- Fix stubs for gdata 1.1
Binding#remove_local_variable
Eric Hodel | Fri, 24 Apr 2009 00:29:07 GMT
require 'rubygems'
require 'inline'
class Binding
inline do |builder|
builder.include '"node.h"'
builder.include '"env.h"'
##
# struct BLOCK isn't in any header, so include it here.
builder.prefix <<-C
struct BLOCK {
NODE *var;
NODE *body;
VALUE self;
struct FRAME frame;
struct SCOPE *scope;
VALUE klass;
NODE *cref;
int iter;
int vmode;
int flags;
int uniq;
struct RVarmap *dyna_vars;
VALUE orig_thread;
VALUE wrapper;
VALUE block_obj;
struct BLOCK *outer;
struct BLOCK *prev;
};
C
##
# :method: remove_local_variable
#
# Removes the local variable +name+ and replaces it with nil.
#
# Ordinarily if a local variable didn't exist it would raise
# NoMethodError, but currently after #remove_local_variable it doesn't, it
# just returns nil.
#
# In order to make this behave correctly, block->body would need to be
# walked, duping nodes (so as not to affect future invocations of this
# method) and replacing the LVAR nodes with VCALL nodes.
#
# That's just too much work for 17:15, though. Maybe tomorrow.
builder.c <<-C
VALUE remove_local_variable(VALUE name) {
struct BLOCK *block;
struct SCOPE *scope;
ID name_id;
ID *local_table;
int i, n;
VALUE entry;
name_id = SYM2ID(name);
Data_Get_Struct(self, struct BLOCK, block);
scope = block->scope;
local_table = scope->local_tbl;
if (local_table) {
n = *local_table++;
for (i = 2; i < n; i++) { /* skip $_ and $~ */
if (!rb_is_local_id(local_table[i])) continue; /* skip flip states */
if (local_table[i] == name_id) {
entry = scope->local_vars[i];
local_table[i] = (ID)NULL;
scope->local_vars[i] = Qnil;
return entry;
}
}
}
return Qnil;
}
C
end
end
a = :my_value
p :lvar_a => a
b = binding
p :remove_local_variable_says => b.remove_local_variable(:a)
p :lvar_a => a # TODO raise exception
InfoQ on RubyGems Plugins
Eric Hodel | Thu, 23 Apr 2009 00:05:39 GMT
RubyGems 1.3.2 introduced a new feature: plugins that can hook into the install process and provide new commands. An example is Ryan Davis’ graph that visualizes dependencies between installed Gems. We talked to RubyGems maintainer Eric Hodel to learn more. By Mirko Stocker
— RubyGems Gets Plugins via InfoQ
quick_cert 2.0
Eric Hodel | Thu, 16 Apr 2009 08:41:00 GMT
quick_cert version 2.0 has been released!
seattlerb.rubyforge.org/quick_cert
rubyforge.org/projects/seattlerb
quick_cert allows you to quickly and easily create SSL certificates. It uses a simple configuration file to generate self-signed client and server certificates.
quick_cert (formerly QuickCert) was one of the first things I released for Ruby, some four years ago. I’ve heard over the years that (shockingly!) people have continued to use it. Here it is for the first time as a gem!
Changes:
- 2 minor enhancements:
- Released as a gem
- Reorganized for Hoe
- 3 discoveries:
- CVS is odd after not using it for so long
- My ruby style hasn’t changed much in the past five years
- I still don’t know how OpenSSL works
RubyGems 1.3.2
Eric Hodel | Wed, 15 Apr 2009 21:48:00 GMT
NOTE: RubyGems 1.1 and 1.2 have problems upgrading when there is no rubygems-update installed. You will need to follow the second set of update instructions if you see “Nothing to update”.
Release 1.3.2 fixes some bugs and adds some features.
Select New Features:
- RubyGems now loads plugins from rubygems_plugin.rb in installed gems. This can be used to add commands (See Gem::CommandManager) or add install/uninstall hooks (See Gem::Installer and Gem::Uninstaller).
- Gem::Version now understands prerelease versions using letters. (eg. ‘1.2.1.b’) Thanks to Josh Susser, Alex Vollmer and Phil Hagelberg.
- RubyGems now includes a Rake task for creating gems which replaces rake’s Rake::GemPackageTask. See Gem::PackageTask.
- Gem::find_files now returns paths in $LOAD_PATH.
- Added Gem::promote_load_path for use with Gem::find_files
- Added Gem::bin_path to make finding executables easier. Patch #24114 by James Tucker.
- Various improvements to build arguments for installing gems.
- `gem contents` added --all and --no-prefix.
- Gem::Specification
- #validate strips directories and errors on not-files.
- #description no longer removes newlines.
- #name must be a String.
- FIXME and TODO are no longer allowed in various fields.
- Added support for a license attribute. Feature #11041 (partial).
- Removed Gem::Specification::list, too much process growth. Bug #23668 by Steve Purcell.
- `gem generate_index`
- Can now generate an RSS feed.
- Modern indicies can now be updated incrementally.
- Legacy indicies can be updated separately from modern.
Select Bugs Fixed:
- Better gem activation error message. Patch #23082.
- Kernel methods are now private. Patch #20801 by James M. Lawrence.
- Fixed various usability issues with `gem check`.
- `gem update` now rescues InstallError and continues. Bug #19268 by Gabriel Wilkins.
- Allow ‘https’, ‘file’ as a valid schemes for --source. Patch #22485.
- `gem install`
- Now removes existing path before installing. Bug #22837.
- Uses Gem::bin_path in executable stubs to work around Kernel#load bug in 1.9.
- Correctly handle build args (after --) via the API. Bug #23210.
- --user-install
- `gem install --no-user-install` now works. Patch #23573 by Alf Mikula.
- `gem uninstall` can now uninstall from ~/.gem. Bug #23760 by Roger Pack.
- setup.rb
- Clarify RubyGems RDoc installation location. Bug #22656 by Gian Marco Gherardi.
- Allow setup to run from read-only location. Patch #21862 by Luis Herrera.
- Fixed overwriting ruby executable when BASERUBY was not set. Bug #24958 by Michael Soulier.
- Ensure we’re in a RubyGems dir when installing.
- Deal with extraneous quotation mark when autogenerating .bat file on MS Windows. Bug #22712.
Deprecation Notices:
- Gem::manage_gems has been removed.
- Time::today will be removed in RubyGems 1.4.
For a full list of changes to RubyGems and the contributor for each change, see the ChangeLog file.
Special thanks to Chad Wooley for backwards compatibility testing and Luis Lavena and Daniel Berger for continuing windows support.
How can I get RubyGems?
NOTE: If you have installed RubyGems using a package system you may want to install a new RubyGems through the same packaging system.
If you have a recent version of RubyGems (0.8.5 or later), then all you need to do is:
$ gem update --system (you might need to be admin/root)
NOTE: RubyGems 1.1 and 1.2 have problems upgrading when there is no rubygems-update installed. You will need to follow the second set of update instructions if you see “Nothing to update”.
NOTE: You may have to run the command twice if you have any previosly installed rubygems-update gems.
If you have an older version of RubyGems installed, then you can still do it in two steps:
$ gem install rubygems-update (again, might need to be admin/root) $ update_rubygems (... here too)
If you don’t have any gems install, there is still the pre-gem approach to getting software … doing it manually:
- DOWNLOAD FROM: rubyforge.org/frs/?group_id=126
- UNPACK INTO A DIRECTORY AND CD THERE
- INSTALL WITH: ruby setup.rb (you may need admin/root privilege)
To File Bugs
The RubyGems bug tracker can be found on RubyForge at: rubyforge.org/tracker/?func=add&group_id=126&atid=575
When filing a bug, `gem env` output will be helpful in diagnosing the issue.
If you find a bug where RubyGems crashes, please provide debug output. You can do that with `gem --debug the_command`.
Thanks
Keep those gems coming!
— The RubyGems team
PS: This blog post brought to you by rdoc --pipe
gmail_contacts 1.0
Eric Hodel | Wed, 08 Apr 2009 23:44:57 GMT
gmail_contacts version 1.0 has been released!
http://seattlerb.rubyforge.org/gmail_contacts
Simple Gmail contacts extraction using GData.
gmail_contacts development was sponsored by AT&T Interactive.
RDoc 2.4.2
Eric Hodel | Wed, 25 Mar 2009 23:18:00 GMT
rdoc version 2.4.2 has been released!
RDoc is an application that produces documentation for one or more Ruby source files. RDoc includes the rdoc and ri tools for generating and displaying online documentation.
At this point in time, RDoc 2.x is a work in progress and may incur further API changes beyond what has been made to RDoc 1.0.1. Command-line tools are largely unaffected, but internal APIs may shift rapidly.
See RDoc for a description of RDoc’s markup and basic use.
Changes:
- 2 Minor Enhancements
- Added --pipe for turning RDoc on stdin into HTML
- Added rdoc/task.rb containing a replacement for rake/rdoctask.rb. Use RDoc::Task now instead of Rake::RDocTask.
- 10 Bug Fixes
- Writing the ri cache file to the proper directory. Bug #24459 by Lars Christensen.
- Possible fix for Dir::[] and Pathname interaction on 1.9. Bug #24650 by tiburon.
- Fixed scanning constants for if/end, etc. pairs. Bug #24609 by Ryan Davis.
- Fixed private methods in the C parser. Bug #24599 by Aaron Patterson.
- Fixed display of markup on RDoc main page. Bug #24168 by rhubarb.
- Fixed display of \ character in documentation proceeding words. Bug #22112 by James Gray. See RDoc for details.
- Fixed parsing and display of arg params for some corner cases. Bug #21113 by Csiszár Attila.
- Fixed links in Files box. Patch #24403 by Eric Wong.
- Toplevel methods now appear in Object. Bug #22677 by Ryan Davis.
- Added back --promiscuous which didn’t do anything you cared about. Why did you enable it? Nobody looked at that page! Oh, it warns, too.
RubyForge Gems RSS Feed
Eric Hodel | Mon, 09 Mar 2009 21:20:35 GMT
Thanks to the assistance of Tom Copeland, RubyForge now has an RSS feed of recent gems:
http://gems.rubyforge.org/index.rss
The feed is updated daily and contains the last two days of releases. If you forget, you can also access the feed via RSS autodiscovery on http://rubyforge.org
RDoc 2.4.1
Eric Hodel | Fri, 27 Feb 2009 03:19:22 GMT
RDoc is an application that produces documentation for one or more Ruby source files. RDoc includes the rdoc and ri tools for generating and displaying online documentation.
At this point in time, RDoc 2.x is a work in progress and may incur further API changes beyond what has been made to RDoc 1.0.1. Command-line tools are largely unaffected, but internal APIs may shift rapidly.
See RDoc for a description of RDoc’s markup and basic use.
Changes:
- 1 Minor Enhancements
- Added :attr:, :attr_reader:, :attr_writer:, :attr_accessor: directives. Replaces—accessor. See RDoc::Parser::Ruby for details.
- 3 Bug Fixes
- Don’t complain when exiting normally. Bug by Matt Neuburg.
- Restore—inline-source that warns
- Fixed links to files in Darkfish output

Articles