mint 0.8.1 → 0.10.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 (83) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -26
  3. data/README.md +117 -37
  4. data/bin/mint +2 -81
  5. data/config/templates/base/navigation.css +136 -0
  6. data/config/templates/base/print.css +152 -0
  7. data/config/templates/{reset.css → base/reset.css} +1 -1
  8. data/config/templates/base/style.css +117 -137
  9. data/config/templates/base/utilities.css +136 -0
  10. data/config/templates/base/variables.css +124 -0
  11. data/config/templates/basic/style.css +151 -0
  12. data/config/templates/default/layout.erb +33 -3
  13. data/config/templates/default/style.css +95 -164
  14. data/config/templates/magazine/style.css +383 -0
  15. data/config/templates/nord/style.css +105 -220
  16. data/config/templates/nord-dark/style.css +82 -263
  17. data/lib/mint/commandline/parse.rb +144 -0
  18. data/lib/mint/commandline/publish.rb +46 -0
  19. data/lib/mint/commandline/run.rb +30 -0
  20. data/lib/mint/config.rb +162 -0
  21. data/lib/mint/{css.rb → css_dsl.rb} +9 -9
  22. data/lib/mint/css_parser.rb +45 -25
  23. data/lib/mint/document.rb +250 -365
  24. data/lib/mint/document_tree.rb +163 -0
  25. data/lib/mint/exceptions.rb +2 -3
  26. data/lib/mint/helpers.rb +23 -180
  27. data/lib/mint/layout.rb +26 -9
  28. data/lib/mint/renderers/css_renderer.rb +32 -0
  29. data/lib/mint/renderers/erb_renderer.rb +11 -0
  30. data/lib/mint/renderers/markdown_renderer.rb +45 -0
  31. data/lib/mint/style.rb +21 -31
  32. data/lib/mint/template.rb +30 -0
  33. data/lib/mint/version.rb +1 -1
  34. data/lib/mint/workspace.rb +171 -0
  35. data/lib/mint.rb +44 -12
  36. data/man/mint.1 +85 -44
  37. data/spec/cli/README.md +2 -2
  38. data/spec/cli/argument_parsing_spec.rb +89 -147
  39. data/spec/cli/bin_integration_spec.rb +23 -243
  40. data/spec/cli/full_workflow_integration_spec.rb +99 -442
  41. data/spec/cli/original_style_integration_spec.rb +58 -0
  42. data/spec/cli/publish_workflow_spec.rb +72 -70
  43. data/spec/commandline_path_integration_spec.rb +230 -0
  44. data/spec/config_file_integration_spec.rb +362 -0
  45. data/spec/{css_spec.rb → css_dsl_spec.rb} +7 -3
  46. data/spec/css_parser_spec.rb +59 -1
  47. data/spec/document_spec.rb +37 -242
  48. data/spec/flattened_path_spec.rb +150 -0
  49. data/spec/layout_spec.rb +42 -3
  50. data/spec/mint_spec.rb +22 -217
  51. data/spec/path_handling_spec.rb +237 -0
  52. data/spec/run_cli_tests.rb +1 -1
  53. data/spec/spec_helper.rb +3 -10
  54. data/spec/style_spec.rb +31 -56
  55. data/spec/support/cli_helpers.rb +7 -10
  56. data/spec/support/matchers.rb +1 -1
  57. data/spec/template_spec.rb +31 -0
  58. data/spec/workspace_spec.rb +177 -0
  59. metadata +75 -89
  60. data/bin/mint-epub +0 -20
  61. data/config/templates/garden/layout.erb +0 -38
  62. data/config/templates/garden/style.css +0 -303
  63. data/config/templates/nord/layout.erb +0 -11
  64. data/config/templates/nord-dark/layout.erb +0 -11
  65. data/config/templates/zen/layout.erb +0 -11
  66. data/config/templates/zen/style.css +0 -114
  67. data/lib/mint/command_line.rb +0 -360
  68. data/lib/mint/css_template.rb +0 -37
  69. data/lib/mint/markdown_template.rb +0 -47
  70. data/lib/mint/mint.rb +0 -313
  71. data/lib/mint/plugin.rb +0 -136
  72. data/lib/mint/plugins/epub.rb +0 -293
  73. data/lib/mint/resource.rb +0 -101
  74. data/plugins/templates/epub/layouts/container.haml +0 -5
  75. data/plugins/templates/epub/layouts/content.haml +0 -35
  76. data/plugins/templates/epub/layouts/layout.haml +0 -6
  77. data/plugins/templates/epub/layouts/title.haml +0 -11
  78. data/plugins/templates/epub/layouts/toc.haml +0 -26
  79. data/spec/cli/configuration_management_spec.rb +0 -363
  80. data/spec/cli/template_management_spec.rb +0 -300
  81. data/spec/helpers_spec.rb +0 -249
  82. data/spec/plugin_spec.rb +0 -449
  83. data/spec/resource_spec.rb +0 -135
