inkcite 1.2.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/blueprint.png +0 -0
- data/assets/example/helpers.tsv +37 -0
- data/assets/example/source.html +32 -0
- data/assets/{init → example}/source.txt +0 -0
- data/assets/init/config.yml +42 -4
- data/assets/init/helpers.tsv +12 -26
- data/assets/init/image_optim.yml +37 -0
- data/assets/init/source.html +0 -60
- data/inkcite.gemspec +2 -0
- data/lib/inkcite/cli/base.rb +5 -1
- data/lib/inkcite/cli/build.rb +1 -1
- data/lib/inkcite/cli/init.rb +31 -16
- data/lib/inkcite/cli/server.rb +5 -0
- data/lib/inkcite/cli/test.rb +16 -31
- data/lib/inkcite/email.rb +2 -2
- data/lib/inkcite/minifier.rb +46 -31
- data/lib/inkcite/renderer/button.rb +17 -8
- data/lib/inkcite/renderer/footnote.rb +39 -13
- data/lib/inkcite/renderer/litmus_analytics.rb +79 -0
- data/lib/inkcite/renderer/span.rb +5 -0
- data/lib/inkcite/renderer/table_base.rb +43 -52
- data/lib/inkcite/renderer/td.rb +0 -3
- data/lib/inkcite/renderer.rb +2 -2
- data/lib/inkcite/uploader.rb +4 -0
- data/lib/inkcite/util.rb +4 -0
- data/lib/inkcite/version.rb +1 -1
- data/lib/inkcite/view.rb +50 -8
- data/lib/inkcite.rb +10 -1
- data/test/renderer/span_spec.rb +97 -0
- data/test/renderer/td_spec.rb +10 -10
- metadata +38 -4
- data/lib/inkcite/renderer/litmus.rb +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49c0ee10df003264c9c13457a64286f6f55284c4
|
4
|
+
data.tar.gz: 720db2e0316a425f31b390dc6e493e11af271f1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ecb5788b293ad9fcf75d344a3454cd57309b6f79c93b4ff8555e3c79b234087b75d304a4904afddb368a4fdb27861991ba915918f0c41de6a9610c027e26438
|
7
|
+
data.tar.gz: 67aa5173680fc76cea09588242493282b6a03cbe8b7ad39bdd93766a7f92119af08220dc6a2fef5a2b1b89feeb83334484ba96e96e3d412576ec3eb1ab3421bc
|
Binary file
|
@@ -0,0 +1,37 @@
|
|
1
|
+
// This file helps you keep your email code DRY (don't repeat yourself) by
|
2
|
+
// allowing you to easily define constants and custom tags.
|
3
|
+
//
|
4
|
+
// https://inkcite.readme.io/docs/helpers
|
5
|
+
//
|
6
|
+
// NOTE! The keys and values in this file are TAB-delimited.
|
7
|
+
|
8
|
+
|
9
|
+
// This controls the subject line used for email prevents and text that is
|
10
|
+
// written into the <title> of the HTML created by Inkcite.
|
11
|
+
title Welcome to Inkcite
|
12
|
+
|
13
|
+
// This sets the color for all links generated with Inkcite's {a} helper.
|
14
|
+
#link #000099
|
15
|
+
|
16
|
+
// This defines the default font family used throughout your email.
|
17
|
+
font-family sans-serif
|
18
|
+
|
19
|
+
// Default font styles
|
20
|
+
font-family sans-serif
|
21
|
+
font-size 15
|
22
|
+
line-height 19
|
23
|
+
|
24
|
+
// This custom Helper wraps content in a specially formatted <span></span>
|
25
|
+
// that changes its font family, size, color and applies custom padding.
|
26
|
+
code {span font-family=monospace font-size=16 padding=3 color=#999} {/span}
|
27
|
+
|
28
|
+
// Bullet-proof buttons
|
29
|
+
button-border-radius 5
|
30
|
+
button-float center
|
31
|
+
button-padding 8
|
32
|
+
button-width 175
|
33
|
+
|
34
|
+
// Dimensions
|
35
|
+
width 500
|
36
|
+
|
37
|
+
wrap {table width=100% bgcolor=#fff}{td font-family="{font-family}" align=center} {/td}{/table}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
{wrap}
|
2
|
+
|
3
|
+
{preheader}This preheader will only be visible in supporting clients.{/preheader}
|
4
|
+
|
5
|
+
{table padding=10 width={width} mobile="fill"}
|
6
|
+
{td font=default align=left}
|
7
|
+
|
8
|
+
{img src=logo.jpg height=50 width=200 alt="Company Logo"}<br>
|
9
|
+
|
10
|
+
{img src=billboard.jpg height=180 width={width} mobile="fill"}<br>
|
11
|
+
|
12
|
+
The {code}{img}{/code} Helper automatically uses placehold.it when the specified image is missing from the {code}images/{/code} folder. It also sets the {code}display{/code} attribute of its style to {code}block{/code} and will warn you when you've forgotten to set dimensions. Inkcite's Image Helper is responsive-ready, too - you can set this image to {code}hide{/code}, {code}fill{/code} or show a different image using the {code}mobile-src{/code} property.<br><br>
|
13
|
+
|
14
|
+
{a id="image-docs" href="https://inkcite.readme.io/docs/image"}Learn More{/a}
|
15
|
+
|
16
|
+
{/td}
|
17
|
+
{/table}
|
18
|
+
|
19
|
+
{table padding=10 width={width} float=center mobile="fill"}
|
20
|
+
{td align=left font=small}
|
21
|
+
|
22
|
+
{img src=footer.jpg height=100 width={width} mobile="hide"}<br>
|
23
|
+
|
24
|
+
<% if email? %>
|
25
|
+
This email was sent to [email]. {a id="unsubscribe" href=#}Click here to unsubscribe{/a}.
|
26
|
+
Using ERB, this unsubscribe notice will only appear in the 'email' format of this project.
|
27
|
+
<% end %>
|
28
|
+
|
29
|
+
{/td}
|
30
|
+
{/table}
|
31
|
+
|
32
|
+
{/wrap}
|
File without changes
|
data/assets/init/config.yml
CHANGED
@@ -12,8 +12,9 @@ copy-alt-to-title: false
|
|
12
12
|
# usually be disabled in development to make debugging easier.
|
13
13
|
minify: true
|
14
14
|
|
15
|
-
# When true (recommended), enables image optimization
|
16
|
-
#
|
15
|
+
# When true (recommended), enables automatic image optimization of GIF,
|
16
|
+
# JPG and PNG images used in your email.
|
17
|
+
# https://inkcite.readme.io/v1.0/docs/image-optimization
|
17
18
|
optimize-images: true
|
18
19
|
|
19
20
|
# When empty links are found in content, this is the URL that will be
|
@@ -21,9 +22,26 @@ optimize-images: true
|
|
21
22
|
# and needs to be provided.
|
22
23
|
missing-link-url: 'https://github.com/404'
|
23
24
|
|
25
|
+
# Add Google Fonts (https://www.google.com/fonts) to your emails. Add
|
26
|
+
# the URLs to the family and sizes needed in your email. Then reference
|
27
|
+
# the font family in either source.html:
|
28
|
+
#
|
29
|
+
# {td font-family="'Open Sans Condensed', sans-serif"
|
30
|
+
#
|
31
|
+
# or inside of helpers.tsv:
|
32
|
+
#
|
33
|
+
# default-font-family 'Open Sans Condensed', sans-serif
|
34
|
+
#
|
35
|
+
# https://inkcite.readme.io/docs/fonts#section-google-fonts
|
36
|
+
#
|
37
|
+
#fonts:
|
38
|
+
# - 'https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,700'
|
39
|
+
|
24
40
|
# Inkcite can generate multiple versions of an email from a single source
|
25
41
|
# file which is useful for targeted mailings and a/b testing. Specify a
|
26
42
|
# unique, single-word identifier for each version.
|
43
|
+
# https://dash.readme.io/project/inkcite/v1.0/docs/ab-testing-and-versioning
|
44
|
+
#
|
27
45
|
#versions:
|
28
46
|
# - past_customer
|
29
47
|
# - prospect
|
@@ -31,6 +49,8 @@ missing-link-url: 'https://github.com/404'
|
|
31
49
|
# SMTP settings for sending previews to the small list of internal and client
|
32
50
|
# addresses specified below. Most importantly, specify the address your test
|
33
51
|
# emails will be sent 'from:'
|
52
|
+
# https://dash.readme.io/project/inkcite/v1.0/docs/email-previews
|
53
|
+
#
|
34
54
|
smtp:
|
35
55
|
host: 'smtp.gmail.com'
|
36
56
|
port: 587
|
@@ -39,7 +59,18 @@ smtp:
|
|
39
59
|
password: ''
|
40
60
|
from: 'Your Name <email@domain.com>'
|
41
61
|
|
62
|
+
# Mailgun settings for sending previews via their 3x faster API. Sign up for
|
63
|
+
# a free account and retrieve your API key and sending domain from your
|
64
|
+
# Mailgun account dashboard.
|
65
|
+
# https://inkcite.readme.io/v1.0/docs/email-previews#section-sending-via-mailgun
|
66
|
+
#
|
67
|
+
# mailgun:
|
68
|
+
# api-key: 'key-your-api-key'
|
69
|
+
# domain: 'mg.sending-domain.com'
|
70
|
+
# from: 'Your Name <email@domain.com>'
|
71
|
+
|
42
72
|
# Specify the distribution lists for preview versions of your email.
|
73
|
+
#
|
43
74
|
recipients:
|
44
75
|
client:
|
45
76
|
- 'Awesome Client <awesome.client@domain.com>'
|
@@ -48,7 +79,8 @@ recipients:
|
|
48
79
|
- 'Proofreader <proof.reader@domain.com>'
|
49
80
|
|
50
81
|
# Easy Litmus integration for compatibility testing.
|
51
|
-
#
|
82
|
+
# https://inkcite.readme.io/docs/compatibility-testing
|
83
|
+
#
|
52
84
|
litmus:
|
53
85
|
subdomain: ''
|
54
86
|
username: ''
|
@@ -56,6 +88,8 @@ litmus:
|
|
56
88
|
|
57
89
|
# Easy deployment of static assets to a CDN or publicly-accessible
|
58
90
|
# server - required when your email has images.
|
91
|
+
# https://dash.readme.io/project/inkcite/v1.0/docs/cdn-upload
|
92
|
+
#
|
59
93
|
sftp:
|
60
94
|
host: ''
|
61
95
|
path: ''
|
@@ -67,16 +101,21 @@ sftp:
|
|
67
101
|
# website analytics. {id} will be replaced with the unique ID
|
68
102
|
# from the link if you're concerned about which link the
|
69
103
|
# recipient clicked to get to your website.
|
104
|
+
# https://inkcite.readme.io/v1.0/docs/links
|
105
|
+
#
|
70
106
|
tag-links: "from_email=myemail|{id}"
|
71
107
|
|
72
108
|
# Optionally, if your email newsletter links to multiple websites
|
73
109
|
# and you only want to tag links to a specific domain, include
|
74
110
|
# that domain in this setting.
|
111
|
+
# https://inkcite.readme.io/v1.0/docs/links
|
112
|
+
#
|
75
113
|
#tag-links-domain: 'clientdomain.com'
|
76
114
|
|
77
115
|
|
78
116
|
# Environment-specific overrides allow you to change any setting
|
79
117
|
# for each environment (e.g local development vs. client preview).
|
118
|
+
# https://dash.readme.io/project/inkcite/v1.0/docs/environments
|
80
119
|
|
81
120
|
# These overrides apply to your local development environment when
|
82
121
|
# you are viewing the email in your browser via Inkcite's server.
|
@@ -94,4 +133,3 @@ production:
|
|
94
133
|
cache-bust: false
|
95
134
|
image-host: "http://production.imagehost.com/emails/myemail"
|
96
135
|
view-in-browser-url: 'http://production.contenthost.com/path/{filename}'
|
97
|
-
|
data/assets/init/helpers.tsv
CHANGED
@@ -1,31 +1,17 @@
|
|
1
|
-
// This file helps you keep your email code DRY (don't repeat yourself)
|
2
|
-
//
|
1
|
+
// This file helps you keep your email code DRY (don't repeat yourself) by
|
2
|
+
// allowing you to easily define constants and custom tags.
|
3
3
|
//
|
4
|
-
//
|
5
|
-
|
6
|
-
//
|
7
|
-
#background #ffffff
|
8
|
-
#text #000000
|
9
|
-
#link #0099cc
|
10
|
-
|
11
|
-
// Default font styles
|
12
|
-
font-family sans-serif
|
13
|
-
font-size 15
|
14
|
-
line-height 19
|
4
|
+
// https://inkcite.readme.io/docs/helpers
|
5
|
+
//
|
6
|
+
// NOTE! The keys and values in this file are TAB-delimited.
|
15
7
|
|
16
|
-
// This is an example of a custom tag. Tabs delimit the tag name, its open and
|
17
|
-
// close values. Inkcite will replace instances of {big} and {/big} with these
|
18
|
-
// values, respectively. Notice that it allows its color, which defaults to
|
19
|
-
// #444444, to be configured in your HTML as in {big color=#ff0000}.
|
20
|
-
big <div style="font-size: 18px; font-weight: bold; color: $color=#444444$"> </div>
|
21
8
|
|
22
|
-
//
|
23
|
-
|
24
|
-
|
25
|
-
button-padding 8
|
26
|
-
button-width 175
|
9
|
+
// This controls the subject line used for email prevents and text that is
|
10
|
+
// written into the <title> of the HTML created by Inkcite.
|
11
|
+
title Welcome to Inkcite
|
27
12
|
|
28
|
-
//
|
29
|
-
|
13
|
+
// This sets the color for all links generated with Inkcite's {a} helper.
|
14
|
+
#link #0099cc
|
30
15
|
|
31
|
-
|
16
|
+
// This defines the default font family used throughout your email.
|
17
|
+
font-family sans-serif
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# If you have enabled image optimization in config.yml you can control the
|
2
|
+
# exact inner-workings of the process through these settings. Additional
|
3
|
+
# documentation available here:
|
4
|
+
# https://github.com/toy/image_optim
|
5
|
+
|
6
|
+
allow_lossy: true # Small images through lossy compression
|
7
|
+
verbose: false # Verbose output
|
8
|
+
|
9
|
+
# Worker/optimizer-specific configurations follow
|
10
|
+
|
11
|
+
advpng:
|
12
|
+
level: 4 # Compression level: 0 - don't compress, 1 - fast, 2 - normal, 3 - extra, 4 - extreme
|
13
|
+
|
14
|
+
gifsicle:
|
15
|
+
level: 3 # Compression level: 1 - light and fast, 2 - normal, 3 - heavy (slower)
|
16
|
+
careful: false # Avoid bugs with some software (defaults to false)
|
17
|
+
|
18
|
+
jpegoptim:
|
19
|
+
max_quality: 50 # Maximum image quality factor 0..100, ignored in default/lossless mode
|
20
|
+
|
21
|
+
jpegrecompress:
|
22
|
+
quality: 1 # JPEG quality preset: 0 - low, 1 - medium, 2 - high, 3 - veryhigh
|
23
|
+
|
24
|
+
optipng:
|
25
|
+
level: 5 # Optimization level preset: 0 - least, 7 - best
|
26
|
+
|
27
|
+
pngquant:
|
28
|
+
quality: !ruby/range 0..50 # Quality min..max - don't save below min, use less colors below max
|
29
|
+
speed: 1 # Speed/quality trade-off: 1 - slow, 3 - default, 11 - fast & rough
|
30
|
+
|
31
|
+
# Note: PNGOUT is free to use even in commercial soft, but you can not
|
32
|
+
# redistribute, repackage or reuse it without consent and agreement of creator.
|
33
|
+
# Enable PNGOUT optimization by downloading and installing the binaries available
|
34
|
+
# from http://www.jonof.id.au/kenutils
|
35
|
+
pngout: false
|
36
|
+
|
37
|
+
svgo: false
|
data/assets/init/source.html
CHANGED
@@ -1,60 +0,0 @@
|
|
1
|
-
{wrap}
|
2
|
-
|
3
|
-
{preheader}This preheader will only be visible in supporting clients.{/preheader}
|
4
|
-
|
5
|
-
{table padding=10 width={width} mobile="fill"}
|
6
|
-
{td font=default align=left}
|
7
|
-
|
8
|
-
{img src=logo.gif height=50 width=200 alt="Company Logo"}<br>
|
9
|
-
|
10
|
-
The {img} helper automatically uses placehold.it when the specified image is missing from the images/ folder. It also sets the <code>display</code>-style to block and will warn you when you've forgotten to set dimensions. {img| are responsive-ready - you can set this image to <code>hide</code>, <code>fill</code> or show a different image using the <code>mobile-src</code> property.
|
11
|
-
|
12
|
-
{img src=billboard.jpg height=180 width={width} mobile="fill"}<br>
|
13
|
-
|
14
|
-
{lorem sentences=10}<br><br>
|
15
|
-
|
16
|
-
{button id="call-to-action" href="http://inkceptional.com"}I'm a Responsive Button{/button}<br>
|
17
|
-
|
18
|
-
{/td}
|
19
|
-
{/table}
|
20
|
-
|
21
|
-
{table width={width} padding=10 float=center valign=top mobile="drop"}
|
22
|
-
{td width=50%}
|
23
|
-
|
24
|
-
{img src=kittens.jpg width=250 height=150 mobile="fill"}<br>
|
25
|
-
|
26
|
-
{big}{lorem type=headline}{/big}
|
27
|
-
|
28
|
-
{lorem sentences=8}<br><br>
|
29
|
-
|
30
|
-
{button id="call-to-action2" href="http://inkceptional.com"}Create & Send{/button}
|
31
|
-
|
32
|
-
{/td}
|
33
|
-
{td width=50% bgcolor=#eeeeee font=default}
|
34
|
-
|
35
|
-
{big}{lorem type=headline}{/big}
|
36
|
-
{lorem sentences=3}<br><br>
|
37
|
-
|
38
|
-
{big}{lorem type=headline}{/big}
|
39
|
-
{lorem sentences=3}<br><br>
|
40
|
-
|
41
|
-
{big color=#990000}{lorem type=headline}{/big}
|
42
|
-
{lorem sentences=3}
|
43
|
-
|
44
|
-
{/td}
|
45
|
-
{/table}
|
46
|
-
|
47
|
-
{table padding=10 width={width} float=center mobile="fill"}
|
48
|
-
{td align=left font=small}
|
49
|
-
|
50
|
-
{img src=footer.jpg height=100 width={width} mobile="hide"}<br>
|
51
|
-
|
52
|
-
<% if email? %>
|
53
|
-
This email was sent to [email]. {a id="unsubscribe" href=#}Click here to unsubscribe{/a}.
|
54
|
-
Using ERB, this unsubscribe notice will only appear in the 'email' format of this project.
|
55
|
-
<% end %>
|
56
|
-
|
57
|
-
{/td}
|
58
|
-
{/table}
|
59
|
-
|
60
|
-
{/wrap}
|
data/inkcite.gemspec
CHANGED
@@ -27,6 +27,8 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_dependency 'builder'
|
28
28
|
spec.add_dependency 'erubis'
|
29
29
|
spec.add_dependency 'faker'
|
30
|
+
spec.add_dependency 'image_optim'
|
31
|
+
spec.add_dependency 'image_optim_pack'
|
30
32
|
spec.add_dependency 'litmus'
|
31
33
|
spec.add_dependency 'mail'
|
32
34
|
spec.add_dependency 'mailgun-ruby'
|
data/lib/inkcite/cli/base.rb
CHANGED
@@ -23,9 +23,13 @@ module Inkcite
|
|
23
23
|
end
|
24
24
|
|
25
25
|
desc 'init NAME [options]', 'Initialize a new email project in the NAME directory'
|
26
|
+
option :'empty',
|
27
|
+
:aliases => '-e',
|
28
|
+
:desc => 'Prevents Inkcite from copying the example email files into the new project',
|
29
|
+
:type => :boolean
|
26
30
|
option :from,
|
27
31
|
:aliases => '-f',
|
28
|
-
:desc => 'Clones an existing Inkcite project into
|
32
|
+
:desc => 'Clones an existing Inkcite project (all images, helpers, partials, etc.) into the new one'
|
29
33
|
|
30
34
|
def init name
|
31
35
|
require_relative 'init'
|
data/lib/inkcite/cli/build.rb
CHANGED
@@ -99,7 +99,7 @@ module Inkcite
|
|
99
99
|
|
100
100
|
# Check to see if images should be optimized and if so, perform said
|
101
101
|
# optimization on new or updated images.
|
102
|
-
email.optimize_images
|
102
|
+
email.optimize_images
|
103
103
|
|
104
104
|
# For each of the production views, build the HTML and links files.
|
105
105
|
email.views(:production) do |ev|
|
data/lib/inkcite/cli/init.rb
CHANGED
@@ -10,36 +10,51 @@ module Inkcite
|
|
10
10
|
# Inkcite project.
|
11
11
|
abort "It appears that an Inkcite already exists in #{path}" if File.exists?(File.join(full_init_path, 'config.yml'))
|
12
12
|
|
13
|
-
init_image_path = File.join(path, Inkcite::Email::IMAGES)
|
14
|
-
full_init_image_path = File.join(full_init_path, Inkcite::Email::IMAGES)
|
15
|
-
|
16
|
-
# Create the images directory first because it's the deepest level
|
17
|
-
# of the project structure.
|
18
|
-
FileUtils.mkpath(full_init_image_path)
|
19
|
-
|
20
|
-
puts "Created #{init_image_path}"
|
21
|
-
|
22
13
|
# Check to see if the user specified a --from path that is used to
|
23
14
|
# clone an existing project rather than init a new one.
|
24
15
|
from_path = opts[:from]
|
25
16
|
|
17
|
+
# True if the designer wants the project empty/fresh rather than pre-populated
|
18
|
+
# with the example/demonstration email content.
|
19
|
+
is_empty = opts[:empty]
|
20
|
+
|
26
21
|
# True if we're initializing a project from the built-in files.
|
27
22
|
is_new = opts[:from].blank?
|
23
|
+
if is_new
|
24
|
+
|
25
|
+
# Use the default, bundled path if a from-path wasn't specified.
|
26
|
+
# Verify the path exists
|
27
|
+
from_path = File.join(Inkcite.asset_path, 'init')
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
elsif is_empty
|
30
|
+
abort "Can't initialize a project using --empty and --from at the same time"
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
init_image_path = File.join(path, Inkcite::Email::IMAGES)
|
35
|
+
full_init_image_path = File.join(full_init_path, Inkcite::Email::IMAGES)
|
36
|
+
|
37
|
+
# Create the images directory first because it's the deepest level
|
38
|
+
# of the project structure.
|
39
|
+
FileUtils.mkpath(full_init_image_path)
|
40
|
+
puts "Created #{init_image_path}"
|
32
41
|
|
33
42
|
# Verify that the source directory contains the config.yml file
|
34
43
|
# signifying an existing Inkcite project.
|
35
44
|
abort "Can't find #{from_path} or it isn't an existing Inkcite project" unless File.exists?(File.join(from_path, 'config.yml'))
|
36
45
|
|
37
46
|
# Copy the main Inkcite project files
|
38
|
-
|
39
|
-
from_file = File.join(from_path, file)
|
40
|
-
next unless File.exists?(from_file)
|
47
|
+
Dir.glob(File.join(from_path, '*.{html,tsv,txt,yml}')).each do |from_file|
|
41
48
|
FileUtils.cp(from_file, full_init_path)
|
42
|
-
puts "Created #{File.join(path,
|
49
|
+
puts "Created #{File.join(path, from_file)}"
|
50
|
+
end
|
51
|
+
|
52
|
+
# If the example email is required, switch to the example root and
|
53
|
+
# copy the files within over the existing files.
|
54
|
+
unless is_empty
|
55
|
+
from_path = File.join(Inkcite.asset_path, 'example')
|
56
|
+
FileUtils.cp_r(File.join(from_path, '.'), full_init_path)
|
57
|
+
puts 'Copied example email files'
|
43
58
|
end
|
44
59
|
|
45
60
|
# Check to see if there are images and copy those as well.
|
data/lib/inkcite/cli/server.rb
CHANGED
@@ -92,6 +92,11 @@ module Inkcite
|
|
92
92
|
puts ''
|
93
93
|
puts "#{ts} Rendering your email [environment=#{environment}, format=#{format}, version=#{version || 'default'}]"
|
94
94
|
|
95
|
+
# Before the rendering takes place, trigger image optimization of any
|
96
|
+
# new or updated images. The {image} tag takes care of injecting the
|
97
|
+
# right path (optimized or not) depending on which version is needed.
|
98
|
+
@email.optimize_images
|
99
|
+
|
95
100
|
view = @email.view(environment, format, version)
|
96
101
|
|
97
102
|
html = view.render!
|
data/lib/inkcite/cli/test.rb
CHANGED
@@ -7,46 +7,31 @@ module Inkcite
|
|
7
7
|
|
8
8
|
def self.invoke email, opt
|
9
9
|
|
10
|
+
# Verify that a litmus: section is defined in the config.yml
|
11
|
+
config = email.config[:litmus]
|
12
|
+
if !config || config.blank?
|
13
|
+
puts "Unable to test with Litmus ('litmus:' section not found in config.yml)"
|
14
|
+
return false
|
15
|
+
end
|
16
|
+
|
17
|
+
# The new Litmus launched in October, 2015 no longer uses the API for creating
|
18
|
+
# tests and instead just accepts emails sent to the account's static email address.
|
19
|
+
# Check to see if a test-address has been defined.
|
20
|
+
send_to = config[:'test-address']
|
21
|
+
if send_to.nil? || send_to.blank?
|
22
|
+
puts "Unable to test with Litmus! ('test-address' entry missing from 'litmus:' section in the config.yml)"
|
23
|
+
return false
|
24
|
+
end
|
25
|
+
|
10
26
|
# Push the browser preview up to the server to ensure that the
|
11
27
|
# latest images are available.
|
12
28
|
email.upload
|
13
29
|
|
14
|
-
config = email.config[:litmus]
|
15
|
-
|
16
|
-
# Initialize the Litmus base.
|
17
|
-
Litmus::Base.new(config[:subdomain], config[:username], config[:password], true)
|
18
|
-
|
19
30
|
# Send each version to Litmus separately
|
20
31
|
email.versions.each do |version|
|
21
32
|
|
22
33
|
view = email.view(:preview, :email, version)
|
23
34
|
|
24
|
-
# This will hold the Litmus Test Version which provides the GUID (e.g. email)
|
25
|
-
# to which we will send.
|
26
|
-
test_version = nil
|
27
|
-
|
28
|
-
# Check to see if this email already has a test ID.
|
29
|
-
test_id = view.meta(:litmus_test_id)
|
30
|
-
if test_id.blank? || opt[:new]
|
31
|
-
|
32
|
-
email_test = Litmus::EmailTest.create
|
33
|
-
|
34
|
-
# Store the litmus test ID in the email's meta data.
|
35
|
-
view.set_meta :litmus_test_id, email_test['id']
|
36
|
-
|
37
|
-
# Extract the email address we need to send the test to.
|
38
|
-
test_version = email_test["test_set_versions"].first
|
39
|
-
|
40
|
-
else
|
41
|
-
|
42
|
-
# Create a new version of the test using the same ID as before.
|
43
|
-
test_version = Litmus::TestVersion.create(test_id)
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
# Extract the email address to send the test to.
|
48
|
-
send_to = test_version["url_or_guid"]
|
49
|
-
|
50
35
|
puts "Sending '#{view.subject}' to #{send_to} ..."
|
51
36
|
|
52
37
|
Inkcite::Mailer.litmus(email, version, send_to)
|
data/lib/inkcite/email.rb
CHANGED
@@ -52,12 +52,12 @@ module Inkcite
|
|
52
52
|
# Optimizes this email's images if optimize-images is enabled
|
53
53
|
# in the email configuration.
|
54
54
|
def optimize_images
|
55
|
-
|
55
|
+
Minifier.images(self, false) if optimize_images?
|
56
56
|
end
|
57
57
|
|
58
58
|
# Optimizes all of the images in this email.
|
59
59
|
def optimize_images!
|
60
|
-
Minifier.images(self)
|
60
|
+
Minifier.images(self, true)
|
61
61
|
end
|
62
62
|
|
63
63
|
def optimize_images?
|