Add show_dir_listing option for serve command

This commit is contained in:
Henry Goodman 2016-02-17 00:29:57 -08:00
parent f0b8db0d72
commit d387fd0baa
3 changed files with 10 additions and 0 deletions

View File

@ -10,6 +10,8 @@ module Jekyll
"ssl_key" => ["--ssl-key [KEY]", "X.509 (SSL) Private Key."],
"port" => ["-P", "--port [PORT]", "Port to listen on"],
"baseurl" => ["-b", "--baseurl [URL]", "Base URL"],
"show_dir_listing" => ["--show-dir-listing",
"Show a directory listing instead of loading your index file."],
"skip_initial_build" => ["skip_initial_build", "--skip-initial-build",
"Skips the initial site build which occurs before the server is started."]
}
@ -91,6 +93,8 @@ module Jekyll
)
}
opts[:DirectoryIndex] = [] if opts[:JekyllOptions]['show_dir_listing']
enable_ssl(opts)
enable_logging(opts)
opts

View File

@ -44,6 +44,7 @@ module Jekyll
'port' => '4000',
'host' => '127.0.0.1',
'baseurl' => '',
'show_dir_listing' => false,
# Output Configuration
'permalink' => 'date',

View File

@ -68,6 +68,11 @@ class TestCommandsServe < JekyllUnitTest
]
end
should "use empty directory index list when show_dir_listing is true" do
opts = { "show_dir_listing" => true }
assert custom_opts(opts)[:DirectoryIndex].empty?
end
context "verbose" do
should "debug when verbose" do
assert_equal custom_opts({ "verbose" => true })[:Logger].level, 5