@@ -1,135 +0,0 @@
1
- require "spec_helper"
2
-
3
- module Mint
4
- describe Resource do
5
- before do
6
- @tmp_dir = Dir.getwd
7
- @alternative_root = "#{@tmp_dir}/alternative-root"
8
- @full_content_file = "#{@tmp_dir}/#{@content_file}"
9
- @full_alt_content_file = "#{@alternative_root}/#{@content_file}"
10
- end
11
-
12
- shared_examples_for "all resources" do
13
- subject { resource }
14
-
15
- its(:root_directory_path) { should be_path(resource.root_directory) }
16
- its(:source_file_path) { should be_path(resource.source_file) }
17
- its(:source_directory_path) { should be_path(resource.source_directory) }
18
- its(:destination_file_path) { should be_path(resource.destination_file) }
19
- its(:destination_directory_path) do
20
- should be_path(resource.destination_directory)
21
- end
22
- end
23
-
24
- context "when created with a relative path and no root" do
25
- let(:resource) { Resource.new @content_file }
26
- subject { resource }
27
-
28
- its(:name) { should == "content.html" }
29
- its(:root) { should == @tmp_dir }
30
- its(:source) { should == @content_file }
31
- its(:source_file) { should == @full_content_file }
32
- its(:source_directory) { should == @tmp_dir }
33
- its(:destination) { should be_nil }
34
- its(:destination_file) { should == "#{@tmp_dir}/content.html" }
35
- its(:destination_directory) { should == @tmp_dir }
36
-
37
- it_should_behave_like "all resources"
38
- end
39
-
40
- # TODO: This is wrong, need to rework this -- probably build slightly
41
- # more comprehensive system in spec_helper for these edge cases,
42
- # then build up compound variables in before block for this particular
43
- # spec (which has more edge cases than most)
44
- context "when created with a relative path and absolute root" do
45
- let(:resource) { Resource.new @content_file, :root => @alternative_root }
46
- subject { resource }
47
-
48
- its(:name) { should == "content.html" }
49
- its(:root) { should == @alternative_root }
50
- its(:source) { should == @content_file }
51
- its(:source_file) { should == @full_alt_content_file }
52
- its(:source_directory) { should == @alternative_root }
53
- its(:destination) { should be_nil }
54
- its(:destination_file) { should == "#{@alternative_root}/content.html" }
55
- its(:destination_directory) { should == @alternative_root }
56
-
57
- it_should_behave_like "all resources"
58
- end
59
-
60
- context "when created with an absolute path, no root" do
61
- before do
62
- # This is a use case we will only ever test here, so
63
- # I'm not going to include it in the spec_helper
64
- FileUtils.mkdir_p @alternative_root
65
- File.open(@full_alt_content_file, "w") do |f|
66
- f << @content
67
- end
68
- end
69
-
70
- let(:resource) { Resource.new @full_alt_content_file }
71
- subject { resource }
72
-
73
- its(:name) { should == "content.html" }
74
- its(:root) { should == @alternative_root }
75
- its(:source) { should == @full_alt_content_file }
76
- its(:source_file) { should == @full_alt_content_file}
77
- its(:source_directory) { should == @alternative_root }
78
- its(:destination) { should be_nil }
79
- its(:destination_file) { should == "#{@alternative_root}/content.html" }
80
- its(:destination_directory) { should == @alternative_root }
81
-
82
- it_should_behave_like "all resources"
83
- end
84
-
85
- # The root should *not* override a source file absolute path but
86
- # *should* affect the destination file path.
87
- # I should also test this when neither the source nor the root
88
- # are in Dir.getwd, which is the default root.
89
- context "when created with an absolute path and root" do
90
- let(:resource) { Resource.new @full_content_file,
91
- :root => @alternative_root }
92
-
93
- subject { resource }
94
-
95
- its(:name) { should == "content.html" }
96
- its(:root) { should == @alternative_root }
97
- its(:source) { should == @full_content_file }
98
- its(:source_file) { should == @full_content_file }
99
- its(:source_directory) { should == @tmp_dir }
100
- its(:destination) { should be_nil }
101
- its(:destination_file) { should == "#{@alternative_root}/content.html" }
102
- its(:destination_directory) { should == @alternative_root }
103
-
104
- it_should_behave_like "all resources"
105
- end
106
-
107
- context "when it's created with a block" do
108
- let(:resource) do
109
- Resource.new @content_file do |resource|
110
- resource.root = @alternative_root
111
- resource.destination = "destination"
112
- end
113
- end
114
-
115
- subject { resource }
116
-
117
- its(:name) { should == "content.html" }
118
- its(:root) { should == @alternative_root }
119
- its(:source) { should == @content_file }
120
- its(:source_file) { should == @full_alt_content_file }
121
- its(:source_directory) { should == @alternative_root }
122
- its(:destination) { should == "destination" }
123
-
124
- its(:destination_file) do
125
- should == "#{@alternative_root}/destination/content.html"
126
- end
127
-
128
- its(:destination_directory) do
129
- should == "#{@alternative_root}/destination"
130
- end
131
-
132
- it_should_behave_like "all resources"
133
- end
134
- end
135
- end