README.md in munge-0.2.0 vs README.md in munge-0.3.0

- old
+ new

@@ -9,10 +9,24 @@ SemVer will be followed once 1.0.0 is released. Until then, the API should be considered experimental. +## Features + +- No metaprogramming +- Suitable for large, complex sites (e.g., multiple blogs with different templates, a single blog with multiple data sources) +- Concise rule definition +- Rules defined by iterating through arrays and modifying objects + + +## Caveats + +- Not optimized (Pull requests welcome, gradual optimizations preferred) +- Rules can seem pretty dense (because of its conciseness) + + ## Installation Add this line to your application's Gemfile: ```ruby @@ -30,13 +44,16 @@ ## Usage After installing your gem, you can start a project using the command line client. +```bash +munge init path/to/project # create a barebones project +cd path/to/project +munge build # compiles your project +munge view # open http://localhost:3000/ to see output ``` -munge init path/to/project -``` The three main files of your application are `config.yml`, `data.yml`, and `rules.rb`. Here's an example `rules.rb` for a blog. @@ -49,19 +66,19 @@ .each { |item| item[:title] = "home" } # sets additional frontmatter variables .each { |item| item.transform(:tilt) } # have Tilt compile this file # blog posts app.source - .select { |item| item.relpath =~ %r(^posts/) } # looks for items in "src/posts/**/*" + .select { |item| item.relpath?("posts") } # looks for items in "src/posts/**/*" .each { |item| item.route = "blog/#{item.basename}" } # sets output file to "/blog/#{basename}/index.html" .each { |item| item.layout = "post" } .each { |item| item.transform } # sets transform to Tilt (default) # blog index posts_for_index = app.source - .find_all { |item| item.route =~ %r(^blog/) } - .sort_by { |item| item.route } + .select { |item| item.route?("blog") } + .sort_by { |item| item.route } .reverse app.create("blog/index.html.erb", "", posts: posts_for_index) do |item| item.route = "blog" # sets output file to "/blog/index.html" item.layout = "list"