mint 0.7.3 → 0.8.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.
Files changed (71) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +23 -14
  3. data/LICENSE +22 -0
  4. data/README.md +82 -56
  5. data/bin/mint +47 -10
  6. data/bin/mint-epub +1 -4
  7. data/config/templates/base/style.css +187 -0
  8. data/config/templates/default/css/style.css +126 -79
  9. data/config/templates/default/layout.erb +10 -0
  10. data/config/templates/default/style.css +237 -0
  11. data/config/templates/garden/layout.erb +38 -0
  12. data/config/templates/garden/style.css +303 -0
  13. data/config/templates/newspaper/layout.erb +16 -0
  14. data/config/templates/nord/layout.erb +11 -0
  15. data/config/templates/nord/style.css +339 -0
  16. data/config/templates/nord-dark/layout.erb +11 -0
  17. data/config/templates/nord-dark/style.css +339 -0
  18. data/config/templates/protocol/layout.erb +9 -0
  19. data/config/templates/protocol/style.css +25 -0
  20. data/config/templates/zen/layout.erb +11 -0
  21. data/config/templates/zen/style.css +114 -0
  22. data/lib/mint/command_line.rb +253 -111
  23. data/lib/mint/css.rb +11 -4
  24. data/lib/mint/css_template.rb +37 -0
  25. data/lib/mint/document.rb +193 -43
  26. data/lib/mint/helpers.rb +50 -10
  27. data/lib/mint/layout.rb +2 -3
  28. data/lib/mint/markdown_template.rb +47 -0
  29. data/lib/mint/mint.rb +181 -114
  30. data/lib/mint/plugin.rb +3 -3
  31. data/lib/mint/plugins/epub.rb +1 -2
  32. data/lib/mint/resource.rb +19 -9
  33. data/lib/mint/style.rb +10 -14
  34. data/lib/mint/version.rb +1 -1
  35. data/lib/mint.rb +1 -0
  36. data/man/mint.1 +135 -0
  37. data/spec/cli/README.md +99 -0
  38. data/spec/cli/argument_parsing_spec.rb +207 -0
  39. data/spec/cli/bin_integration_spec.rb +348 -0
  40. data/spec/cli/configuration_management_spec.rb +363 -0
  41. data/spec/cli/full_workflow_integration_spec.rb +527 -0
  42. data/spec/cli/publish_workflow_spec.rb +368 -0
  43. data/spec/cli/template_management_spec.rb +300 -0
  44. data/spec/css_spec.rb +1 -1
  45. data/spec/document_spec.rb +105 -68
  46. data/spec/helpers_spec.rb +42 -42
  47. data/spec/mint_spec.rb +104 -80
  48. data/spec/plugin_spec.rb +86 -88
  49. data/spec/run_cli_tests.rb +95 -0
  50. data/spec/spec_helper.rb +8 -1
  51. data/spec/style_spec.rb +18 -16
  52. data/spec/support/cli_helpers.rb +169 -0
  53. data/spec/support/fixtures/content-2.md +16 -0
  54. data/spec/support/matchers.rb +1 -1
  55. metadata +145 -167
  56. data/config/syntax.yaml +0 -71
  57. data/config/templates/base/style.sass +0 -144
  58. data/config/templates/default/layout.haml +0 -8
  59. data/config/templates/default/style.sass +0 -36
  60. data/config/templates/protocol/layout.haml +0 -7
  61. data/config/templates/protocol/style.sass +0 -20
  62. data/config/templates/zen/css/style.css +0 -145
  63. data/config/templates/zen/layout.haml +0 -7
  64. data/config/templates/zen/style.sass +0 -24
  65. data/features/config.feature +0 -21
  66. data/features/plugins/epub.feature +0 -23
  67. data/features/publish.feature +0 -73
  68. data/features/support/env.rb +0 -15
  69. data/features/templates.feature +0 -79
  70. data/spec/command_line_spec.rb +0 -87
  71. data/spec/plugins/epub_spec.rb +0 -242
