Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
ruby-build
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ruby-build
Commits
36b2d13b
Commit
36b2d13b
authored
Jan 29, 2013
by
Sam Stephenson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow plugins to run code before and after the installation process
parent
724a3f38
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
4 deletions
+41
-4
bin/rbenv-install
+41
-4
No files found.
bin/rbenv-install
View file @
36b2d13b
...
@@ -65,25 +65,62 @@ for option in "${OPTIONS[@]}"; do
...
@@ -65,25 +65,62 @@ for option in "${OPTIONS[@]}"; do
esac
esac
done
done
unset
VERSION_NAME
DEFINITION
=
"
${
ARGUMENTS
[0]
}
"
DEFINITION
=
"
${
ARGUMENTS
[0]
}
"
[
-n
"
$DEFINITION
"
]
||
usage 1
[
-n
"
$DEFINITION
"
]
||
usage 1
# Define `before_install` and `after_install` functions that allow
# plugin hooks to register a string of code for execution before or
# after the installation process.
declare
-a
before_hooks after_hooks
before_install
()
{
local
hook
=
"
$1
"
before_hooks[
"
${#
before_hooks
[@]
}
"
]=
"
$hook
"
}
after_install
()
{
local
hook
=
"
$1
"
after_hooks[
"
${#
after_hooks
[@]
}
"
]=
"
$hook
"
}
# Load plugin hooks.
for
script
in
$(
rbenv-hooks install
)
;
do
for
script
in
$(
rbenv-hooks install
)
;
do
source
"
$script
"
source
"
$script
"
done
done
VERSION_NAME
=
"
${
DEFINITION
##*/
}
"
# Set VERSION_NAME from $DEFINITION, if it is not already set. Then
# compute the installation prefix.
[
-n
"
$VERSION_NAME
"
]
||
VERSION_NAME
=
"
${
DEFINITION
##*/
}
"
PREFIX
=
"
${
RBENV_ROOT
}
/versions/
${
VERSION_NAME
}
"
PREFIX
=
"
${
RBENV_ROOT
}
/versions/
${
VERSION_NAME
}
"
# If RBENV_BUILD_ROOT is set,
then always pass keep options to ruby-build
# If RBENV_BUILD_ROOT is set,
always pass keep options to ruby-build.
if
[
-n
"
${
RBENV_BUILD_ROOT
}
"
]
;
then
if
[
-n
"
${
RBENV_BUILD_ROOT
}
"
]
;
then
export
RUBY_BUILD_BUILD_PATH
=
"
${
RBENV_BUILD_ROOT
}
/
${
VERSION_NAME
}
"
export
RUBY_BUILD_BUILD_PATH
=
"
${
RBENV_BUILD_ROOT
}
/
${
VERSION_NAME
}
"
KEEP
=
"-k"
KEEP
=
"-k"
fi
fi
# Set RUBY_BUILD_CACHE_PATH to $RBENV_ROOT/cache, if the directory
# exists and the variable is not already set.
if
[
-z
"
${
RUBY_BUILD_CACHE_PATH
}
"
]
&&
[
-d
"
${
RBENV_ROOT
}
/cache"
]
;
then
if
[
-z
"
${
RUBY_BUILD_CACHE_PATH
}
"
]
&&
[
-d
"
${
RBENV_ROOT
}
/cache"
]
;
then
export
RUBY_BUILD_CACHE_PATH
=
"
${
RBENV_ROOT
}
/cache"
export
RUBY_BUILD_CACHE_PATH
=
"
${
RBENV_ROOT
}
/cache"
fi
fi
ruby-build
$KEEP
$VERBOSE
"
$DEFINITION
"
"
$PREFIX
"
rbenv rehash
# Execute `before_install` hooks.
for
hook
in
"
${
before_hooks
[@]
}
"
;
do
eval
"
$hook
"
;
done
# Invoke `ruby-build` and record the exit status in $STATUS. Run
# `rbenv rehash` after a successful installation.
STATUS
=
0
ruby-build
$KEEP
$VERBOSE
"
$DEFINITION
"
"
$PREFIX
"
||
STATUS
=
"
$?
"
# Execute `after_install` hooks.
for
hook
in
"
${
after_hooks
[@]
}
"
;
do
eval
"
$hook
"
;
done
# Run `rbenv-rehash` after a successful installation.
[
"
$STATUS
"
!=
"0"
]
||
rbenv rehash
exit
"
$STATUS
"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment