summaryrefslogtreecommitdiff
path: root/tasks
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2017-03-10 19:27:31 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2017-03-10 19:34:18 -0800
commit6e2c8f9e0738fc9654709feba70664f6359ec750 (patch)
tree0b389bb6f183d667d8849a4dd462aa0cf3473aa3 /tasks
parent12c54fbf916fcd4cd80cab3f3598a03da7d96fd1 (diff)
downloadchef-6e2c8f9e0738fc9654709feba70664f6359ec750.tar.gz
simplify dependency bumping rake tasks and bump all deps
this eliminates all the "run gem pristine" warning spam and i believe uses "bundle lock" correctly. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'tasks')
-rw-r--r--tasks/dependencies.rb81
1 files changed, 34 insertions, 47 deletions
diff --git a/tasks/dependencies.rb b/tasks/dependencies.rb
index b37c351d12..6b836b747e 100644
--- a/tasks/dependencies.rb
+++ b/tasks/dependencies.rb
@@ -1,5 +1,5 @@
#
-# Copyright:: Copyright (c) 2016 Chef Software Inc.
+# Copyright:: Copyright (c) 2016-2017, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -44,66 +44,53 @@ 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
}
- desc "Update Gemfile.lock and all Gemfile.<platform>.locks."
- task :update_gemfile_lock do |t, rake_args|
- Rake::Task["bundle:update"].invoke
+ 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
end
- 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
+ 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"
end
end
end
end
- 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
+ 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"
end
end
end
end
- 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
- }
+ 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"
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|