Closed bixu closed 2 months ago
I'm not sure about your particular setup but I am using the files below successfully on the latest macOS beta. I have not done extensive ground-up testing since the first beta however, I've just been re-sprouting the same machine post-updates.
The contents of sprout
are somewhat different and do expose a larger surface area than the sprout
script in this repo - I'm not yet sure this is a good thing. Pinging @wendorf as he may have other insights / ideas.
sprout
#!/usr/bin/env bash
set -e
function use_local_gems() {
SPROUT_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export SPROUT_HOME
export GEM_HOME="${SPROUT_HOME}/tmp/ruby/2.0.0"
export GEM_PATH="${GEM_HOME}"
export PATH="${GEM_HOME}/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"
current_ruby=$(which ruby)
if [ "${current_ruby}" != '/usr/bin/ruby' ]; then
echo -e "\033[31mWarning: sprout should be run with system ruby; using '${current_ruby}'\033[0m"
fi
echo "# - Using $(${current_ruby} -v)"
}
function ensure_in_sprout_home() {
if [ "${SPROUT_HOME}" != "$(pwd)" ]; then
echo "Error: sprout must be run from ${SPROUT_HOME}"
exit 1
fi
}
function bundle_exec() {
if bundler_installed; then
echo "# - Using $(bundle -v)"
else
gem install bundler --no-document
fi
if bundle check > /dev/null 2>&1; then
echo '# - Gemfile dependencies satisfied'
else
bundle install --jobs 6
fi
bundle exec "${@}"
}
function bundler_installed() {
command -v bundle > /dev/null
}
function update_resources() {
gem install bundler --no-document
bundle update
bundle exec librarian-chef update
}
function main() {
use_local_gems
ensure_in_sprout_home
case "${1}" in
'')
export LOG_LEVEL="warn" # make chef less noisy
bundle_exec soloist
;;
exec)
shift
bundle_exec "${@}"
;;
update)
update_resources
;;
*)
echo "Usage:"
echo " sprout - install dependencies and run 'soloist'"
echo " sprout exec some cmd - run 'some cmd' in this cookbooks's bundler context"
echo " sprout update: - update gems and cookbook dependencies"
esac
}
main "${@}"
Gemfile
source 'https://rubygems.org'
gem 'soloist', require: false
group :development do
gem 'foodcritic', '< 7.0.0', require: false # foodcritic >=7.0.0 drops support for ruby v2.0.0
gem 'rake', require: false
gem 'rspec', require: false
gem 'rubocop', require: false
gem 'chefspec', require: false
end
# Temporarily lock these gems. Newer versions depend on Ruby >= 2.1.0
# Remove this once https://github.com/mkocher/soloist/issues/39 is closed
gem 'chef', '~> 12.8.1', require: false
gem 'chef-zero', '~> 4.5.0', require: false
gem 'fauxhai', '< 3.7.0', require: false # >=3.7.0 requires ruby v2.1
gem 'ffi-yajl', '< 2.3.0', require: false # >=2.3.0 requires ruby v2.1
gem 'ohai', '< 8.18.0', require: false # >=8.18.0 requires ruby v2.2.2
gem 'rack', '< 2.0.0', require: false # >=2.0.0 requires ruby v2.2.2
Cheffile
site 'https://supermarket.getchef.com/api/v1'
cookbook 'sprout-our-team', path: '.'
cookbook 'osx', github: 'pivotal-sprout/osx'
cookbook 'sprout-base', github: 'pivotal-sprout/sprout-base'
cookbook 'sprout-chruby', github: 'pivotal-sprout/sprout-chruby'
cookbook 'sprout-git', github: 'pivotal-sprout/sprout-git'
cookbook 'sprout-osx-settings', github: 'pivotal-sprout/sprout-osx-settings'
# mingw 1.0 and build-essential 4.0 add a dependency to compat_resource,
# which does not work with Rubygems 2.0.14, which ships with OS X 10.11.4
cookbook 'mingw', '= 0.1.1'
cookbook 'build-essential', '= 3.2.0'
Going to archive this repo, closing.
example output: