Class: Rails::Hyperdrive::InstallPlan::Entry

Inherits:
Struct
  • Object
show all
Defined in:
lib/rails/hyperdrive/install_plan.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#artifactObject

Returns the value of attribute artifact

Returns:

  • (Object)

    the current value of artifact



9
10
11
# File 'lib/rails/hyperdrive/install_plan.rb', line 9

def artifact
  @artifact
end

#collisionObject

Returns the value of attribute collision

Returns:

  • (Object)

    the current value of collision



9
10
11
# File 'lib/rails/hyperdrive/install_plan.rb', line 9

def collision
  @collision
end

#destObject

Returns the value of attribute dest

Returns:

  • (Object)

    the current value of dest



9
10
11
# File 'lib/rails/hyperdrive/install_plan.rb', line 9

def dest
  @dest
end

#final_nameObject

Returns the value of attribute final_name

Returns:

  • (Object)

    the current value of final_name



9
10
11
# File 'lib/rails/hyperdrive/install_plan.rb', line 9

def final_name
  @final_name
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



9
10
11
# File 'lib/rails/hyperdrive/install_plan.rb', line 9

def type
  @type
end

Instance Method Details

#artifact_kindObject



39
40
41
# File 'lib/rails/hyperdrive/install_plan.rb', line 39

def artifact_kind
  type.to_s
end

#install_ready_bodyObject

The renamed name: is part of the hashed body, so a postfixed artifact hashes to a stable value.



12
13
14
15
16
# File 'lib/rails/hyperdrive/install_plan.rb', line 12

def install_ready_body
  body = BundlerArtifactDiscovery.install_ready_body(artifact)
  return body unless kind&.collision_rewrites_name && final_name != artifact.name
  body.sub(/^name:\s*.+$/, "name: #{final_name}")
end

#kindObject



43
44
45
# File 'lib/rails/hyperdrive/install_plan.rb', line 43

def kind
  InstallLayout.kind(type)
end

#source_gemObject



27
28
29
# File 'lib/rails/hyperdrive/install_plan.rb', line 27

def source_gem
  artifact.source_gem
end

#source_labelObject



35
36
37
# File 'lib/rails/hyperdrive/install_plan.rb', line 35

def source_label
  "#{source_gem}@#{version}"
end

#support_filesObject



18
19
20
21
22
23
24
25
# File 'lib/rails/hyperdrive/install_plan.rb', line 18

def support_files
  return [] unless kind&.dir_shaped?
  dir = File.dirname(dest)
  Array(artifact.support_files).map do |file|
    { path: file[:path], body: file[:body], dest: "#{dir}/#{file[:path]}",
      source_relpath: file[:source_relpath] }
  end
end

#versionObject



31
32
33
# File 'lib/rails/hyperdrive/install_plan.rb', line 31

def version
  artifact.spec_version
end