lib/jazzy/config.rb in jazzy-0.7.4 vs lib/jazzy/config.rb in jazzy-0.7.5

- old
+ new

@@ -293,12 +293,15 @@ description: "Which theme to use. Specify either 'apple' (default), "\ "'fullwidth' or the path to your mustache templates and " \ 'other assets for a custom theme.', default: 'apple', parse: ->(t) do - return expand_path(t) unless t == 'apple' || t == 'fullwidth' - Pathname(__FILE__).parent + 'themes' + t + if t == 'apple' || t == 'fullwidth' + Pathname(__FILE__).parent + 'themes' + t + else + expand_path(t) + end end config_attr :use_safe_filenames, command_line: '--use-safe-filenames', description: 'Replace unsafe characters in filenames with an encoded '\ @@ -426,10 +429,17 @@ end def read_config_file(file) case File.extname(file) when '.json' then JSON.parse(File.read(file)) - when '.yaml', '.yml' then YAML.safe_load(File.read(file)) + when '.yaml', '.yml' then + if YAML.respond_to?('safe_load') # ruby >= 2.1.0 + YAML.safe_load(File.read(file)) + else + # rubocop:disable Security/YAMLLoad + YAML.load(File.read(file)) + # rubocop:enable Security/YAMLLoad + end else raise "Config file must be .yaml or .json, but got #{file.inspect}" end end def print_config_file_help