diff options
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/artifact/binary.rb | 5 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/artifact/relocated.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/test/cask/artifact/binary_spec.rb | 13 | 
3 files changed, 19 insertions, 1 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/artifact/binary.rb b/Library/Homebrew/cask/lib/hbc/artifact/binary.rb index 9136d6a2a..395ab5c5c 100644 --- a/Library/Homebrew/cask/lib/hbc/artifact/binary.rb +++ b/Library/Homebrew/cask/lib/hbc/artifact/binary.rb @@ -6,6 +6,11 @@ module Hbc        def install_phase          super if CLI.binaries?        end + +      def link(artifact_spec) +        super(artifact_spec) +        FileUtils.chmod "+x", source +      end      end    end  end diff --git a/Library/Homebrew/cask/lib/hbc/artifact/relocated.rb b/Library/Homebrew/cask/lib/hbc/artifact/relocated.rb index aa12dfa4a..bd68ccad0 100644 --- a/Library/Homebrew/cask/lib/hbc/artifact/relocated.rb +++ b/Library/Homebrew/cask/lib/hbc/artifact/relocated.rb @@ -35,7 +35,7 @@ module Hbc          altnames = "(#{altnames})"          # Some packges are shipped as u=rx (e.g. Bitcoin Core) -        @command.run!("/bin/chmod", args: ["--", "u=rwx", file.to_s, file.realpath.to_s]) +        @command.run!("/bin/chmod", args: ["--", "u+rw", file.to_s, file.realpath.to_s])          @command.run!("/usr/bin/xattr",                        args:         ["-w", ALT_NAME_ATTRIBUTE, altnames, file.to_s], diff --git a/Library/Homebrew/test/cask/artifact/binary_spec.rb b/Library/Homebrew/test/cask/artifact/binary_spec.rb index e503a3ebb..69bde3438 100644 --- a/Library/Homebrew/test/cask/artifact/binary_spec.rb +++ b/Library/Homebrew/test/cask/artifact/binary_spec.rb @@ -9,9 +9,11 @@ describe Hbc::Artifact::Binary, :cask do    let(:expected_path) {      Hbc.binarydir.join("binary")    } +    before(:each) do      Hbc.binarydir.mkpath    end +    after(:each) do      FileUtils.rm expected_path if expected_path.exist?    end @@ -24,6 +26,17 @@ describe Hbc::Artifact::Binary, :cask do      expect(expected_path.readlink).to exist    end +  it "makes the binary executable" do +    expect(FileUtils).to receive(:chmod).with("+x", cask.staged_path.join("binary")) + +    shutup do +      Hbc::Artifact::Binary.new(cask).install_phase +    end + +    expect(expected_path).to be_a_symlink +    expect(expected_path.readlink).to be_executable +  end +    it "avoids clobbering an existing binary by linking over it" do      FileUtils.touch expected_path  | 
