Skip to content

Commit e99c0d4

Browse files
committed
Linking of ruby and bin path change in hab:
Signed-off-by: nitin sanghi <[email protected]>
1 parent 606159e commit e99c0d4

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

habitat/plan.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ do_setup_environment() {
2020
build_line "Setting GEM_PATH=$GEM_HOME"
2121
export GEM_PATH="$GEM_HOME"
2222
}
23-
23+
do_prepare() {
24+
ln -sf "$(pkg_interpreter_for core/ruby3_1 bin/ruby)" "$(pkg_interpreter_for core/coreutils bin/env)"
25+
echo "$(pkg_interpreter_for core/ruby3_1 bin/ruby)"
26+
}
2427
pkg_version() {
2528
cat "$SRC_PATH/VERSION"
2629
}
@@ -43,6 +46,7 @@ do_build() {
4346
bundle config --local silence_root_warning 1
4447
bundle install
4548
gem build chef-cli.gemspec
49+
gem install rspec-core
4650
ruby ./post-bundle-install.rb
4751
}
4852
do_install() {
@@ -53,6 +57,9 @@ do_install() {
5357
gem install chef-cli-*.gem --no-document
5458
set_runtime_env "GEM_PATH" "${pkg_prefix}/vendor"
5559
wrap_ruby_bin
60+
rm -rf $GEM_PATH/cache/
61+
rm -rf $GEM_PATH/bundler
62+
rm -rf $GEM_PATH/doc
5663
}
5764
wrap_ruby_bin() {
5865
local bin="$pkg_prefix/bin/$pkg_name"
@@ -63,7 +70,7 @@ wrap_ruby_bin() {
6370
set -e
6471
6572
# Set binary path that allows InSpec to use non-Hab pkg binaries
66-
export PATH="/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:\$PATH"
73+
export PATH="/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:$pkg_prefix/vendor/bin:\$PATH"
6774
6875
# Set Ruby paths defined from 'do_setup_environment()'
6976
export GEM_HOME="$pkg_prefix/vendor"

0 commit comments

Comments
 (0)