data/config/syntax.yaml DELETED
@@ -1,71 +0,0 @@
1
- template:
2
- short: t
3
- long: template
4
- parameter: true
5
- description: "Specify the template (layout + style)"
6
-
7
- layout:
8
- short: l
9
- long: layout
10
- parameter: true
11
- description: "Specify only the style"
12
-
13
- style:
14
- short: s
15
- long: style
16
- parameter: true
17
- description: "Specify only the style"
18
-
19
- root:
20
- short: w
21
- long: r
22
- parameter: true
23
- description: "Specify a root outside the current directory"
24
-
25
- destination:
26
- short: d
27
- long: destination
28
- parameter: true
29
- description: "Specify a destination directory, relative to the root"
30
-
31
- style_destination:
32
- short: n
33
- long: style-destination
34
- parameter: true
35
- description: "Specify a destination directory for stylesheets, or nil to link in place"
36
-
37
- global:
38
- short: G
39
- long: global
40
- parameter: false
41
- description: "Specify config changes on a global level"
42
-
43
- user:
44
- short: U
45
- long: user
46
- parameter: false
47
- description: "Specify config changes on a user-wide level"
48
-
49
- local:
50
- short: L
51
- long: local
52
- parameter: false
53
- description: "Specify config changes on a project-specific level"
54
-
55
- force:
56
- short: f
57
- long: force
58
- parameter: false
59
- description: "Force file overwrite without prompt"
60
-
61
- verbose:
62
- short: v
63
- long: verbose
64
- parameter: false
65
- description: "Verbose output"
66
-
67
- simulation:
68
- short: S
69
- long: simulation
70
- parameter: false
71
- description: "Simulate transformation without actually creating files"
@@ -1,144 +0,0 @@
1
- @import '../reset.css'
2
-
3
- body
4
- font-family: Georgia, serif
5
-
6
- h1, h2
7
- line-height: 1.3
8
-
9
- h2, h3, h4, h5, h6
10
- line-height: $screen_line_height
11
-
12
- h1, h2, h3, h4, h5, h6
13
- font-weight: normal
14
-
15
- h1
16
- font-size: $screen_font_size * 1.5
17
- margin-top: $screen_unit
18
- margin-bottom: $screen_unit
19
-
20
- h2
21
- font-size: $screen_font_size * 1.2
22
- margin-top: $screen_unit
23
- margin-bottom: $screen_unit
24
-
25
- h3
26
- font-size: $screen_font_size * 1.1
27
- margin-top: $screen_unit * 3/2
28
- margin-bottom: $screen_unit * 1/2
29
-
30
- h4
31
- font-size: $screen_font_size * 1.05
32
- margin-top: $screen_unit * 7/4
33
- margin-bottom: $screen_unit * 1/4
34
-
35
- h5, h6
36
- font-size: $screen_font_size * 1
37
- margin-top: $screen_unit * 7/8
38
- margin-bottom: $screen_unit * 1/8
39
-
40
- ul
41
- list-style-type: square
42
-
43
- ul
44
- list-style-type: circle
45
-
46
- ul, ol
47
- margin: ($screen_unit / 4) 0 0 ($screen_unit / 2)
48
- padding-left: $screen_unit * 1.2
49
-
50
- li
51
- p
52
- text-indent: 0 !important
53
-
54
- li+li
55
- margin-top: $screen_unit / 4
56
-
57
- p
58
- margin: ($screen_unit / 2) 0
59
-
60
- ul+p, ol+p, blockquote+p, pre+p
61
- text-indent: 0
62
-
63
- a
64
- &:link, &:visited, &:active
65
- color: $link_color
66
- text-decoration: none
67
- &:hover
68
- text-decoration: underline
69
-
70
- code
71
- font-family: Monaco, Menlo, Mensch, Consolas, Monotype, mono
72
- font-style: normal
73
-
74
- pre, blockquote
75
- display: block
76
- margin-left: $screen_unit
77
- margin-right: $screen_unit * 2
78
- padding: $screen_unit / 3 $screen_unit
79
- padding-left: $screen_unit * 3/4
80
- white-space: pre
81
-
82
- p
83
- margin: 0
84
- line-height: 1.35
85
-
86
- img
87
- display: block
88
-
89
- @media screen
90
- body
91
- font-size: $screen_font_size
92
- line-height: $screen_line_height
93
- background-color: #666
94
-
95
- #container
96
- display: block
97
- border: solid 1px #999
98
- width: 740px
99
- padding: 60px
100
- margin: ($screen_unit / 2) auto
101
- background-color: #fff
102
- box-sizing: border-box
103
- -moz-box-sizing: border-box
104
- -webkit-box-sizing: border-box
105
-
106
- code
107
- font-size: $screen_font_size * 7/8
108
-
109
- pre
110
- white-space: pre-wrap
111
- white-space: -moz-pre-wrap
112
- white-space: -o-pre-wrap
113
- word-wrap: break-word
114
-
115
- code
116
- font-size: $screen_font_size * 3/4
117
-
118
- @media print
119
- @page
120
- margin-left: 1in
121
- margin-right: 1in
122
- margin-top: 1in
123
- margin-bottom: 1in
124
-
125
- body
126
- font-size: $print_font_size
127
- line-height: $print_line_height
128
- width: auto
129
- margin: 0
130
- padding: 0
131
-
132
- code
133
- font-size: $print_font_size * 7/8
134
-
135
- pre
136
- code
137
- font-size: $print_font_size * 3/4
138
-
139
- h1, h2, h3, h4, h5, h6, li, blockquote
140
- page-break-inside: avoid
141
-
142
- p
143
- widows: 3
144
- orphans: 3
@@ -1,8 +0,0 @@
1
- !!!
2
- %html
3
- %head
4
- %link(rel='stylesheet' href=stylesheet)
5
- %style(type="text/css")= inline_styles
6
-
7
- %body
8
- #container= content
@@ -1,36 +0,0 @@
1
- $screen_font_size: 18px
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: Georgia, 'Hoefler Text', Garamond, FreeSerif, serif
15
-
16
- h1
17
- border-bottom: solid 2px #666
18
-
19
- h3
20
- font-style: italic
21
-
22
- h4
23
- font-variant: small-caps
24
-
25
- h5, h6
26
- font-weight: bold
27
-
28
- p+p
29
- text-indent: $screen_unit
30
-
31
- pre, blockquote
32
- font-size: $screen_font_size
33
- border-left: solid 2px #ddd
34
-
35
- blockquote
36
- font-style: italic
@@ -1,7 +0,0 @@
1
- !!!
2
- %html
3
- %head
4
- %link{ :rel => 'stylesheet', :href => stylesheet }
5
-
6
- %body
7
- #container= content
@@ -1,20 +0,0 @@
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
@@ -1,145 +0,0 @@
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%; }
@@ -1,7 +0,0 @@
1
- !!!
2
- %html
3
- %head
4
- %link{ :rel => 'stylesheet', :href => stylesheet }
5
-
6
- %body
7
- #container= content
@@ -1,24 +0,0 @@
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%
@@ -1,21 +0,0 @@
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"
@@ -1,23 +0,0 @@
1
- Feature: Publish ePub document
2
- As a writer
3
- I want to create an ePub document at the command line from plain text
4
- So that I can publish books from style-free text
5
-
6
- Background:
7
- Given a file named "content.md" with:
8
- """
9
- Chapter 1
10
- =========
11
-
12
- This is a test. It is theoretically formatted in
13
- the Markdown templating language.
14
-
15
- Chapter 2
16
- =========
17
-
18
- This is a second chapter.
19
- """
20
-
21
- Scenario: Publish document with defaults
22
- When I run `mint-epub publish content.md`
23
- Then a file named "content.epub" should exist
@@ -1,73 +0,0 @@
1
- Feature: Publish document with varying options at the command line
2
- As a writer
3
- I want to create a document at the command line from plain text
4
- So that I can view a typeset version in a web browser
5
-
6
- Background:
7
- Given a file named "content.md" with:
8
- """
9
- Header
10
- ======
11
-
12
- This is a test. It is theoretically formatted in
13
- the Markdown templating language.
14
- """
15
-
16
- And a file named "style.sass" with:
17
- """
18
- p
19
- margin: 0
20
- """
21
-
22
- And a file named "layout.haml" with:
23
- """
24
- %html
25
- %head
26
- %link(rel='stylesheet' href=stylesheet)
27
-
28
- %body
29
- #container= content
30
- """
31
-
32
- Scenario: Publish document with defaults
33
- When I run `mint publish content.md`
34
- Then a file named "content.md" should exist
35
- And a file named "content.html" should exist
36
-
37
- Scenario Outline: Publish document with named template, layout & style
38
- When I run `mint publish <template> <layout> <style> content.md`
39
- Then a file named "content.html" should exist
40
- And the file "content.html" should contain "This is a test"
41
- And a file named "<style file>" should exist
42
- And the file "content.html" should match /templates.*style.css/
43
- And the file "content.html" should contain "<style file>"
44
-
45
- Examples:
46
- | template | layout | style | style file |
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
-
51
- Scenario: Publish document with non-existent template
52
- When I run `mint publish -t nonexistent content.md`
53
- Then the stderr should contain "Template 'nonexistent' does not exist."
54
-
55
- Scenario: Publish document in directory
56
- When I run `mint publish content.md -d compiled`
57
- Then a file named "compiled/content.html" should exist
58
-
59
- Scenario: Publish document in subdirectory
60
- When I run `mint publish content.md -d compiled/chapter-1`
61
- Then a file named "compiled/chapter-1/content.html" should exist
62
-
63
- Scenario: Publish document with default style and explicit style destination
64
- When I run `mint publish content.md -n styles`
65
- Then a file named "styles/style.css" should exist
66
-
67
- Scenario: Publish document with hand-crafted style and explicit style destination
68
- When I run `mint publish content.md -n styles -s style.sass`
69
- Then a file named "styles/style.css" should exist
70
-
71
- Scenario: Publish document with hand-crafted layout
72
- When I run `mint publish content.md -l layout.haml`
73
- Then the file "content.html" should match /id=['"]container['"]/
@@ -1,15 +0,0 @@
1
- require "aruba/cucumber"
2
-
3
- Before do
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"
8
- end
9
-
10
- After do
11
- ENV["PATH"] = @original_path
12
- ENV["RUBYLIB"] = @original_rubylib
13
- ENV["MINT_NO_PIPE"] = nil
14
- FileUtils.rm_rf "tmp/aruba"
15
- end
@@ -1,79 +0,0 @@
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
- """