2017-03-05 19:26:56 +01:00
|
|
|
describe Hbc::CLI, :cask do
|
2016-08-18 22:11:42 +03:00
|
|
|
it "supports setting the appdir" do
|
2017-05-21 02:32:46 +02:00
|
|
|
Hbc::CLI.new.process_options("help", "--appdir=/some/path/foo")
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2017-02-08 13:25:10 +01:00
|
|
|
expect(Hbc.appdir).to eq(Pathname.new("/some/path/foo"))
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
it "supports setting the appdir from ENV" do
|
|
|
|
ENV["HOMEBREW_CASK_OPTS"] = "--appdir=/some/path/bar"
|
|
|
|
|
2017-05-21 02:32:46 +02:00
|
|
|
Hbc::CLI.new.process_options("help")
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2017-02-08 13:25:10 +01:00
|
|
|
expect(Hbc.appdir).to eq(Pathname.new("/some/path/bar"))
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
it "supports setting the prefpanedir" do
|
2017-05-21 02:32:46 +02:00
|
|
|
Hbc::CLI.new.process_options("help", "--prefpanedir=/some/path/foo")
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2017-02-08 13:25:10 +01:00
|
|
|
expect(Hbc.prefpanedir).to eq(Pathname.new("/some/path/foo"))
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
it "supports setting the prefpanedir from ENV" do
|
|
|
|
ENV["HOMEBREW_CASK_OPTS"] = "--prefpanedir=/some/path/bar"
|
|
|
|
|
2017-05-21 02:32:46 +02:00
|
|
|
Hbc::CLI.new.process_options("help")
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2017-02-08 13:25:10 +01:00
|
|
|
expect(Hbc.prefpanedir).to eq(Pathname.new("/some/path/bar"))
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
it "supports setting the qlplugindir" do
|
2017-05-21 02:32:46 +02:00
|
|
|
Hbc::CLI.new.process_options("help", "--qlplugindir=/some/path/foo")
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2017-02-08 13:25:10 +01:00
|
|
|
expect(Hbc.qlplugindir).to eq(Pathname.new("/some/path/foo"))
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
it "supports setting the qlplugindir from ENV" do
|
|
|
|
ENV["HOMEBREW_CASK_OPTS"] = "--qlplugindir=/some/path/bar"
|
|
|
|
|
2017-05-21 02:32:46 +02:00
|
|
|
Hbc::CLI.new.process_options("help")
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2017-02-08 13:25:10 +01:00
|
|
|
expect(Hbc.qlplugindir).to eq(Pathname.new("/some/path/bar"))
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
it "supports setting the colorpickerdir" do
|
2017-05-21 02:32:46 +02:00
|
|
|
Hbc::CLI.new.process_options("help", "--colorpickerdir=/some/path/foo")
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2017-02-08 13:25:10 +01:00
|
|
|
expect(Hbc.colorpickerdir).to eq(Pathname.new("/some/path/foo"))
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
it "supports setting the colorpickerdir from ENV" do
|
|
|
|
ENV["HOMEBREW_CASK_OPTS"] = "--colorpickerdir=/some/path/bar"
|
|
|
|
|
2017-05-21 02:32:46 +02:00
|
|
|
Hbc::CLI.new.process_options("help")
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2017-02-08 13:25:10 +01:00
|
|
|
expect(Hbc.colorpickerdir).to eq(Pathname.new("/some/path/bar"))
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
2016-10-23 17:32:19 +02:00
|
|
|
it "supports setting the dictionarydir" do
|
2017-05-21 02:32:46 +02:00
|
|
|
Hbc::CLI.new.process_options("help", "--dictionarydir=/some/path/foo")
|
2016-10-23 17:32:19 +02:00
|
|
|
|
2017-02-08 13:25:10 +01:00
|
|
|
expect(Hbc.dictionarydir).to eq(Pathname.new("/some/path/foo"))
|
2016-10-23 17:32:19 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it "supports setting the dictionarydir from ENV" do
|
|
|
|
ENV["HOMEBREW_CASK_OPTS"] = "--dictionarydir=/some/path/bar"
|
|
|
|
|
2017-05-21 02:32:46 +02:00
|
|
|
Hbc::CLI.new.process_options("help")
|
2016-10-23 17:32:19 +02:00
|
|
|
|
2017-02-08 13:25:10 +01:00
|
|
|
expect(Hbc.dictionarydir).to eq(Pathname.new("/some/path/bar"))
|
2016-10-23 17:32:19 +02:00
|
|
|
end
|
|
|
|
|
2016-08-18 22:11:42 +03:00
|
|
|
it "supports setting the fontdir" do
|
2017-05-21 02:32:46 +02:00
|
|
|
Hbc::CLI.new.process_options("help", "--fontdir=/some/path/foo")
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2017-02-08 13:25:10 +01:00
|
|
|
expect(Hbc.fontdir).to eq(Pathname.new("/some/path/foo"))
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
it "supports setting the fontdir from ENV" do
|
|
|
|
ENV["HOMEBREW_CASK_OPTS"] = "--fontdir=/some/path/bar"
|
|
|
|
|
2017-05-21 02:32:46 +02:00
|
|
|
Hbc::CLI.new.process_options("help")
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2017-02-08 13:25:10 +01:00
|
|
|
expect(Hbc.fontdir).to eq(Pathname.new("/some/path/bar"))
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
it "supports setting the servicedir" do
|
2017-05-21 02:32:46 +02:00
|
|
|
Hbc::CLI.new.process_options("help", "--servicedir=/some/path/foo")
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2017-02-08 13:25:10 +01:00
|
|
|
expect(Hbc.servicedir).to eq(Pathname.new("/some/path/foo"))
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
it "supports setting the servicedir from ENV" do
|
|
|
|
ENV["HOMEBREW_CASK_OPTS"] = "--servicedir=/some/path/bar"
|
|
|
|
|
2017-05-21 02:32:46 +02:00
|
|
|
Hbc::CLI.new.process_options("help")
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2017-02-08 13:25:10 +01:00
|
|
|
expect(Hbc.servicedir).to eq(Pathname.new("/some/path/bar"))
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
it "allows additional options to be passed through" do
|
2017-05-21 02:32:46 +02:00
|
|
|
rest = Hbc::CLI.new.process_options("edit", "foo", "--create", "--appdir=/some/path/qux")
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2017-02-08 13:25:10 +01:00
|
|
|
expect(Hbc.appdir).to eq(Pathname.new("/some/path/qux"))
|
|
|
|
expect(rest).to eq(%w[edit foo --create])
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "--help" do
|
|
|
|
it "sets the Cask help method to true" do
|
2017-05-21 02:32:46 +02:00
|
|
|
command = Hbc::CLI.new("foo", "--help")
|
|
|
|
expect(command.help?).to be true
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|