diff options
author | John Keiser <john@johnkeiser.com> | 2016-04-17 09:34:29 -0700 |
---|---|---|
committer | John Keiser <john@johnkeiser.com> | 2016-04-18 14:21:02 -0700 |
commit | 01cf3ef2a85d3190b0bd46835ff6ae37f830764a (patch) | |
tree | b15fc1934d56c4449101b10d074b72e26a4884e3 /tasks | |
parent | 31f9ada8660a2831204aca436e343b6a10b103cd (diff) | |
download | chef-01cf3ef2a85d3190b0bd46835ff6ae37f830764a.tar.gz |
Remove Gemfile.windows and put both platforms in Gemfile.lock
Diffstat (limited to 'tasks')
-rw-r--r-- | tasks/bundle.rb | 16 | ||||
-rw-r--r-- | tasks/bundle_util.rb | 6 | ||||
-rw-r--r-- | tasks/dependencies.rb | 8 | ||||
-rw-r--r-- | tasks/gemfile_util.rb | 6 |
4 files changed, 18 insertions, 18 deletions
diff --git a/tasks/bundle.rb b/tasks/bundle.rb index 349f83124c..9de4529d1a 100644 --- a/tasks/bundle.rb +++ b/tasks/bundle.rb @@ -32,13 +32,7 @@ namespace :bundle do puts "-------------------------------------------------------------------" bundle "install #{args}", delete_gemfile_lock: true platforms.each do |platform| - puts "" - puts "-------------------------------------------------------------------" - puts "Updating Gemfile.#{platform}.lock ..." - puts "-------------------------------------------------------------------" - puts "Copy Gemfile.lock to Gemfile.#{platform}.lock ..." - FileUtils.cp(File.join(project_root, "Gemfile.lock"), File.join(project_root, "Gemfile.#{platform}.lock")) - bundle "lock", gemfile: "Gemfile.#{platform}", platform: platform + bundle "lock", platform: platform end end end @@ -54,13 +48,7 @@ namespace :bundle do puts "-------------------------------------------------------------------" bundle "install #{args}" platforms.each do |platform| - puts "" - puts "-------------------------------------------------------------------" - puts "Updating Gemfile.#{platform}.lock (conservatively) ..." - puts "-------------------------------------------------------------------" - puts "Copy Gemfile.lock to Gemfile.#{platform}.lock ..." - FileUtils.cp(File.join(project_root, "Gemfile.lock"), File.join(project_root, "Gemfile.#{platform}.lock")) - bundle "lock", gemfile: "Gemfile.#{platform}", platform: platform + bundle "lock", platform: platform end end end diff --git a/tasks/bundle_util.rb b/tasks/bundle_util.rb index ee75610cac..c2f1ca51e3 100644 --- a/tasks/bundle_util.rb +++ b/tasks/bundle_util.rb @@ -25,12 +25,12 @@ module BundleUtil result end - def with_bundle_unfrozen - bundle "config --delete frozen" + def with_bundle_unfrozen(cwd: nil) + bundle "config --delete frozen", cwd: cwd begin yield ensure - bundle "config --local frozen 1" + bundle "config --local frozen 1", cwd: cwd end end diff --git a/tasks/dependencies.rb b/tasks/dependencies.rb index 35cbe2800e..d383ee4433 100644 --- a/tasks/dependencies.rb +++ b/tasks/dependencies.rb @@ -52,7 +52,13 @@ namespace :dependencies do puts "-------------------------------------------------------------------" puts "Updating #{dir}/Gemfile.lock#{conservative ? " (conservatively)" : ""} ..." puts "-------------------------------------------------------------------" - bundle "install", cwd: dir, delete_gemfile_lock: !conservative + with_bundle_unfrozen(cwd: dir) do + bundle "install", cwd: dir, delete_gemfile_lock: !conservative + # 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 diff --git a/tasks/gemfile_util.rb b/tasks/gemfile_util.rb index 62d8cfdf0b..e21299705a 100644 --- a/tasks/gemfile_util.rb +++ b/tasks/gemfile_util.rb @@ -292,6 +292,8 @@ module GemfileUtil # Never include bundler, it can't be bundled and doesn't put itself in # the lockfile correctly anyway next if spec.name == "bundler" + # Only the platform-specific locks for now (TODO make it possible to emit all locks) + next if spec.platform && spec.platform != Gem::Platform::RUBY lock = lock_source_metadata(spec) lock[:version] = spec.version.to_s runtime = spec.dependencies.select { |dep| dep.type == :runtime } @@ -304,6 +306,10 @@ module GemfileUtil # Transitivize the deps. locks.each do |name, lock| + # Not all deps were brought over (platform-specific ones) so weed them out + lock[:dependencies] &= locks.keys + lock[:development_dependencies] &= locks.keys + lock[:dependencies] = transitive_dependencies(locks, name, :dependencies) lock[:development_dependencies] = transitive_dependencies(locks, name, :development_dependencies) end |