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
add available languages to cask info command #3220
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,6 +90,38 @@ | |
EOS | ||
end | ||
|
||
it "should print languages if the Cask provided any" do | ||
expect { | ||
Hbc::CLI::Info.run("with-languages") | ||
}.to output(<<-EOS.undent).to_stdout | ||
with-languages: 1.2.3 | ||
http://example.com/local-caffeine | ||
Not installed | ||
From: https://github.com/caskroom/homebrew-spec/blob/master/Casks/with-languages.rb | ||
==> Name | ||
None | ||
==> Languages | ||
zh, en-US | ||
==> Artifacts | ||
Caffeine.app (App) | ||
EOS | ||
end | ||
|
||
it 'should not print "Languages" section divider if the languages block has no output' do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does not print |
||
expect { | ||
Hbc::CLI::Info.run("with-conditional-languages") | ||
}.to output(<<-EOS.undent).to_stdout | ||
with-conditional-languages: 1.2.3 | ||
http://example.com/local-caffeine | ||
Not installed | ||
From: https://github.com/caskroom/homebrew-spec/blob/master/Casks/with-conditional-languages.rb | ||
==> Name | ||
None | ||
==> Artifacts | ||
Caffeine.app (App) | ||
EOS | ||
end | ||
|
||
describe "when no Cask is specified" do | ||
it "raises an exception" do | ||
expect { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -177,6 +177,36 @@ | |
expect(cask.call.sha256).to eq("xyz789") | ||
expect(cask.call.url.to_s).to eq("https://example.org/en-US.zip") | ||
end | ||
|
||
it "returns empty array if no languages specified" do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. an empty array … are specified |
||
cask = lambda do | ||
Hbc::Cask.new("cask-with-apps") do | ||
url "https://example.org/file.zip" | ||
end | ||
end | ||
|
||
expect(cask.call.languages).to be_empty | ||
end | ||
|
||
it "returns an array of available languages" do | ||
cask = lambda do | ||
Hbc::Cask.new("cask-with-apps") do | ||
language "zh" do | ||
sha256 "abc123" | ||
"zh-CN" | ||
end | ||
|
||
language "en-US", default: true do | ||
sha256 "xyz789" | ||
"en-US" | ||
end | ||
|
||
url "https://example.org/file.zip" | ||
end | ||
end | ||
|
||
expect(cask.call.languages).to eq(["zh", "en-US"]) | ||
end | ||
end | ||
|
||
describe "app stanza" do | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
cask 'with-conditional-languages' do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
version '1.2.3' | ||
sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' | ||
|
||
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" | ||
homepage 'http://example.com/local-caffeine' | ||
|
||
app 'Caffeine.app' | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
cask 'with-languages' do | ||
version '1.2.3' | ||
|
||
language "zh" do | ||
sha256 "abc123" | ||
"zh-CN" | ||
end | ||
|
||
language "en-US", default: true do | ||
sha256 "xyz789" | ||
"en-US" | ||
end | ||
|
||
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" | ||
homepage 'http://example.com/local-caffeine' | ||
|
||
app 'Caffeine.app' | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prints languages specified in the Cask