This repository contains multiple projects (each installable as separate gems).
- mustermann: Your personal string matching expert. This is probably what you're looking for.
- mustermann-everything: A meta gem depending on all other official mustermann gems.
- mustermann-fileutils: Efficient file system operations using Mustermann patterns.
- mustermann-strscan: A version of Ruby's StringScanner made for pattern objects.
- mustermann-visualizer: Syntax highlighting and tree visualization for patterns.
- A selection of pattern types for mustermann, each as their own little library, see below.
You can easily use the latest edge version from GitHub of any of these gems via Bundler:
git 'https://github.com/rkh/mustermann.git' do
gem 'mustermann'
gem 'mustermann-rails'
end
The identity
, regexp
and sinatra
types are included in the mustermann
gem, all the other types have their own gems.
<tr>
<th><a href="mustermann-cake/README.md"><tt>cake</tt></a></th>
<td><tt>/:prefix/**</tt></td>
<td><a href="http://cakephp.org/">CakePHP</a></td>
<td></td>
</tr>
<tr>
<th><a href="mustermann-express/README.md"><tt>express</tt></a></th>
<td><tt>/:prefix+/:id(\d+)</tt></td>
<td>
<a href="http://expressjs.com/">Express</a>,
<a href="https://pillarjs.github.io/">pillar.js</a>
</td>
<td></td>
</tr>
<tr>
<th><a href="mustermann-flask/README.md"><tt>flask</tt></a></th>
<td><tt>/<prefix>/<int:id></tt></td>
<td>
<a href="http://flask.pocoo.org/">Flask</a>,
<a href="http://werkzeug.pocoo.org/">Werkzeug</a>
</td>
<td></td>
</tr>
<tr>
<th><a href="mustermann/README.md#-identity-pattern"><tt>identity</tt></a></th>
<td><tt>/image.png</tt></td>
<td>any software using strings</td>
<td>
Exact string matching (no parameter parsing).
</td>
</tr>
<tr>
<th><a href="mustermann-pyramid/README.md"><tt>pyramid</tt></a></th>
<td><tt>/{prefix:.*}/{id}</tt></td>
<td>
<a href="http://www.pylonsproject.org/projects/pyramid/about">Pyramid</a>,
<a href="http://www.pylonsproject.org/projects/pylons-framework/about">Pylons</a>
</td>
<td></td>
</tr>
<tr>
<th><a href="mustermann-rails/README.md"><tt>rails</tt></a></th>
<td><tt>/:slug(.:ext)</tt></td>
<td>
<a href="http://rubyonrails.org/">Ruby on Rails</a>,
<a href="/rails/journey">Journey</a>,
<a href="/joshbuddy/http_router">HTTP Router</a>,
<a href="http://hanamirb.org">Hanami</a>,
<a href="http://www.scalatra.org/">Scalatra</a> (if <a href="http://www.scalatra.org/2.3/guides/http/routes.html#toc_248">configured</a>),
<a href="/alisnic/nyny">NYNY</a></td>
<td></td>
</tr>
<tr>
<th><a href="mustermann/README.md#-regexp-pattern"><tt>regexp</tt></a></th>
<td><tt>/(?<slug>[^\/]+)</tt></td>
<td>
<a href="http://www.geocities.jp/kosako3/oniguruma/">Oniguruma</a>,
<a href="/k-takata/Onigmo">Onigmo<a>,
regular expressions
</td>
<td>
Created when you pass a regexp to <tt>Mustermann.new</tt>.<br>
Does not support expanding or generating templates.
</td>
</tr>
<tr>
<th><a href="mustermann-shell/README.md"><tt>shell</tt></a></th>
<td><tt>/*.{png,jpg}</tt></td>
<td>Unix Shell (bash, zsh)</td>
<td>Does not support expanding or generating templates.</td>
</tr>
<tr>
<th><a href="mustermann-simple/README.md"><tt>simple</tt></a></th>
<td><tt>/:slug.:ext</tt></td>
<td>
<a href="http://www.sinatrarb.com/">Sinatra</a> (1.x),
<a href="http://www.scalatra.org/">Scalatra</a>,
<a href="http://perldancer.org/">Dancer</a>,
<a href="http://twitter.github.io/finatra/">Finatra</a>,
<a href="http://sparkjava.com/">Spark</a>,
<a href="/rc1/RCRouter">RCRouter</a>,
<a href="/kissjs/kick.js">kick.js</a>
</td>
<td>
Implementation is a direct copy from Sinatra 1.3.<br>
It is the predecessor of <tt>sinatra</tt>.
Does not support expanding or generating templates.
</td>
</tr>
<tr>
<th><a href="mustermann/README.md#-sinatra-pattern"><tt>sinatra</tt></a></th>
<td><tt>/:slug(.:ext)?</tt></td>
<td>
<a href="http://www.sinatrarb.com/">Sinatra</a> (2.x),
<a href="http://padrinorb.com/">Padrino</a> (>= 0.13.0),
<a href="/namusyaka/pendragon">Pendragon</a>,
<a href="/kenichi/angelo">Angelo</a>
</td>
<td>
<u>This is the default</u> and the only type "invented here".<br>
It is a superset of <tt>simple</tt> and has a common subset with
<tt>template</tt> (and others).
</td>
</tr>
<tr>
<th><a href="mustermann-uri-template/README.md"><tt>uri-template</tt></a></th>
<td><tt>/{+pre}/{page}{?q}</tt></td>
<td>
<a href="https://tools.ietf.org/html/rfc6570">RFC 6570</a>,
<a href="http://jsonapi.org/">JSON API</a>,
<a href="http://tools.ietf.org/html/draft-nottingham-json-home-02">JSON Home Documents</a>
and <a href="https://code.google.com/p/uri-templates/wiki/Implementations">many more</a>
</td>
<td>Standardized URI templates, can be <a href="mustermann/README.md#-generating-templates">generated</a> from most other types.</td>
</tr>
Type | Example | Compatible with | Notes |
---|
Any software using Mustermann is obviously compatible with at least one of the above.
Mustermann depends on tool (which has been extracted from Mustermann and Sinatra 2.0), and a Ruby 2.1 compatible Ruby implementation.
It is known to work on MRI 2.1.
JRuby will hopefully be supported with the release of JRuby 9000.
Rubinius is not currently supported. As of Rubinius 2.3.1, a large portion of the specs pass (3870 out of 3943), but certain parts are not working yet.
If you need Ruby 1.9 support, you might be able to use the unofficial mustermann19 gem based on namusyaka's fork.
Mustermann follows Semantic Versioning 2.0. Anything documented in the README or via YARD and not declared private is part of the public API.
There have been no stable releases yet. The code base is considered solid but I only know of a small number of actual production usage. As there has been no stable release yet, the API might still change, though I consider this unlikely.
- Mustermann 0.4.0 (2014-11-26)
- More Infos: RubyGems.org, RubyDoc.info, GitHub.com
- Split into multiple gems.
- Add
Pattern#to_proc
. - Add
Pattern#|
,Pattern#&
andPattern#^
. - Add
Pattern#peek
,Pattern#peek_size
,Pattern#peek_match
andPattern#peek_params
. - Add
Mustermann::StringScanner
. - Add
Pattern#to_templates
. - Add
|
syntax tosinatra
templates. - Add template style placeholders to
sinatra
templates. - Add
cake
,express
,flask
andpyramid
patterns. - Allow passing in additional value behavior directly to
Pattern#expand
. - Fix expanding of multiple splats.
- Add expanding to
identity
patterns. - Add
mustermann-fileutils
. - Make expander accept hashes with string keys.
- Allow named splats to be named splat.
- Support multiple Rails versions.
- Type option can be set to nil to get the default type.
- Add
mustermann-visualizer
.
- Mustermann 0.3.1 (2014-09-12)
- More Infos: RubyGems.org, RubyDoc.info, GitHub.com
- Speed up pattern generation and matching (thanks Daniel Mendler)
- Small change so
Mustermann === Mustermann.new('...')
returnstrue
.
- Mustermann 0.3.0 (2014-08-18)
- More Infos: RubyGems.org, RubyDoc.info, GitHub.com
- Add
regexp
pattern. - Add named splats to Sinatra patterns.
- Add
Mustermann::Mapper
. - Improve duck typing support.
- Improve documentation.
- Mustermann 0.2.0 (2013-08-24)
- More Infos: RubyGems.org, RubyDoc.info, GitHub.com
- Add first class expander objects.
- Add params casting for expander.
- Add simple router and rack router.
- Add weak equality map to significantly improve performance.
- Fix Ruby warnings.
- Improve documentation.
- Refactor pattern validation, AST transformations.
- Increase test coverage (from 100%+ to 100%++).
- Improve JRuby compatibility.
- Work around bug in 2.0.0-p0.
- Mustermann 0.1.0 (2013-05-12)
- More Infos: RubyGems.org, RubyDoc.info, GitHub.com
- Add
Pattern#expand
for generating strings from patterns. - Add better internal API for working with the AST.
- Improved documentation.
- Avoids parsing the path twice when used as Sinatra extension.
- Better exceptions for unknown pattern types.
- Better handling of edge cases around extend.
- More specs to ensure API stability.
- Largely rework internals of Sinatra, Rails and Template patterns.
- Mustermann 0.0.1 (2013-04-27)
- More Infos: RubyGems.org, RubyDoc.info, GitHub.com
- Initial Release.
- Mustermann 0.5.0 (next release with new features)
- Sinatra patterns: Allow | outside of parens.
- Add concatenation support (
Mustermann::Pattern#+
). Mustermann::Sinatra#|
may now generate a Sinatra pattern instead of a real composite.- Add syntax highlighting support for composite patterns.
- Remove routers (they were out of scope for the main gem).
- Rails patterns: Add Rails 5.0 compatibility mode, make it default.
- Improve documentation.
- Mustermann 1.0.0 (before Sinatra 2.0)
- First stable release.