Upgrade --config to accept an array of files
This commit is contained in:
parent
df1efeff25
commit
1e209c9bf3
|
@ -44,7 +44,7 @@ command :build do |c|
|
|||
c.syntax = 'jekyll build [options]'
|
||||
c.description = 'Build your site'
|
||||
|
||||
c.option '--config [CONFIG_FILE]', 'Custom configuration file'
|
||||
c.option '--config [CONFIG_FILE]', Array, 'Custom configuration file'
|
||||
c.option '--future', 'Publishes posts with a future date'
|
||||
c.option '--limit_posts MAX_POSTS', 'Limits the number of posts to parse and publish'
|
||||
c.option '-w', '--watch', 'Watch for changes and rebuild'
|
||||
|
@ -63,7 +63,7 @@ command :serve do |c|
|
|||
c.syntax = 'jekyll serve [options]'
|
||||
c.description = 'Serve your site locally'
|
||||
|
||||
c.option '--config [CONFIG_FILE]', 'Custom configuration file'
|
||||
c.option '--config [CONFIG_FILE]', Array,'Custom configuration file'
|
||||
c.option '--future', 'Publishes posts with a future date'
|
||||
c.option '--limit_posts MAX_POSTS', 'Limits the number of posts to parse and publish'
|
||||
c.option '-w', '--watch', 'Watch for changes and rebuild'
|
||||
|
|
|
@ -138,8 +138,9 @@ module Jekyll
|
|||
# Get configuration from <source>/_config.yml or <source>/<config_file>
|
||||
config_files = override.delete('config')
|
||||
config_files = File.join(source, "_config.yml") if config_files.to_s.empty?
|
||||
# If config is a list of space separate config files
|
||||
config_files = config_files.split(' ')
|
||||
if not config_files.is_a? Array
|
||||
config_files = [config_files]
|
||||
end
|
||||
|
||||
begin
|
||||
config = {}
|
||||
|
|
|
@ -51,7 +51,7 @@ class TestConfiguration < Test::Unit::TestCase
|
|||
mock(YAML).safe_load_file(@paths[:other]) { Hash.new }
|
||||
mock($stdout).puts("Configuration file: #{@paths[:default]}")
|
||||
mock($stdout).puts("Configuration file: #{@paths[:other]}")
|
||||
assert_equal Jekyll::DEFAULTS, Jekyll.configuration({ "config" => "#{@paths[:default]} #{@paths[:other]}" })
|
||||
assert_equal Jekyll::DEFAULTS, Jekyll.configuration({ "config" => [@paths[:default], @paths[:other]] })
|
||||
end
|
||||
|
||||
should "load multiple config files and last config should win" do
|
||||
|
@ -59,7 +59,7 @@ class TestConfiguration < Test::Unit::TestCase
|
|||
mock(YAML).safe_load_file(@paths[:other]) { {"baseurl" => "http://wahoo.dev"} }
|
||||
mock($stdout).puts("Configuration file: #{@paths[:default]}")
|
||||
mock($stdout).puts("Configuration file: #{@paths[:other]}")
|
||||
assert_equal Jekyll::DEFAULTS.deep_merge({ "baseurl" => "http://wahoo.dev" }), Jekyll.configuration({ "config" => "#{@paths[:default]} #{@paths[:other]}" })
|
||||
assert_equal Jekyll::DEFAULTS.deep_merge({ "baseurl" => "http://wahoo.dev" }), Jekyll.configuration({ "config" => [@paths[:default], @paths[:other]] })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue