Skip to content

Commit

Permalink
Merge pull request #320 from rspec/fix-clone-issue-and-update-bundler…
Browse files Browse the repository at this point in the history
…-3-13

Fix clone issue and update bundler
  • Loading branch information
JonRowe authored Jun 20, 2024
2 parents fac6589 + 5e0ea53 commit 9407ec3
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 44 deletions.
20 changes: 10 additions & 10 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,10 @@ task :run, :command do |_t, args|
run_command args[:command]
end

desc "Updates the rspec.github.io docs"
task :update_docs, [:version, :website_path] do |_t, args|
abort "You must have ag installed to generate docs" if `which ag` == ""
args.with_defaults(:website_path => "../rspec.github.io")
desc 'Updates the rspec.github.io docs'
task :update_docs, [:version, :website_path, :branch] do |_t, args|
abort 'You must have ag installed to generate docs' if `which ag` == ''
args.with_defaults(:website_path => '../rspec.github.io')

output_directory = File.expand_path(args[:website_path])

Expand All @@ -225,9 +225,9 @@ task :update_docs, [:version, :website_path] do |_t, args|
projects = {}
skipped = []

$stdout.write "Checking versions..."
$stdout.write 'Checking versions...'

each_project :silent => true, :except => (UnDocumentedProjects) do |project|
each_project :silent => true, :except => UnDocumentedProjects do |project|
$stdout.write "\rChecking versions... #{project}"
latest_release =
if args[:version] =~ /maintenance$/
Expand All @@ -236,10 +236,12 @@ task :update_docs, [:version, :website_path] do |_t, args|
`git fetch --tags && git tag -l "v#{args[:version]}*" | grep v#{args[:version]} | tail -1`
end

if latest_release.empty?
if args[:branch].empty? && latest_release.empty?
skipped << project
else
elsif args[:branch].empty?
projects[project] = latest_release
else
projects[project] = args[:branch]
end
$stdout.write "\rChecking versions... #{' ' * MAX_PROJECT_NAME_LENGTH}"
end
Expand Down Expand Up @@ -526,12 +528,10 @@ namespace :ci do
end

def around_update_ci_build
run_if_exists './script/before_update_travis_build.sh'
run_if_exists './script/before_update_build.sh'
yield if block_given?
ensure
run_if_exists './script/after_update_build.sh'
run_if_exists './script/after_update_travis_build.sh'
end

desc "Update build files"
Expand Down
28 changes: 2 additions & 26 deletions ci/script/ci_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,41 +27,17 @@ nano_cmd="$(type -p gdate date | head -1)"
nano_format="+%s%N"
[ "$(uname -s)" != "Darwin" ] || nano_format="${nano_format/%N/000000000}"

travis_time_start() {
travis_timer_id=$(printf %08x $(( RANDOM * RANDOM )))
travis_start_time=$($nano_cmd -u "$nano_format")
printf "travis_time:start:%s\r\e[0m" $travis_timer_id
}

travis_time_finish() {
local travis_end_time=$($nano_cmd -u "$nano_format")
local duration=$(($travis_end_time-$travis_start_time))
printf "travis_time:end:%s:start=%s,finish=%s,duration=%s\r\e[0m" \
$travis_timer_id $travis_start_time $travis_end_time $duration
}

fold() {
local name="$1"
local status=0
shift 1
if [ -n "$TRAVIS" ]; then
printf "travis_fold:start:%s\r\e[0m" "$name"
travis_time_start
else
echo "============= Starting $name ==============="
fi
echo "============= Starting $name ==============="

"$@"
status=$?

[ -z "$TRAVIS" ] || travis_time_finish

if [ "$status" -eq 0 ]; then
if [ -n "$TRAVIS" ]; then
printf "travis_fold:end:%s\r\e[0m" "$name"
else
echo "============= Ending $name ==============="
fi
echo "============= Ending $name ==============="
else
STATUS="$status"
fi
Expand Down
4 changes: 2 additions & 2 deletions ci/script/clone_all_rspec_repos
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ source script/functions.sh
if is_mri; then
pushd ..

clone_repo "rspec"
clone_repo "rspec-metagem" "rspec"
clone_repo "rspec-core"
clone_repo "rspec-expectations"
clone_repo "rspec-mocks"
clone_repo "rspec-rails" "6-1-maintenance"
clone_repo "rspec-rails" "rspec-rails" "6-1-maintenance"

if rspec_support_compatible; then
clone_repo "rspec-support"
Expand Down
11 changes: 8 additions & 3 deletions ci/script/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ source $SCRIPT_DIR/ci_functions.sh
source $SCRIPT_DIR/predicate_functions.sh

# If JRUBY_OPTS isn't set, use these.
# see https://docs.travis-ci.com/user/ci-environment/
export JRUBY_OPTS=${JRUBY_OPTS:-"--server -Xcompile.invokedynamic=false"}
SPECS_HAVE_RUN_FILE=specs.out
MAINTENANCE_BRANCH=`cat maintenance-branch`
Expand All @@ -17,12 +16,18 @@ fi
function clone_repo {
if [ ! -d $1 ]; then # don't clone if the dir is already there
if [ -z "$2" ]; then
DIR_TARGET="$1"
else
DIR_TARGET="$2"
fi

if [ -z "$3" ]; then
BRANCH_TO_CLONE="${MAINTENANCE_BRANCH?}";
else
BRANCH_TO_CLONE="$2";
BRANCH_TO_CLONE="$3";
fi;

ci_retry eval "git clone https://github.com/rspec/$1 --depth 1 --branch ${BRANCH_TO_CLONE?}"
ci_retry eval "git clone https://github.com/rspec/$1 --depth 1 --branch ${BRANCH_TO_CLONE?} ${DIR_TARGET?}"
fi;
}

Expand Down
6 changes: 3 additions & 3 deletions ci/script/update_rubygems_and_install_bundler
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ set -e
source script/functions.sh

if is_ruby_31_plus; then
echo "Installing rubygems 3.3.6 / bundler 2.3.6"
yes | gem update --system '3.3.6'
yes | gem install bundler -v '2.3.6'
echo "Installing most recent rubygems / bundler"
yes | gem update --no-document --system
yes | gem install --no-document bundler
elif is_ruby_23_plus; then
echo "Installing rubygems 3.2.22 / bundler 2.2.22"
yes | gem update --system '3.2.22'
Expand Down

0 comments on commit 9407ec3

Please sign in to comment.