aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/artifact/binary.rb
blob: 68f4b074dabb2dc329dd63a13aa9fb2e86cb0976 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require "hbc/artifact/symlinked"

module Hbc
  module Artifact
    class Binary < Symlinked
      def link(command: nil, **options)
        super(command: command, **options)
        return if source.executable?
        if source.writable?
          FileUtils.chmod "+x", source
        else
          command.run!("/bin/chmod", args: ["+x", source], sudo: true)
        end
      end
    end
  end
end