Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make MacOS.language less opinionated and add language stanza. #906

Merged
merged 15 commits into from
Oct 3, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Stub MacOS.languages instead of setting HOMEBREW_LANGUAGES.
  • Loading branch information
reitermarkus committed Oct 3, 2016
commit b703c81ca6640ee2ff3d0489462c672a2aa18c0f
10 changes: 3 additions & 7 deletions Library/Homebrew/cask/test/cask/dsl_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@
end

describe "language stanza" do
after(:each) do
ENV["HOMEBREW_LANGUAGES"] = nil
end

it "allows multilingual casks" do
cask = lambda {
Hbc::Cask.new("cask-with-apps") do
Expand All @@ -144,13 +140,13 @@
end
}

ENV["HOMEBREW_LANGUAGES"] = "FIRST_LANGUAGE"
MacOS.stubs(languages: ["FIRST_LANGUAGE"])
cask.call.language.must_equal :first

ENV["HOMEBREW_LANGUAGES"] = "SECOND_LANGUAGE"
MacOS.stubs(languages: ["SECOND_LANGUAGE"])
cask.call.language.must_equal :second

ENV["HOMEBREW_LANGUAGES"] = "THIRD_LANGUAGE"
MacOS.stubs(languages: ["THIRD_LANGUAGE"])
cask.call.language.must_equal :default
end
end
Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/os/mac.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ def cat
end

def languages
if ENV["HOMEBREW_LANGUAGES"]
@languages ||= if ENV["HOMEBREW_LANGUAGES"]
ENV["HOMEBREW_LANGUAGES"].split(",")
else
@languages ||= Utils.popen_read("defaults", "read", ".GlobalPreferences", "AppleLanguages").scan(/[^ \n"(),]+/)
Utils.popen_read("defaults", "read", ".GlobalPreferences", "AppleLanguages").scan(/[^ \n"(),]+/)
end
end

Expand Down