build/test_basics.rb in passenger-6.0.20 vs build/test_basics.rb in passenger-6.0.23

- old
+ new

@@ -20,10 +20,12 @@ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. +require 'rubygems/version.rb' + TEST_BOOST_OXT_LIBRARY = LIBBOOST_OXT TEST_COMMON_LIBRARY = COMMON_LIBRARY TEST_COMMON_CFLAGS = "-DTESTING_APPLICATION_POOL" desc "Run all unit tests and integration tests" @@ -47,37 +49,54 @@ gem_install = PlatformInfo.gem_command + " install --no-rdoc --no-ri" gem_install = "#{PlatformInfo.ruby_sudo_command} #{gem_install}" if boolean_option('SUDO') default = boolean_option('DEVDEPS_DEFAULT', true) install_base_deps = boolean_option('BASE_DEPS', default) + bundle_args = [] if deps_target = string_option('DEPS_TARGET') - bundle_args = "--path #{shesc deps_target} #{ENV['BUNDLE_ARGS']}".strip - else - bundle_args = ENV['BUNDLE_ARGS'].to_s + if bundler_too_new? + sh "bundle config set --local path #{shesc deps_target}" + else + bundle_args.concat(["--path", shesc(deps_target)]) + end end npm_args = ENV['NPM_ARGS'].to_s if !PlatformInfo.locate_ruby_tool('bundle') || bundler_too_old? sh "#{gem_install} bundler" end if install_base_deps - if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.0.0') || RUBY_PLATFORM =~ /darwin/ - sh "bundle install #{bundle_args} --without=" - else - sh "bundle install #{bundle_args} --without future" + unless Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.0.0') || RUBY_PLATFORM =~ /darwin/ + if bundler_too_new? + sh "bundle config set --local without future" + else + bundle_args.concat(["--without", "future"]) + end end else - sh "bundle install #{bundle_args} --without base future" + if bundler_too_new? + sh "bundle config set --local without 'base future'" + else + bundle_args.concat(["--without", "base", "future"]) + end end + sh "bundle install #{bundle_args.join(' ')} #{ENV['BUNDLE_ARGS']}" if boolean_option('NODE_MODULES', default) sh "npm install #{npm_args}" end end -def bundler_too_old? +def bundler_version `bundle --version` =~ /version (.+)/ - version = $1.split('.').map { |x| x.to_i } - version[0] < 1 || version[0] == 1 && version[1] < 10 + Gem::Version.new($1) +end + +def bundler_too_old? + Gem::Version.new(bundler_version) < Gem::Version.new("1.1.10") +end + +def bundler_too_new? + Gem::Version.new(bundler_version) >= Gem::Version.new("2.1.0") end