inkcite 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/assets/init/helpers.tsv +3 -3
- data/inkcite.gemspec +3 -0
- data/lib/inkcite/cli/server.rb +80 -58
- data/lib/inkcite/renderer/responsive.rb +2 -2
- data/lib/inkcite/version.rb +1 -1
- metadata +44 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d4ff329598b10063f608482495b1067089c890f
|
4
|
+
data.tar.gz: 382ad87478df473ad76bda20a7fb306e125c65b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15a0cb8480b9e0abf92c31e2304b3f65baa64b450af06bd66061e3ca18f217645239bf5bedac1a74b0b5bea43a28e6a115de350c62ea30818e9a9b58bb0bddee
|
7
|
+
data.tar.gz: 7313d13e0033675536c3255946bde8cd37c5eef54fbd50c9abe8787a97cf77f76fde38f7bd1e2090f967b8ba4f512da4daa16bd132db776cb8d566c2ed643932
|
data/assets/init/helpers.tsv
CHANGED
@@ -8,10 +8,10 @@
|
|
8
8
|
|
9
9
|
// This controls the subject line used for email prevents and text that is
|
10
10
|
// written into the <title> of the HTML created by Inkcite.
|
11
|
-
title
|
11
|
+
title Welcome to Inkcite
|
12
12
|
|
13
13
|
// This sets the color for all links generated with Inkcite's {a} helper.
|
14
|
-
#link
|
14
|
+
#link #0099cc
|
15
15
|
|
16
16
|
// This defines the default font family used throughout your email.
|
17
|
-
font-family
|
17
|
+
font-family sans-serif
|
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 'guard'
|
31
|
+
spec.add_dependency 'guard-livereload'
|
30
32
|
spec.add_dependency 'image_optim'
|
31
33
|
spec.add_dependency 'image_optim_pack'
|
32
34
|
spec.add_dependency 'litmus'
|
@@ -34,6 +36,7 @@ Gem::Specification.new do |spec|
|
|
34
36
|
spec.add_dependency 'mailgun-ruby'
|
35
37
|
spec.add_dependency 'net-sftp'
|
36
38
|
spec.add_dependency 'rack'
|
39
|
+
spec.add_dependency 'rack-livereload'
|
37
40
|
spec.add_dependency 'rubyzip'
|
38
41
|
spec.add_dependency 'thor'
|
39
42
|
spec.add_dependency 'yui-compressor'
|
data/lib/inkcite/cli/server.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
require '
|
1
|
+
require 'guard'
|
2
|
+
require 'guard/commander'
|
2
3
|
require 'rack'
|
3
|
-
require '
|
4
|
+
require 'rack-livereload'
|
5
|
+
require 'webrick'
|
4
6
|
|
5
7
|
module Inkcite
|
6
8
|
module Cli
|
@@ -8,82 +10,102 @@ module Inkcite
|
|
8
10
|
|
9
11
|
def self.start email, opts
|
10
12
|
|
11
|
-
|
13
|
+
puts
|
14
|
+
puts "Inkcite #{Inkcite::VERSION} is starting up ..."
|
15
|
+
puts 'Documentation available at http://inkcite.readme.io'
|
16
|
+
puts
|
17
|
+
|
18
|
+
# Read the hostname and port from the opts provided on the command
|
19
|
+
# line - or inherit the default of localhost:4567
|
12
20
|
port = opts[:port].to_i
|
13
21
|
host = opts[:host]
|
14
22
|
|
15
|
-
#
|
23
|
+
# Attempt to resolve the machine's public IP so we can display the
|
24
|
+
# address for mobile devices.
|
16
25
|
ip = begin
|
17
26
|
IPSocket.getaddress(Socket.gethostname)
|
18
27
|
rescue
|
19
28
|
nil
|
20
29
|
end
|
21
30
|
|
22
|
-
|
23
|
-
puts "Inkcite #{Inkcite::VERSION} is starting up ..."
|
24
|
-
puts 'Documentation available at http://inkcite.readme.io'
|
25
|
-
puts 'Press CTRL-C to exit server mode'
|
26
|
-
puts
|
31
|
+
fork do
|
27
32
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
rescue Errno::EADDRINUSE
|
36
|
-
raise "== Port #{port} is unavailable. Either close the instance of Inkcite already running on #{port} or start this Inkcite instance on a new port with: --port=#{port+1}"
|
37
|
-
exit(1)
|
38
|
-
end
|
39
|
-
|
40
|
-
# Listen to all of the things in order to properly
|
41
|
-
# shutdown the server.
|
42
|
-
%w(INT HUP TERM QUIT).each do |sig|
|
43
|
-
if Signal.list[sig]
|
44
|
-
Signal.trap(sig) do
|
45
|
-
@server.shutdown
|
33
|
+
# Programmatically construct a Guard configuration file that
|
34
|
+
# instructs it to monitor all of the HTML, TSV, YML and images
|
35
|
+
# that can be used in the email project.
|
36
|
+
guardfile = <<-EOF
|
37
|
+
guard :livereload do
|
38
|
+
watch(%r{^*.+\.(html|tsv|yml)})
|
39
|
+
watch(%r{^images/.+\.*})
|
46
40
|
end
|
47
|
-
|
41
|
+
|
42
|
+
logger level: :error
|
43
|
+
EOF
|
44
|
+
|
45
|
+
# You can omit the call to Guard.setup, Guard.start will call Guard.setup
|
46
|
+
# under the hood if Guard has not been setuped yet
|
47
|
+
Guard.start :guardfile_contents => guardfile, :no_interactions => true
|
48
|
+
|
48
49
|
end
|
49
50
|
|
50
|
-
|
51
|
+
# Assemble the Rack app with the static content middleware and the
|
52
|
+
# InkciteApp to server the email as the root index page.
|
53
|
+
app = Rack::Builder.new do
|
54
|
+
use Rack::LiveReload
|
55
|
+
use Rack::Static, :urls => %w( /images /images-optim ), :root => '.'
|
56
|
+
run InkciteApp.new(email, opts)
|
57
|
+
end
|
51
58
|
|
52
59
|
puts "Your email is being served at http://#{host}:#{port}"
|
53
60
|
puts "Point your mobile device to http://#{ip}:#{port}" if ip
|
54
|
-
puts
|
61
|
+
puts 'Press CTRL-C to exit server mode'
|
62
|
+
puts ''
|
55
63
|
|
56
|
-
|
64
|
+
begin
|
57
65
|
|
58
|
-
|
66
|
+
# Start the server and disable WEBrick's verbose logging.
|
67
|
+
Rack::Server.start({
|
68
|
+
:Host => host,
|
69
|
+
:Port => port,
|
70
|
+
:AccessLog => [],
|
71
|
+
:Logger => WEBrick::Log.new(nil, 0),
|
72
|
+
:app => app
|
73
|
+
})
|
74
|
+
rescue Errno::EADDRINUSE
|
75
|
+
abort("Oops! Port #{port} is unavailable. Either close the instance of Inkcite already running on #{port} or start this Inkcite instance on a new port with: --port=#{port+1}")
|
76
|
+
end
|
59
77
|
|
60
|
-
def initialize email, opts
|
61
|
-
@email = email
|
62
|
-
@opts = opts
|
63
78
|
end
|
64
79
|
|
65
|
-
|
66
|
-
|
80
|
+
private
|
81
|
+
|
82
|
+
class InkciteApp
|
83
|
+
|
84
|
+
def initialize email, opts
|
85
|
+
@email = email
|
86
|
+
@opts = opts
|
87
|
+
end
|
88
|
+
|
89
|
+
def call env
|
67
90
|
|
68
|
-
|
91
|
+
request = Rack::Request.new(env)
|
69
92
|
|
70
93
|
# If this request is for the root index page, render the email. Otherwise
|
71
94
|
# render the static asset.
|
72
|
-
if
|
95
|
+
return if request.path_info != REQUEST_ROOT
|
73
96
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
params = CGI::parse(env[QUERY_STRING] || '')
|
79
|
-
params = Hash[params.map { |key, values| [ key.to_sym, values[0] || true ] }].symbolize_keys
|
97
|
+
response = Rack::Response.new
|
98
|
+
response[Rack::CONTENT_TYPE] = 'text/html'
|
99
|
+
|
100
|
+
begin
|
80
101
|
|
81
102
|
# Allow the designer to specify both short- and long-form versions of
|
82
103
|
# the (e)nvironment, (f)ormat and (v)ersion. Otherwise, use the values
|
83
104
|
# that Inkcite was started with.
|
84
|
-
|
85
|
-
|
86
|
-
|
105
|
+
params = request.params
|
106
|
+
environment = Util.detect(params['e'], params['environment'], @opts[:environment])
|
107
|
+
format = Util.detect(params['f'], params['format'], @opts[:format])
|
108
|
+
version = Util.detect(params['v'], params['version'], @opts[:version])
|
87
109
|
|
88
110
|
# Timestamp all of the messages from this rendering so it is clear which
|
89
111
|
# messages are associated with this reload.
|
@@ -107,24 +129,24 @@ module Inkcite
|
|
107
129
|
puts "#{ts} - #{view.errors.join("\n#{ts} - ")}"
|
108
130
|
end
|
109
131
|
|
110
|
-
|
111
|
-
else
|
112
|
-
Rack::File.new(Dir.pwd).call(env)
|
132
|
+
response.write html
|
113
133
|
|
134
|
+
rescue Exception => e
|
135
|
+
response.write "<html><head><title>Oops! There was a problem!</title></head><body style='padding: 30px; font-family: sans-serif;'>"
|
136
|
+
response.write '<h2>Oops!</h2>'
|
137
|
+
response.write "<p>There was a problem rendering your email: #{e.message}</p>"
|
138
|
+
response.write "<pre>#{e.backtrace.join('<br>')}</pre>"
|
139
|
+
response.write 'Please correct the problem and try reloading the page.'
|
140
|
+
response.write '</body></html>'
|
114
141
|
end
|
115
142
|
|
116
|
-
|
117
|
-
|
118
|
-
puts e.backtrace.inspect
|
143
|
+
response.finish
|
144
|
+
|
119
145
|
end
|
120
146
|
|
121
147
|
end
|
122
148
|
|
123
|
-
private
|
124
|
-
|
125
|
-
REQUEST_PATH = 'REQUEST_PATH'
|
126
149
|
REQUEST_ROOT = '/'
|
127
|
-
QUERY_STRING = 'QUERY_STRING'
|
128
150
|
|
129
151
|
DATEFORMAT = '%Y-%m-%d %H:%M:%S'
|
130
152
|
|
@@ -142,8 +142,8 @@ module Inkcite
|
|
142
142
|
# Brian Graves' Column Switch Pattern: Allows columns in a table to
|
143
143
|
# be reordered based on up and down states.
|
144
144
|
# http://www.degdigital.com/blog/content-choreography-in-responsive-email/
|
145
|
-
styles << Rule.new('td', SWITCH, 'display: table-footer-group; width: 100% !important; background-size: 100% auto !important;')
|
146
|
-
styles << Rule.new('td', SWITCH_UP, 'display: table-header-group; width: 100% !important; background-size: 100% auto !important;')
|
145
|
+
styles << Rule.new('td', SWITCH, 'display: table-footer-group; width: 100% !important; background-size: 100% auto !important;', false)
|
146
|
+
styles << Rule.new('td', SWITCH_UP, 'display: table-header-group; width: 100% !important; background-size: 100% auto !important;', false)
|
147
147
|
|
148
148
|
# FILL causes specific types of elements to expand to 100% of the available
|
149
149
|
# width of the mobile device.
|
data/lib/inkcite/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inkcite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeffrey D. Hoffman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -66,6 +66,34 @@ dependencies:
|
|
66
66
|
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: guard
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: guard-livereload
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
98
|
name: image_optim
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,6 +192,20 @@ dependencies:
|
|
164
192
|
- - '>='
|
165
193
|
- !ruby/object:Gem::Version
|
166
194
|
version: '0'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: rack-livereload
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - '>='
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0'
|
202
|
+
type: :runtime
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - '>='
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
167
209
|
- !ruby/object:Gem::Dependency
|
168
210
|
name: rubyzip
|
169
211
|
requirement: !ruby/object:Gem::Requirement
|