Feature: Data Sources In order to use external data in my blog As a blog's user I want to use data sources in my site Scenario: Use JSON data source Given I have a "_config.yml" file with content: """ data_sources: - name: jsonip url: 'http://jsonip.com/' type: json """ And I have an "index.html" page that contains "{{ site.jsonip.ip }}" When I run monad Then the "_site/index.html" file should exist And I should see "\d+\.\d+\.\d+\.\d+" in "_site/index.html" Scenario: Use YAML data source Given I have a "_config.yml" file with content: """ data_sources: - name: languages path: _data/languages.yaml type: yaml """ And I have an "index.html" page that contains "{% for language in site.languages %}{{language}}{% endfor %}" And I have a _data directory And I have a "_data/languages.yaml" file that contains "[java, ruby]" When I run monad Then the "_site/index.html" file should exist And I should see "java" in "_site/index.html" And I should see "ruby" in "_site/index.html" Scenario: Support custom data source driver Given I have a "_config.yml" file with content: """ data_sources: - name: languages path: _data/languages.json type: json_fs """ And I have a _plugins directory And I have a "_plugins/json_fs_driver.rb" file with content: """ require 'json' module Monad module Drivers class JsonFsDriver def initialize(options) @path = options['path'] end def load JSON.parse(File.read(@path)) end end end end """ And I have a _data directory And I have a "_data/languages.json" file with content: """ ["java", "ruby"] """ And I have an "index.html" page that contains "{% for language in site.languages %}{{language}}{% endfor %}" When I run monad Then the "_site/index.html" file should exist And I should see "java" in "_site/index.html" And I should see "ruby" in "_site/index.html"