hyouki 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in hyouki.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Russ Smith
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,37 @@
1
+ # Hyouki
2
+
3
+ A better way to view and design emails.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'hyouki'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install hyouki
18
+
19
+ Mount the engine at a url
20
+
21
+ mount Hyouki::Engine => 'hyouki' if Rails.env == 'development'
22
+
23
+ ## Usage
24
+
25
+ Visit a url with the class of your Mailer and the method you wish to view.
26
+
27
+ http://localhost:3000/hyouki/devise::mailer/confirmation_instructions?args=user.first
28
+
29
+ http://localhost:3000/hyouki/notifier/match_found?args=Group.first,Group.last
30
+
31
+ ## Contributing
32
+
33
+ 1. Fork it
34
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
35
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
36
+ 4. Push to the branch (`git push origin my-new-feature`)
37
+ 5. Create new Pull Request
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,19 @@
1
+ class HyoukiController < ApplicationController
2
+ layout false
3
+
4
+ def show
5
+ klass = params[:class].classify.gsub(/::(\w)/) { |s| s.upcase }.constantize
6
+ args = params[:args].split(',').collect { |a| eval(a) }
7
+ @mail = klass.send(params[:method], *args)
8
+
9
+ @type = params[:type] || 'plain'
10
+
11
+ @body = if @mail.multipart?
12
+ @mail.parts.select { |part|
13
+ part.content_type =~ /#{@type}/
14
+ }.first.body.to_s
15
+ else
16
+ @mail.body.to_s
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,79 @@
1
+ <style type="text/css">
2
+ #message_headers {
3
+ position: absolute;
4
+ top: 0px;
5
+ left: 0;
6
+ width: 100%;
7
+ height: 65px;
8
+ padding: 10px 0 0 0;
9
+ margin: 0;
10
+ background: #fff;
11
+ font-size: 12px;
12
+ font-family: "Lucida Grande";
13
+ border-bottom: 1px solid #dedede;
14
+ overflow: hidden;
15
+ }
16
+
17
+ #message_headers dl {
18
+ margin: 0;
19
+ padding: 0;
20
+ }
21
+
22
+ #message_headers dt {
23
+ width: 60px;
24
+ padding: 1px;
25
+ float: left;
26
+ text-align: right;
27
+ font-weight: bold;
28
+ color: #7f7f7f;
29
+ }
30
+
31
+ #message_headers dd {
32
+ margin-left: 70px;
33
+ padding: 1px;
34
+ }
35
+
36
+ #message_headers p.alternate {
37
+ position: absolute;
38
+ top: 0;
39
+ right: 15px;
40
+ }
41
+
42
+ #message_headers p.alternate a {
43
+ color: #09c;
44
+ }
45
+
46
+ pre#message_body {
47
+ padding: 10px;
48
+ word-wrap: break-word;
49
+ }
50
+
51
+ body {
52
+ margin-top: 120px !important;
53
+ }
54
+ </style>
55
+
56
+ <div id="message_headers">
57
+ <dl>
58
+ <dt>From:</dt>
59
+ <dd><%= @mail.from.join(', ') %></dd>
60
+
61
+ <dt>Subject:</dt>
62
+ <dd><strong><%= @mail.subject %></strong></dd>
63
+
64
+ <dt>To:</dt>
65
+ <dd><%= @mail.to.join(', ') %></dd>
66
+ </dl>
67
+
68
+ <% if @mail.multipart? %>
69
+ <p class="alternate">
70
+ <% if @type == 'plain' %>
71
+ <a href="?args=<%= params[:args] %>&type=html">View HTML version</a>
72
+ <% else %>
73
+ <a href="?args=<%= params[:args] %>&type=plain">View plain text version</a>
74
+ <% end %>
75
+ </p>
76
+ <% end %>
77
+ </div>
78
+
79
+ <%= @body.html_safe %>
@@ -0,0 +1,3 @@
1
+ Hyouki::Engine.routes.draw do
2
+ get ':class/:method', to: 'hyouki#show'
3
+ end
@@ -0,0 +1,17 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/hyouki/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Russ Smith"]
6
+ gem.email = ["russ@bashme.org"]
7
+ gem.description = %q{A better way to view and design emails.}
8
+ gem.summary = %q{A better way to view and design emails.}
9
+ gem.homepage = ""
10
+
11
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.name = "hyouki"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Hyouki::VERSION
17
+ end
@@ -0,0 +1,7 @@
1
+ require 'hyouki/version'
2
+
3
+ module Hyouki
4
+ class Engine < Rails::Engine
5
+ isolate_namespace Hyouki
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ module Hyouki
2
+ VERSION = '0.0.1'
3
+ end
metadata ADDED
@@ -0,0 +1,57 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hyouki
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Russ Smith
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-18 00:00:00.000000000Z
13
+ dependencies: []
14
+ description: A better way to view and design emails.
15
+ email:
16
+ - russ@bashme.org
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - .gitignore
22
+ - Gemfile
23
+ - LICENSE
24
+ - README.md
25
+ - Rakefile
26
+ - app/controllers/hyouki_controller.rb
27
+ - app/views/hyouki/show.html.erb
28
+ - config/routes.rb
29
+ - hyouki.gemspec
30
+ - lib/hyouki.rb
31
+ - lib/hyouki/version.rb
32
+ homepage: ''
33
+ licenses: []
34
+ post_install_message:
35
+ rdoc_options: []
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ required_rubygems_version: !ruby/object:Gem::Requirement
45
+ none: false
46
+ requirements:
47
+ - - ! '>='
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ requirements: []
51
+ rubyforge_project:
52
+ rubygems_version: 1.8.10
53
+ signing_key:
54
+ specification_version: 3
55
+ summary: A better way to view and design emails.
56
+ test_files: []
57
+ has_rdoc: