From e2e1c7d64c623189154e70ed589ff9ad16d5ec18 Mon Sep 17 00:00:00 2001 From: Andre Richter Date: Tue, 17 Dec 2019 13:22:28 +0100 Subject: [PATCH] Conditionally include extra folders in utils scripts --- utils/diff_all.rb | 2 +- utils/helpers/tutorial_folders.rb | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/utils/diff_all.rb b/utils/diff_all.rb index 7062d83c..7aa6fc0b 100755 --- a/utils/diff_all.rb +++ b/utils/diff_all.rb @@ -9,7 +9,7 @@ require 'fileutils' require_relative 'helpers/tutorial_folders.rb' def diff_all - crates = tutorial_folders + crates = tutorial_folders(false) (0..(crates.length - 2)).each do |i| old = File.dirname(crates[i]) diff --git a/utils/helpers/tutorial_folders.rb b/utils/helpers/tutorial_folders.rb index 3ea80324..fcef00a2 100755 --- a/utils/helpers/tutorial_folders.rb +++ b/utils/helpers/tutorial_folders.rb @@ -7,11 +7,16 @@ require 'fileutils' -def tutorial_folders +WITH_EXTRA = '[X0-9]' +NO_EXTRA = '[0-9]' + +def tutorial_folders(with_extra = true) crates = Dir['**/Cargo.toml'] crates.delete_if do |x| - !/[0-9][0-9]/.match?(x[0..1]) + s = with_extra ? WITH_EXTRA : NO_EXTRA + + !/[#{s}][0-9]/.match?(x[0..1]) end crates.sort!