2024-08-12 10:30:59 +01:00
|
|
|
# typed: true # rubocop:todo Sorbet/StrictSigil
|
2019-04-19 15:38:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-09-03 19:39:07 +01:00
|
|
|
require "cask/artifact/symlinked"
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2018-09-06 08:29:14 +02:00
|
|
|
module Cask
|
2016-09-24 13:52:43 +02:00
|
|
|
module Artifact
|
2020-08-19 10:23:41 +02:00
|
|
|
# Artifact corresponding to the `binary` stanza.
|
2016-09-24 13:52:43 +02:00
|
|
|
class Binary < Symlinked
|
2017-04-06 00:33:31 +02:00
|
|
|
def link(command: nil, **options)
|
2024-05-23 17:08:41 +01:00
|
|
|
super
|
2017-04-20 14:38:16 +10:00
|
|
|
return if source.executable?
|
2018-09-17 02:45:00 +02:00
|
|
|
|
2017-04-20 14:38:16 +10:00
|
|
|
if source.writable?
|
|
|
|
FileUtils.chmod "+x", source
|
|
|
|
else
|
2017-04-06 00:33:31 +02:00
|
|
|
command.run!("/bin/chmod", args: ["+x", source], sudo: true)
|
2017-04-20 14:38:16 +10:00
|
|
|
end
|
2017-03-08 16:35:02 +01:00
|
|
|
end
|
2016-09-24 13:52:43 +02:00
|
|
|
end
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
end
|