Wrong default language in formula

(Artemios) #1

Hello, I’m personally mocking around with my own formulas in a tap. I’ve set up this one for photoshop CC:

cask 'adobe-photoshop-cc' do
  version '16.0'
  sha256 'c5a30a102299215b7df7e0cc519d3d63c20a63b0fecf54bc41eb68061c96dec7'

  language 'en', default: true do

  language 'de' do

  url "https://trials3.adobe.com/AdobeProducts/PHSP/#{version.major}/osx10/Photoshop_#{version.major}_LS20.dmg",
      user_agent: :fake,
      cookies:    { 'MM_TRIALS' => '1234' }

  name 'Adobe Photoshop CC 2015'

  homepage 'https://www.adobe.com/products/photoshop.html'

  conflicts_with cask: 'adobe-photoshop-cc'

  installer script: {
                      executable: "#{staged_path}/Adobe Photoshop CC 2015/Install.app/Contents/MacOS/Install",
                      args:       ['--mode=silent', "--deploymentFile=#{staged_path}/Adobe\ Photoshop\ CC\ 2015/Deployment/#{language}_Deployment.xml"],
                      sudo:       true,

  # Preparing uninstall XML
  uninstall_preflight do
    uninstall_filepath = "#{staged_path}/Adobe\ Photoshop\ CC\ 2015/Deployment"

    uninstall_file = File.open("#{uninstall_filepath}/#{language}_Uninstall.xml", File::WRONLY | File::TRUNC | File::CREAT)
    uninstall_file.write(File.read("#{uninstall_filepath}/#{language}_Deployment.xml").gsub(%r{install}, 'remove'))

  uninstall script: {
                      executable: "#{staged_path}/Adobe Photoshop CC 2015/Install.app/Contents/MacOS/Install",
                      args:       ['--mode=silent', "--deploymentFile=#{staged_path}/Adobe\ Photoshop\ CC\ 2015/Deployment/#{language}_Uninstall.xml"],
                      sudo:       true,


So the way I understand it, if I do brew cask install adobe-photoshop-cc it should default to English language. But it defaults to German language. If I do brew install adobe-photoshop-cc --language=en it changes to English.

It basically comes down to #{language}_Deployment.xml it language is set to en_US it will install with the English XML-file. Vice versa de_DE for German. The logic itself in the installer/uninstall part is correct. But it sets the language variable wrong. It defaults to de_DE if I don’t set it manually.

What am I doing wrong? Thanks in advance.

(Sean Molenaar) #2

This seems more like a ruby question than homebrew per se, but maybe @MikeMcQuaid knows

(Mike McQuaid) #3

I’m not sure, sorry.

(Artemios) #4

Hmm, too bad. I also tried altering the German block like so

language 'de', default: false do

with no luck.

(Brian Morton) #5

Try looking at some casks which already work (such as libreoffice-language-pack.rb):

  language 'en-GB', default: true do
    sha256 '0a9d7a30c15c06f4cea83ed5ae82bf842892d3853c6e5ffa0ad1523305fe02a4'
  language 'de' do
    sha256 'bc22a18c10f92d2ff3b23e04a9cc90c0631fcb9b9b48792c753422ab4feb62da'

Specifically try just 'de' instead of 'de_DE' maybe?

(Artemios) #6

Hey, thanks for your answer.

I already looked at other casks. In my case, the hash doesn’t differ with the language. For photoshop, there are a dozen or so XML-files, one for each language. So I need to pick the right one for each language (they differ by name).

The way I understood the documentation, if I do

language 'de' do

then de_DE is the string that gets returned if I call the variable like so #{language}. In fact, this IS how it works. Otherwise it wouldn’t work if I try to install a language with the --language= argument. But it does. And I use the #{language} in the file path.

args: ['--mode=silent', "--deploymentFile=#{staged_path}/Adobe\ Photoshop\ CC\ 2015/Deployment/#{language}_Deployment.xml"],

and the XML file for German language is called de_DE_Deployment.xml. So I need to return de_DE.

Again, specifying an optional language is working. However, setting the default one (default: true) is not.