Skip to content

Commit

Permalink
rbenv: make Homebrew house style tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMcQuaid committed Dec 25, 2015
1 parent 50a8a9b commit b87823a
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions Formula/rbenv.rb
Expand Up @@ -11,32 +11,29 @@ class Rbenv < Formula

def install
inreplace "libexec/rbenv" do |s|
s.gsub!('"${BASH_SOURCE%/*}"/../libexec', libexec.to_s, false)
s.gsub! '"${BASH_SOURCE%/*}"/../libexec', libexec
if HOMEBREW_PREFIX.to_s != "/usr/local"
s.gsub!(":/usr/local/etc/rbenv.d", ":#{HOMEBREW_PREFIX}/etc/rbenv.d\\0")
s.gsub! ":/usr/local/etc/rbenv.d", ":#{HOMEBREW_PREFIX}/etc/rbenv.d\\0"
end
end

# Compile optional bash extension. Failure is not critical.
if File.exist? "src/configure"
Kernel.system "src/configure"
Kernel.system "make", "-C" "src"
end
# Compile optional bash extension.
system "src/configure"
system "make", "-C", "src"

if head?
if build.head?
# Record exact git revision for `rbenv --version` output
inreplace "libexec/rbenv---version" do |s|
git_revision=`git rev-parse --short HEAD`.chomp
s.sub!(/^(version=)"([^"]+)"/, %{\\1"\\2-g#{git_revision}"})
end
git_revision = `git rev-parse --short HEAD`.chomp
inreplace "libexec/rbenv---version", /^(version=)"([^"]+)"/,
%(\\1"\\2-g#{git_revision}")
end

prefix.install Dir["{bin,completions,libexec,rbenv.d}"]
prefix.install ["bin", "completions", "libexec", "rbenv.d"]
end

def caveats; <<-EOS.undent
Rbenv stores data under `~/.rbenv' by default. If you absolutely need to instead
store everything under the Homebrew prefix, include this in your profile:
Rbenv stores data under ~/.rbenv by default. If you absolutely need to
store everything under Homebrew's prefix, include this in your profile:
export RBENV_ROOT=#{var}/rbenv
To enable shims and autocompletion, run this and follow the instructions:
Expand Down

0 comments on commit b87823a

Please sign in to comment.