mirror of
https://github.com/donl/homebrew-cask-versions.git
synced 2026-07-16 22:06:43 -06:00
* convert existing Cask:: namespace to Hbc:: * move Homebrew-fork code under Hbc:: * move freestanding classes such as Tty and TopologicalHash under Hbc:: * recast HOMEBREW_CASK_ constants as HBC_ * modify our Homebrew Formula for backward compatibility * devscripts and dev docs
24 lines
649 B
Ruby
24 lines
649 B
Ruby
class Hbc::Artifact::Hardlinked < Hbc::Artifact::Symlinked
|
|
def self.islink?(path)
|
|
return false unless path.respond_to?(:stat)
|
|
path.stat.nlink > 1
|
|
end
|
|
|
|
def self.link_type_english_name
|
|
'Hardlink'
|
|
end
|
|
|
|
def create_filesystem_link(source, target)
|
|
Pathname.new(target).dirname.mkpath
|
|
@command.run!('/bin/ln', :args => ['-hf', '--', source, target])
|
|
add_altname_metadata source, target
|
|
end
|
|
|
|
def summarize_one_link(artifact_spec)
|
|
load_specification artifact_spec
|
|
if self.class.islink?(target)
|
|
printable_target = "'#{target}'"
|
|
printable_target.sub!(%r{^'#{ENV['HOME']}/*}, %q{~/'})
|
|
end
|
|
end
|
|
end
|