No commit activity in last 3 years
No release in over 3 years
A simple script that generates html and text views from .mail_view files.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.12
~> 10.0
 Project Readme

MailViewProcessor

Mail view files are files that combine html and text views together so that two views can be maintained together.

Here's a simple partial that's used to generate a list of events, using links in the html version with just text in the text version.

app/mail_views/mailman/_event.mail_view

> html.haml
  %li
    = link_to("#{event.event_on.to_s(:micro)} #{event.subject}", message_url(event))
> text.erb
  --- * <%= event.event_on.to_s(:micro) %> <%= event.subject %>

MailViewProcessor is a simple gem that provides a script that spits app/mail_view/*.mail_view files into appropriate app/view files.

The example above would generate these files:

app/views/mailman/_event.html.haml

-# AUTO GENERATED FILE / DO NOT EDIT (instead, edit /app/mail_views/_event.mail_view)
%li
  = link_to("#{event.event_on.to_s(:micro)} #{event.subject}", message_url(event))

app/views/mailman/_event.text.erb

<%# AUTO GENERATED FILE / DO NOT EDIT (instead, edit /app/mail_views/_event.mail_view) -%>
--- * <%= event.event_on.to_s(:micro) %> <%= event.subject %>

Installation

Add this line to your application's Gemfile:

gem 'mail_view_processor'

And then execute:

$ bundle

Or install it yourself as:

$ gem install mail_view_processor

Usage

$ mail_view_processor

Development

There are no dependencies. Just check out the repo and make your changes.

I'm embarassed to say, but there are no tests.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/kellyfelkins/mail_view_processor.

License

The gem is available as open source under the terms of the MIT License.