Module: Rails::Hyperdrive::InstallPlan
- Defined in:
- lib/rails/hyperdrive/install_plan.rb
Overview
A name shipped by one source installs at its canonical path; a name shipped by several installs every variant, postfixed --<source_gem>.
Defined Under Namespace
Class Method Summary collapse
-
.build(artifacts, lock: nil) ⇒ Object
A collision installs under a postfixed name, so the shipped name disables every variant and a postfixed name disables just one.
-
.disabled_dest?(lock, type, dest) ⇒ Boolean
A supporting file is disabled through its owning skill's name.
Class Method Details
.build(artifacts, lock: nil) ⇒ Object
A collision installs under a postfixed name, so the shipped name disables every variant and a postfixed name disables just one.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/rails/hyperdrive/install_plan.rb', line 49 def build(artifacts, lock: nil) result = Result.new(entries: [], disabled: []) artifacts.group_by { |a| [a.artifact_type, a.name] }.each do |(type, name), group| collision = group.size > 1 group.each do |artifact| final_name = collision ? InstallLayout.postfixed_name(name, artifact.source_gem) : name entry = Entry.new( type: type, artifact: artifact, final_name: final_name, dest: InstallLayout.dest_for(type, final_name), collision: collision ) dropped = lock && (lock.disabled?(type, name) || (collision && lock.disabled?(type, final_name))) (dropped ? result.disabled : result.entries) << entry end end result end |
.disabled_dest?(lock, type, dest) ⇒ Boolean
A supporting file is disabled through its owning skill's name.
70 71 72 73 74 75 |
# File 'lib/rails/hyperdrive/install_plan.rb', line 70 def disabled_dest?(lock, type, dest) name = InstallLayout.installed_name(type, dest) return false unless name lookup = type == :skill_support ? :skill : type lock.disabled?(lookup, name) || lock.disabled?(lookup, InstallLayout.base_name(name)) end |