mint 0.5.1 → 0.7.1
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.
- data/Gemfile +18 -0
- data/README.md +3 -3
- data/bin/mint +27 -27
- data/bin/mint-epub +6 -6
- data/config/syntax.yaml +12 -12
- data/{templates → config/templates}/base/style.sass +11 -4
- data/config/templates/default/css/style.css +158 -0
- data/config/templates/default/layout.haml +8 -0
- data/{templates → config/templates}/default/style.sass +0 -0
- data/{templates/default → config/templates/protocol}/layout.haml +0 -0
- data/config/templates/protocol/style.sass +20 -0
- data/config/templates/reset.css +92 -0
- data/config/templates/zen/css/style.css +145 -0
- data/{templates/pro → config/templates/zen}/layout.haml +0 -0
- data/config/templates/zen/style.sass +24 -0
- data/features/config.feature +21 -0
- data/features/publish.feature +3 -3
- data/features/support/env.rb +9 -27
- data/features/templates.feature +79 -0
- data/lib/mint.rb +11 -11
- data/lib/mint/{commandline.rb → command_line.rb} +96 -80
- data/lib/mint/css.rb +43 -34
- data/lib/mint/document.rb +99 -93
- data/lib/mint/helpers.rb +21 -17
- data/lib/mint/layout.rb +1 -1
- data/lib/mint/mint.rb +92 -36
- data/lib/mint/plugin.rb +5 -5
- data/lib/mint/plugins/epub.rb +51 -51
- data/lib/mint/resource.rb +2 -2
- data/lib/mint/style.rb +2 -2
- data/lib/mint/version.rb +1 -1
- data/spec/command_line_spec.rb +87 -0
- data/spec/css_spec.rb +46 -0
- data/spec/document_spec.rb +38 -40
- data/spec/helpers_spec.rb +101 -83
- data/spec/layout_spec.rb +1 -1
- data/spec/mint_spec.rb +184 -60
- data/spec/plugin_spec.rb +61 -67
- data/spec/plugins/epub_spec.rb +47 -47
- data/spec/resource_spec.rb +9 -9
- data/spec/spec_helper.rb +20 -93
- data/spec/style_spec.rb +6 -8
- data/spec/support/fixtures/content.md +16 -0
- data/spec/support/fixtures/dynamic.sass +3 -0
- data/spec/support/fixtures/layout.haml +3 -0
- data/spec/support/fixtures/static.css +3 -0
- data/spec/support/matchers.rb +15 -0
- metadata +160 -70
- data/spec/commandline_spec.rb +0 -91
- data/templates/pro/style.sass +0 -0
File without changes
|
File without changes
|
@@ -0,0 +1,20 @@
|
|
1
|
+
$screen_font_size: 16px
|
2
|
+
$screen_line_height: $screen_font_size * 1.3
|
3
|
+
$screen_unit: $screen_line_height
|
4
|
+
|
5
|
+
$print_font_size: 12pt
|
6
|
+
$print_line_height: $print_font_size * 1.3
|
7
|
+
$print_unit: $print_line_height
|
8
|
+
|
9
|
+
$link_color: #cb0018
|
10
|
+
|
11
|
+
@import ../base/style
|
12
|
+
|
13
|
+
body
|
14
|
+
font-family: ScalaSansPro, "Helvetica Neue"
|
15
|
+
|
16
|
+
p+h2, p+h3, p+h4, p+h5, p+h6
|
17
|
+
margin-top: $screen_unit * 1.5
|
18
|
+
|
19
|
+
p
|
20
|
+
line-height: 1.25
|
@@ -0,0 +1,92 @@
|
|
1
|
+
html, body, div, span, object, iframe,
|
2
|
+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
3
|
+
abbr, address, cite, code,
|
4
|
+
del, dfn, em, img, ins, kbd, q, samp,
|
5
|
+
small, strong, sub, sup, var,
|
6
|
+
b, i,
|
7
|
+
dl, dt, dd, ol, ul, li,
|
8
|
+
fieldset, form, label, legend,
|
9
|
+
table, caption, tbody, tfoot, thead, tr, th, td,
|
10
|
+
article, aside, canvas, details, figcaption, figure,
|
11
|
+
footer, header, hgroup, menu, nav, section, summary,
|
12
|
+
time, mark, audio, video {
|
13
|
+
margin: 0;
|
14
|
+
padding: 0;
|
15
|
+
border: 0;
|
16
|
+
outline: 0;
|
17
|
+
font-size: 100%;
|
18
|
+
vertical-align: baseline;
|
19
|
+
background: transparent;
|
20
|
+
}
|
21
|
+
|
22
|
+
body {
|
23
|
+
line-height: 1;
|
24
|
+
}
|
25
|
+
|
26
|
+
article,aside,canvas,details,figcaption,figure,
|
27
|
+
footer,header,hgroup,menu,nav,section,summary {
|
28
|
+
display: block;
|
29
|
+
}
|
30
|
+
|
31
|
+
nav ul {
|
32
|
+
list-style: none;
|
33
|
+
}
|
34
|
+
|
35
|
+
blockquote, q {
|
36
|
+
quotes: none;
|
37
|
+
}
|
38
|
+
|
39
|
+
blockquote:before, blockquote:after,
|
40
|
+
q:before, q:after {
|
41
|
+
content:'';
|
42
|
+
content:none;
|
43
|
+
}
|
44
|
+
|
45
|
+
a {
|
46
|
+
margin:0;
|
47
|
+
padding:0;
|
48
|
+
border:0;
|
49
|
+
font-size:100%;
|
50
|
+
vertical-align:baseline;
|
51
|
+
background:transparent;
|
52
|
+
}
|
53
|
+
|
54
|
+
ins {
|
55
|
+
background-color:#ff9;
|
56
|
+
color:#000;
|
57
|
+
text-decoration:none;
|
58
|
+
}
|
59
|
+
|
60
|
+
mark {
|
61
|
+
background-color:#ff9;
|
62
|
+
color:#000;
|
63
|
+
font-style:italic;
|
64
|
+
font-weight:bold;
|
65
|
+
}
|
66
|
+
|
67
|
+
del {
|
68
|
+
text-decoration: line-through;
|
69
|
+
}
|
70
|
+
|
71
|
+
abbr[title], dfn[title] {
|
72
|
+
border-bottom:1px dotted #000;
|
73
|
+
cursor:help;
|
74
|
+
}
|
75
|
+
|
76
|
+
table {
|
77
|
+
border-collapse:collapse;
|
78
|
+
border-spacing:0;
|
79
|
+
}
|
80
|
+
|
81
|
+
hr {
|
82
|
+
display:block;
|
83
|
+
height:1px;
|
84
|
+
border:0;
|
85
|
+
border-top:1px solid #cccccc;
|
86
|
+
margin:1em 0;
|
87
|
+
padding:0;
|
88
|
+
}
|
89
|
+
|
90
|
+
input, select {
|
91
|
+
vertical-align:middle;
|
92
|
+
}
|
@@ -0,0 +1,145 @@
|
|
1
|
+
@import url(../reset.css);
|
2
|
+
body {
|
3
|
+
font-family: Georgia, serif; }
|
4
|
+
|
5
|
+
h1, h2 {
|
6
|
+
line-height: 1.3; }
|
7
|
+
|
8
|
+
h2, h3, h4, h5, h6 {
|
9
|
+
line-height: 18.2px; }
|
10
|
+
|
11
|
+
h1, h2, h3, h4, h5, h6 {
|
12
|
+
font-weight: normal; }
|
13
|
+
|
14
|
+
h1 {
|
15
|
+
font-size: 21px;
|
16
|
+
margin-top: 18.2px;
|
17
|
+
margin-bottom: 18.2px; }
|
18
|
+
|
19
|
+
h2 {
|
20
|
+
font-size: 16.8px;
|
21
|
+
margin-top: 18.2px;
|
22
|
+
margin-bottom: 18.2px; }
|
23
|
+
|
24
|
+
h3 {
|
25
|
+
font-size: 15.4px;
|
26
|
+
margin-top: 27.3px;
|
27
|
+
margin-bottom: 9.1px; }
|
28
|
+
|
29
|
+
h4 {
|
30
|
+
font-size: 14.7px;
|
31
|
+
margin-top: 31.85px;
|
32
|
+
margin-bottom: 4.55px; }
|
33
|
+
|
34
|
+
h5, h6 {
|
35
|
+
font-size: 14px;
|
36
|
+
margin-top: 15.925px;
|
37
|
+
margin-bottom: 2.275px; }
|
38
|
+
|
39
|
+
ul {
|
40
|
+
list-style-type: square; }
|
41
|
+
ul ul {
|
42
|
+
list-style-type: circle; }
|
43
|
+
|
44
|
+
ul, ol {
|
45
|
+
margin: 4.55px 0 0 9.1px;
|
46
|
+
padding-left: 21.84px; }
|
47
|
+
ul li p, ol li p {
|
48
|
+
text-indent: 0 !important; }
|
49
|
+
ul li + li, ol li + li {
|
50
|
+
margin-top: 4.55px; }
|
51
|
+
|
52
|
+
p {
|
53
|
+
margin: 9.1px 0; }
|
54
|
+
|
55
|
+
ul + p, ol + p, blockquote + p, pre + p {
|
56
|
+
text-indent: 0; }
|
57
|
+
|
58
|
+
a:link, a:visited, a:active {
|
59
|
+
color: #cb0018;
|
60
|
+
text-decoration: none; }
|
61
|
+
a:hover {
|
62
|
+
text-decoration: underline; }
|
63
|
+
|
64
|
+
code {
|
65
|
+
font-family: Monaco, Menlo, Mensch, Consolas, Monotype, mono;
|
66
|
+
font-style: normal; }
|
67
|
+
|
68
|
+
pre, blockquote {
|
69
|
+
display: block;
|
70
|
+
margin-left: 18.2px;
|
71
|
+
margin-right: 36.4px;
|
72
|
+
padding: 6.06667px 18.2px;
|
73
|
+
padding-left: 13.65px;
|
74
|
+
white-space: pre; }
|
75
|
+
pre p, blockquote p {
|
76
|
+
margin: 0;
|
77
|
+
line-height: 1.35; }
|
78
|
+
|
79
|
+
img {
|
80
|
+
display: block; }
|
81
|
+
|
82
|
+
@media screen {
|
83
|
+
body {
|
84
|
+
font-size: 14px;
|
85
|
+
line-height: 18.2px;
|
86
|
+
background-color: #666666; }
|
87
|
+
|
88
|
+
#container {
|
89
|
+
display: block;
|
90
|
+
border: solid 1px #999999;
|
91
|
+
width: 740px;
|
92
|
+
padding: 60px;
|
93
|
+
margin: 9.1px auto;
|
94
|
+
background-color: white;
|
95
|
+
box-sizing: border-box;
|
96
|
+
-moz-box-sizing: border-box;
|
97
|
+
-webkit-box-sizing: border-box; }
|
98
|
+
|
99
|
+
code {
|
100
|
+
font-size: 12.25px; }
|
101
|
+
|
102
|
+
pre {
|
103
|
+
white-space: pre-wrap;
|
104
|
+
white-space: -moz-pre-wrap;
|
105
|
+
white-space: -o-pre-wrap;
|
106
|
+
word-wrap: break-word; }
|
107
|
+
pre code {
|
108
|
+
font-size: 10.5px; } }
|
109
|
+
@media print {
|
110
|
+
@page {
|
111
|
+
margin-left: 1in;
|
112
|
+
margin-right: 1in;
|
113
|
+
margin-top: 1in;
|
114
|
+
margin-bottom: 1in; }
|
115
|
+
|
116
|
+
body {
|
117
|
+
font-size: 10pt;
|
118
|
+
line-height: 13pt;
|
119
|
+
width: auto;
|
120
|
+
margin: 0;
|
121
|
+
padding: 0; }
|
122
|
+
|
123
|
+
code {
|
124
|
+
font-size: 8.75pt; }
|
125
|
+
|
126
|
+
pre code {
|
127
|
+
font-size: 7.5pt; }
|
128
|
+
|
129
|
+
h1, h2, h3, h4, h5, h6, li, blockquote {
|
130
|
+
page-break-inside: avoid; }
|
131
|
+
|
132
|
+
p {
|
133
|
+
widows: 3;
|
134
|
+
orphans: 3; } }
|
135
|
+
body {
|
136
|
+
font-family: "Helvetica Neue", sans;
|
137
|
+
color: #444444;
|
138
|
+
line-height: 1.5; }
|
139
|
+
|
140
|
+
code, pre code {
|
141
|
+
font-size: 13.125px; }
|
142
|
+
|
143
|
+
#container {
|
144
|
+
padding-right: 15%;
|
145
|
+
padding-left: 15%; }
|
File without changes
|
@@ -0,0 +1,24 @@
|
|
1
|
+
$screen_font_size: 14px
|
2
|
+
$screen_line_height: $screen_font_size * 1.3
|
3
|
+
$screen_unit: $screen_line_height
|
4
|
+
|
5
|
+
$print_font_size: 10pt
|
6
|
+
|
7
|
+
$print_line_height: $print_font_size * 1.3
|
8
|
+
$print_unit: $print_line_height
|
9
|
+
|
10
|
+
$link_color: #cb0018
|
11
|
+
|
12
|
+
@import ../base/style
|
13
|
+
|
14
|
+
body
|
15
|
+
font-family: "Helvetica Neue", sans
|
16
|
+
color: #444
|
17
|
+
line-height: 1.5
|
18
|
+
|
19
|
+
code, pre code
|
20
|
+
font-size: $screen_font_size * 15/16
|
21
|
+
|
22
|
+
#container
|
23
|
+
padding-right: 15%
|
24
|
+
padding-left: 15%
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Feature: Change and view stored configuration
|
2
|
+
As a writer
|
3
|
+
I want to configure sensible defaults for different project scopes
|
4
|
+
So that I do not have to repeatedly configure my tool
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given a directory named ".mint"
|
8
|
+
And a file named ".mint/defaults.yaml" with:
|
9
|
+
"""
|
10
|
+
layout: zen
|
11
|
+
"""
|
12
|
+
|
13
|
+
Scenario: View aggregated configuration
|
14
|
+
When I run `mint config`
|
15
|
+
Then the output should contain "layout: zen"
|
16
|
+
|
17
|
+
Scenario: Configure a local default
|
18
|
+
When I run `mint set layout default`
|
19
|
+
And I run `mint config`
|
20
|
+
Then the output should contain "layout: default"
|
21
|
+
And the output should not contain "layout: zen"
|
data/features/publish.feature
CHANGED
@@ -44,9 +44,9 @@ Feature: Publish document with varying options at the command line
|
|
44
44
|
|
45
45
|
Examples:
|
46
46
|
| template | layout | style | style file |
|
47
|
-
| | | | ../../templates/default/css/style.css |
|
48
|
-
| -t
|
49
|
-
| | -l
|
47
|
+
| | | | ../../config/templates/default/css/style.css |
|
48
|
+
| -t zen | | | ../../config/templates/zen/css/style.css |
|
49
|
+
| | -l zen | -s zen | ../../config/templates/zen/css/style.css |
|
50
50
|
|
51
51
|
Scenario: Publish document with non-existent template
|
52
52
|
When I run `mint publish -t nonexistent content.md`
|
data/features/support/env.rb
CHANGED
@@ -1,33 +1,15 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift File.expand_path('../../../lib', __FILE__)
|
4
|
-
|
5
|
-
module ArubaOverrides
|
6
|
-
def detect_ruby(cmd)
|
7
|
-
if cmd =~ /^mint/
|
8
|
-
"ruby -I ../../lib -S ../../bin/#{cmd}"
|
9
|
-
else
|
10
|
-
super(cmd)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
World(ArubaOverrides)
|
1
|
+
require "aruba/cucumber"
|
16
2
|
|
17
3
|
Before do
|
18
|
-
@aruba_timeout_seconds
|
19
|
-
@
|
20
|
-
@
|
21
|
-
|
22
|
-
# puts "path is #{@old_path}"
|
23
|
-
unless @old_path.include? @bin_path
|
24
|
-
puts "changing path to #{@bin_path}"
|
25
|
-
system "export PATH=#{@bin_path}:$PATH"
|
26
|
-
end
|
27
|
-
# puts "now mint command should alias to #{`which mint`}"
|
4
|
+
@aruba_timeout_seconds = 5
|
5
|
+
@original_path, ENV["PATH"] = ENV["PATH"], "../../bin:#{ENV['PATH']}"
|
6
|
+
@original_rubylib, ENV["RUBYLIB"] = ENV["RUBYLIB"], "../../lib"
|
7
|
+
ENV["MINT_NO_PIPE"] = "true"
|
28
8
|
end
|
29
9
|
|
30
10
|
After do
|
31
|
-
|
32
|
-
ENV[
|
11
|
+
ENV["PATH"] = @original_path
|
12
|
+
ENV["RUBYLIB"] = @original_rubylib
|
13
|
+
ENV["MINT_NO_PIPE"] = nil
|
14
|
+
FileUtils.rm_rf "tmp/aruba"
|
33
15
|
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
Feature: Install, uninstall, and list templates
|
2
|
+
As a writer
|
3
|
+
I want to use existing stylesheets and install my own
|
4
|
+
So that I do not have to clutter up my workspace with styles
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given a file named "file.sass" with:
|
8
|
+
"""
|
9
|
+
p
|
10
|
+
margin: 0
|
11
|
+
"""
|
12
|
+
|
13
|
+
And a file named "file.scss" with:
|
14
|
+
"""
|
15
|
+
p {
|
16
|
+
margin: 0
|
17
|
+
}
|
18
|
+
"""
|
19
|
+
|
20
|
+
And a file named "file.haml" with:
|
21
|
+
"""
|
22
|
+
%html
|
23
|
+
%head
|
24
|
+
%link(rel='stylesheet' href=stylesheet)
|
25
|
+
|
26
|
+
%body
|
27
|
+
#container= content
|
28
|
+
"""
|
29
|
+
|
30
|
+
And a file named "file.erb" with:
|
31
|
+
"""
|
32
|
+
<html>
|
33
|
+
<head>
|
34
|
+
<link rel='stylesheet' href=<%= stylesheet %> />
|
35
|
+
</head>
|
36
|
+
|
37
|
+
<body>
|
38
|
+
<div id='container'>
|
39
|
+
<%= content %>
|
40
|
+
</div>
|
41
|
+
</body>
|
42
|
+
</html>
|
43
|
+
"""
|
44
|
+
|
45
|
+
Scenario Outline: Install a named template with or without a name and scope
|
46
|
+
When I run `mint install file.<ext> <dest template> <scope>`
|
47
|
+
Then a file named "<root>/templates/<template>/<file name>" should exist
|
48
|
+
|
49
|
+
Examples:
|
50
|
+
| ext | dest template | scope | root | template | file name |
|
51
|
+
| haml | -t pro | --local | .mint | pro | layout.haml |
|
52
|
+
| erb | -t pro | --local | .mint | pro | layout.erb |
|
53
|
+
| sass | -t pro | --local | .mint | pro | style.sass |
|
54
|
+
| scss | -t pro | --local | .mint | pro | style.scss |
|
55
|
+
| haml | -t pro | | .mint | pro | layout.haml |
|
56
|
+
| haml | | | .mint | file | layout.haml |
|
57
|
+
|
58
|
+
Scenario: Uninstall an installed file
|
59
|
+
When I run `mint install -t pro file.sass`
|
60
|
+
Then a directory named ".mint/templates/pro" should exist
|
61
|
+
When I run `mint templates --local`
|
62
|
+
Then the output should contain "pro"
|
63
|
+
When I run `mint uninstall pro`
|
64
|
+
Then a directory named ".mint/templates/pro" should not exist
|
65
|
+
|
66
|
+
Scenario: List all templates in scope
|
67
|
+
When I run `mint install -t one file.sass --local`
|
68
|
+
When I run `mint install -t two file.sass --local`
|
69
|
+
And I run `mint templates --local`
|
70
|
+
Then the output should contain:
|
71
|
+
"""
|
72
|
+
one
|
73
|
+
two
|
74
|
+
"""
|
75
|
+
When I run `mint templates one --local`
|
76
|
+
Then the output should contain:
|
77
|
+
"""
|
78
|
+
one
|
79
|
+
"""
|