diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2017-03-10 19:33:47 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2017-03-10 19:33:47 -0800 |
commit | 12c54fbf916fcd4cd80cab3f3598a03da7d96fd1 (patch) | |
tree | 4a7510b35c9634fe189f5fef41beaaf55a2b3a79 /tasks/dependencies.rb | |
parent | 6628f708acdefe2fc6bff85a1edade89f0b4d8ee (diff) | |
download | chef-12c54fbf916fcd4cd80cab3f3598a03da7d96fd1.tar.gz |
Revert "simplify dependency bumping rake tasks and bump all deps"
This reverts commit 6628f708acdefe2fc6bff85a1edade89f0b4d8ee.
oops.
Diffstat (limited to 'tasks/dependencies.rb')
-rw-r--r-- | tasks/dependencies.rb | 81 |
1 files changed, 47 insertions, 34 deletions
diff --git a/tasks/dependencies.rb b/tasks/dependencies.rb index 6b836b747e..b37c351d12 100644 --- a/tasks/dependencies.rb +++ b/tasks/dependencies.rb @@ -1,5 +1,5 @@ # -# Copyright:: Copyright (c) 2016-2017, Chef Software Inc. +# Copyright:: Copyright (c) 2016 Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -44,53 +44,66 @@ namespace :dependencies do dependencies:update_acceptance_gemfile_lock dependencies:update_kitchen_tests_gemfile_lock dependencies:update_kitchen_tests_berksfile_lock - dependencies:update_audit_tests_berksfile_lock } - def bundle_update_locked_multiplatform_task(task_name, dir) - desc "Update #{dir}/Gemfile.lock." - task task_name do - Dir.chdir(dir) do - Bundler.with_clean_env do - sh "bundle config --local frozen '0'" - sh "bundle lock --update --add-platform ruby" - sh "bundle lock --update --add-platform x86-mingw32" - sh "bundle config --local frozen '1'" - end - end - end + desc "Update Gemfile.lock and all Gemfile.<platform>.locks." + task :update_gemfile_lock do |t, rake_args| + Rake::Task["bundle:update"].invoke end - def bundle_update_task(task_name, dir) - desc "Update #{dir}/Gemfile.lock." - task task_name do - Dir.chdir(dir) do - Bundler.with_clean_env do - sh "bundle update" + def gemfile_lock_task(task_name, dirs: [], other_platforms: true, leave_frozen: true) + dirs.each do |dir| + desc "Update #{dir}/Gemfile.lock." + task task_name do |t, rake_args| + extend BundleUtil + puts "" + puts "-------------------------------------------------------------------" + puts "Updating #{dir}/Gemfile.lock ..." + puts "-------------------------------------------------------------------" + with_bundle_unfrozen(cwd: dir, leave_frozen: leave_frozen) do + bundle "install", cwd: dir, delete_gemfile_lock: true + if other_platforms + # Include all other supported platforms into the lockfile as well + platforms.each do |platform| + bundle "lock", cwd: dir, platform: platform + end + end end end end end - def berks_update_task(task_name, dir) - desc "Update #{dir}/Berksfile.lock." - task task_name do - FileUtils.rm_f("#{dir}/Berksfile.lock") - Dir.chdir(dir) do - Bundler.with_clean_env do - sh "bundle exec berks install" + def berksfile_lock_task(task_name, dirs: []) + dirs.each do |dir| + desc "Update #{dir}/Berksfile.lock." + task task_name do |t, rake_args| + extend BundleUtil + puts "" + puts "-------------------------------------------------------------------" + puts "Updating #{dir}/Berksfile.lock ..." + puts "-------------------------------------------------------------------" + if File.exist?("#{project_root}/#{dir}/Berksfile.lock") + File.delete("#{project_root}/#{dir}/Berksfile.lock") + end + Dir.chdir("#{project_root}/#{dir}") do + Bundler.with_clean_env do + sh "bundle exec berks install" + end end end end end - bundle_update_locked_multiplatform_task :update_gemfile_lock, "." - bundle_update_locked_multiplatform_task :update_omnibus_gemfile_lock, "omnibus" - bundle_update_task :update_acceptance_gemfile_lock, "acceptance" - bundle_update_locked_multiplatform_task :update_kitchen_tests_gemfile_lock, "kitchen-tests" - - berks_update_task :update_kitchen_tests_berksfile_lock, "kitchen-tests" - berks_update_task :update_audit_tests_berksfile_lock, "kitchen-tests/cookbooks/audit_test" + gemfile_lock_task :update_omnibus_gemfile_lock, dirs: %w{omnibus} + gemfile_lock_task :update_acceptance_gemfile_lock, dirs: %w{acceptance}, + other_platforms: false, leave_frozen: false + gemfile_lock_task :update_kitchen_tests_gemfile_lock, dirs: %w{ + kitchen-tests + } + berksfile_lock_task :update_kitchen_tests_berksfile_lock, dirs: %w{ + kitchen-tests + kitchen-tests/cookbooks/audit_test + } desc "Update omnibus overrides, including versions in version_policy.rb and latest version of gems: #{OMNIBUS_RUBYGEMS_AT_LATEST_VERSION.keys}." task :update_omnibus_overrides do |t, rake_args| |