[ditz-talk] [PATCH] Use /usr/bin/env ruby instead of /usr/bin/ruby1.8

Ohad Lutzky ohad at lutzky.net
Mon Nov 10 15:26:47 EST 2008


On Mon, Nov 10, 2008 at 7:40 PM, Thomas Nichols <nichols7 at googlemail.com> wrote:
> The following changes since commit 6f2756fbce3662e41a1e4c57dcb99b56b8b076ec:
>  Thomas Nichols (1):
>        Merge branch 'master' of git://gitorious.org/ditz/mainline
>
> are available in the git repository at:
>
>  git://gitorious.org/ditz/thomasns-clone.git master
>
> Thomas Nichols (1):
>      Use /usr/bin/env/ruby instead of an OS-specific binary name.
>
>  bin/ditz |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
>
> =========================================================================================
>
> >From 06c4845d479d4296865d95ad8a103d102e628e9a Mon Sep 17 00:00:00 2001
> From: Thomas Nichols <thomas at nexus10.com>
> Date: Mon, 10 Nov 2008 17:14:08 +0000
> Subject: [PATCH] Use /usr/bin/env/ruby instead of an OS-specific binary
> name.
>  Gentoo has /usr/bin/ruby18 but not /usr/bin/ruby1.8 .
>
> ---
>  bin/ditz |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/bin/ditz b/bin/ditz
> index cf4bd15..0c1a8dc 100755
> --- a/bin/ditz
> +++ b/bin/ditz
> @@ -1,4 +1,4 @@
> -#!/usr/bin/ruby1.8
> +#!/usr/bin/env ruby
>
>  $LOAD_PATH.unshift(File.expand_path("#{File.dirname($0)}/../lib"))
>
> --
> 1.6.0.2

Actually, this particular path is automatically modified by setup.rb.
Special provisions need to be taken in order to make sure the hashbang
line stays the same. Either you can just be careful when committing,
or you can have your build-script retain the old version of the
binary. For example, in ttime, I have the following rake task in place
(it's called by the debuild task)

  # Debuild with proper backup and restoration operations
  def safely_debuild(debuild_opts = "")
    # Save bin/ttime, as setup.rb modifies the shebang and mode
    tempd = `mktemp -d`.chomp
    FileUtils.copy("bin/ttime",tempd)

    begin
      `debuild #{debuild_opts}`
    ensure
      FileUtils.move(File::join(tempd, "ttime"), "bin/")
      Dir::rmdir(tempd)
    end
  end

-- 
Man is the only animal that laughs and weeps, for he is the only
animal that is struck with the difference between what things are and
what they ought to be.
 - William Hazlitt

Ohad Lutzky


More information about the ditz-talk mailing list