[csw-devel] basic ruby gem recipe (rake) - doesn't create executable in /opt/csw/bin/

Jesse Reynolds jesse at opencsw.org
Thu Aug 18 00:55:06 CEST 2011


On 18 August 2011 00:05, Ben Walton <bwalton at opencsw.org> wrote:

> Excerpts from Jesse Reynolds's message of Wed Aug 17 09:49:45 -0400 2011:
>
> Hi Jesse,
>
> > I wonder if anyone knows why a very basic gem recipe for rake (at
> > rbgems/rake/branches/rb18) doesn't create a link / executable at
> > /opt/csw/bin/rake ? This would be created if you ran 'gem install
> > rake'.
>
> Does it create the symlink anywhere else in the tree?  If not, you can
> use:
>
> post-install-modulated:
>        (cd $(DESTDIR); mkdir -p opt/csw/bin; ln -s /path/to/rake.rb
>        opt/csw/bin/rake)
>

OK ta.


>
> or some such.  If the symlink should be delivered normally but isn't,
> maybe we're not calling gem properly?
>

I suspect this is the case. Usually when you install a gem that has a
command line interface, like rake, rubygems installs a wrapper script for
it. It doesn't use a symlink actually (which was my assumption until now),
the wrapper script looks like this on my mac:

jesse at ren $ cat /opt/local/bin/rake
#!/opt/local/bin/ruby
#
# This file was generated by RubyGems.
#
# The application 'rake' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

version = ">= 0"

if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
  version = $1
  ARGV.shift
end

gem 'rake', version
load Gem.bin_path('rake', 'rake', version)



Whereas the 'rake' command line executable installed within the ruby gems
heirarchy is entirely different:


jesse at ren $ cat /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake
#!/usr/bin/env ruby

#--
# Copyright (c) 2003, 2004, 2005, 2006, 2007  Jim Weirich
#
# Permission is hereby granted, free of charge, to any person obtaining a
copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS
# IN THE SOFTWARE.
#++

begin
  require 'rake'
rescue LoadError
  require 'rubygems'
  require 'rake'
end
Rake.application.run


I'm not sure how rubygems knows to create these wrapper scripts. I imagine
there is some kind of installation recipe embedded within the gemfile. I'll
take a look.

Jesse
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opencsw.org/pipermail/devel/attachments/20110818/6c73c785/attachment.html>


More information about the devel mailing list