Merge branch 'master' of github.com:jekyll/jekyll
* 'master' of github.com:jekyll/jekyll: Replace `File.exists?` with `File.exist?` Remove duplicated range from regex
This commit is contained in:
commit
2185339ee0
|
@ -137,7 +137,7 @@ module Jekyll
|
||||||
config_files = override.delete('config')
|
config_files = override.delete('config')
|
||||||
if config_files.to_s.empty?
|
if config_files.to_s.empty?
|
||||||
default = %w[yml yaml].find(Proc.new { 'yml' }) do |ext|
|
default = %w[yml yaml].find(Proc.new { 'yml' }) do |ext|
|
||||||
File.exists? Jekyll.sanitized_path(source(override), "_config.#{ext}")
|
File.exist?(Jekyll.sanitized_path(source(override), "_config.#{ext}"))
|
||||||
end
|
end
|
||||||
config_files = Jekyll.sanitized_path(source(override), "_config.#{default}")
|
config_files = Jekyll.sanitized_path(source(override), "_config.#{default}")
|
||||||
@default_config_file = true
|
@default_config_file = true
|
||||||
|
|
|
@ -528,7 +528,7 @@ module Jekyll
|
||||||
end
|
end
|
||||||
|
|
||||||
def sanitize_filename(name)
|
def sanitize_filename(name)
|
||||||
name.gsub!(/[^\w\s_-]+/, '')
|
name.gsub!(/[^\w\s-]+/, '')
|
||||||
name.gsub!(/(^|\b\s)\s+($|\s?\b)/, '\\1\\2')
|
name.gsub!(/(^|\b\s)\s+($|\s?\b)/, '\\1\\2')
|
||||||
name.gsub(/\s+/, '_')
|
name.gsub(/\s+/, '_')
|
||||||
end
|
end
|
||||||
|
|
|
@ -42,12 +42,12 @@ class TestConfiguration < JekyllUnitTest
|
||||||
assert_equal [source_dir("_config.yml")], @config.config_files(@no_override)
|
assert_equal [source_dir("_config.yml")], @config.config_files(@no_override)
|
||||||
end
|
end
|
||||||
should "return .yaml if it exists but .yml does not" do
|
should "return .yaml if it exists but .yml does not" do
|
||||||
mock(File).exists?(source_dir("_config.yml")) { false }
|
mock(File).exist?(source_dir("_config.yml")) { false }
|
||||||
mock(File).exists?(source_dir("_config.yaml")) { true }
|
mock(File).exist?(source_dir("_config.yaml")) { true }
|
||||||
assert_equal [source_dir("_config.yaml")], @config.config_files(@no_override)
|
assert_equal [source_dir("_config.yaml")], @config.config_files(@no_override)
|
||||||
end
|
end
|
||||||
should "return .yml if both .yml and .yaml exist" do
|
should "return .yml if both .yml and .yaml exist" do
|
||||||
mock(File).exists?(source_dir("_config.yml")) { true }
|
mock(File).exist?(source_dir("_config.yml")) { true }
|
||||||
assert_equal [source_dir("_config.yml")], @config.config_files(@no_override)
|
assert_equal [source_dir("_config.yml")], @config.config_files(@no_override)
|
||||||
end
|
end
|
||||||
should "return the config if given one config file" do
|
should "return the config if given one config file" do
|
||||||
|
|
|
@ -143,7 +143,7 @@ class TestSite < JekyllUnitTest
|
||||||
|
|
||||||
# simulate destination file deletion
|
# simulate destination file deletion
|
||||||
File.unlink dest
|
File.unlink dest
|
||||||
refute File.exists?(dest)
|
refute File.exist?(dest)
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
@site.process
|
@site.process
|
||||||
|
|
Loading…
Reference in New Issue