23 lines
496 B
Ruby
Raw Normal View History

2020-10-10 14:16:11 +02:00
# typed: true
# frozen_string_literal: true
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
def link(command: nil, **options)
2024-03-07 16:20:20 +00:00
super(command:, **options)
return if source.executable?
2018-09-17 02:45:00 +02:00
if source.writable?
FileUtils.chmod "+x", source
else
command.run!("/bin/chmod", args: ["+x", source], sudo: true)
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