mango 0.5.4 → 0.6.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.
- data/.gitignore +1 -2
- data/.rvmrc +1 -0
- data/.yardopts +1 -3
- data/{CHANGES.mdown → CHANGES.md} +40 -0
- data/Gemfile.lock +35 -23
- data/LICENSE +1 -1
- data/{README.mdown → README.md} +38 -27
- data/Rakefile +0 -13
- data/lib/mango.rb +5 -0
- data/lib/mango/application.rb +361 -129
- data/lib/mango/content_page.rb +89 -115
- data/lib/mango/core_ext/string.rb +16 -0
- data/lib/mango/core_ext/uri.rb +14 -0
- data/lib/mango/dependencies.rb +5 -4
- data/lib/mango/flavored_markdown.rb +7 -0
- data/lib/mango/rack/debugger.rb +20 -0
- data/lib/mango/runner.rb +33 -50
- data/lib/mango/templates/.gitignore +0 -1
- data/lib/mango/templates/Gemfile +1 -1
- data/lib/mango/templates/content/index.erb +6 -0
- data/lib/mango/templates/themes/default/javascripts/timer.coffee +6 -0
- data/lib/mango/templates/themes/default/public/javascripts/fireworks.js +0 -0
- data/lib/mango/templates/themes/default/public/{styles → stylesheets}/fireworks.css +0 -0
- data/lib/mango/templates/themes/default/public/{styles → stylesheets}/reset.css +0 -2
- data/lib/mango/templates/themes/default/{styles → stylesheets}/screen.sass +0 -2
- data/lib/mango/templates/themes/default/views/layout.haml +5 -5
- data/lib/mango/templates/themes/default/views/page.haml +1 -3
- data/lib/mango/version.rb +1 -1
- data/mango.gemspec +12 -10
- data/spec/fixture/content/engines/erb.erb +7 -0
- data/spec/fixture/content/engines/haml.haml +4 -4
- data/spec/fixture/content/engines/liquid.liquid +7 -0
- data/spec/fixture/content/engines/markdown.markdown +0 -6
- data/spec/fixture/content/engines/md.md +0 -6
- data/spec/fixture/content/engines/mkd.mkd +1 -0
- data/spec/fixture/content/page_with_missing_view.haml +2 -2
- data/spec/fixture/content/page_with_unregistered_view.haml +4 -0
- data/spec/fixture/content/view_engines/erb.haml +4 -0
- data/spec/fixture/content/view_engines/liquid.haml +4 -0
- data/spec/fixture/themes/default/javascripts/override.coffee +1 -0
- data/spec/fixture/themes/default/javascripts/siblings.coffee +7 -0
- data/spec/fixture/themes/default/javascripts/songs/happy.coffee +5 -0
- data/spec/fixture/themes/default/public/404.html +11 -0
- data/spec/fixture/themes/default/public/javascripts/econ.js +8 -0
- data/spec/fixture/themes/default/public/javascripts/math/opposite.js +6 -0
- data/spec/fixture/themes/default/public/javascripts/override.js +1 -0
- data/spec/fixture/themes/default/public/root.js +5 -0
- data/spec/fixture/themes/default/public/{styles → stylesheets}/override.css +0 -0
- data/spec/fixture/themes/default/public/{styles → stylesheets}/reset.css +0 -0
- data/spec/fixture/themes/default/public/{styles → stylesheets}/subfolder/another.css +0 -0
- data/spec/fixture/themes/default/security_hole.js +1 -0
- data/spec/fixture/themes/default/{styles → stylesheets}/override.sass +0 -0
- data/spec/fixture/themes/default/{styles/screen.sass → stylesheets/sass.sass} +4 -2
- data/spec/fixture/themes/default/stylesheets/scss.scss +19 -0
- data/spec/fixture/themes/default/{styles → stylesheets}/subfolder/screen.sass +0 -2
- data/spec/fixture/themes/default/views/404.erb +11 -0
- data/spec/fixture/themes/default/views/404.haml +1 -0
- data/spec/fixture/themes/default/views/404.liquid +11 -0
- data/spec/fixture/themes/default/views/layout.erb +10 -0
- data/spec/fixture/themes/default/views/layout.haml +1 -1
- data/spec/fixture/themes/default/views/layout.liquid +10 -0
- data/spec/fixture/themes/default/views/page.erb +7 -0
- data/spec/fixture/themes/default/views/page.haml +3 -1
- data/spec/fixture/themes/default/views/page.liquid +7 -0
- data/spec/lib/application/routing_content_pages_spec.rb +298 -21
- data/spec/lib/application/routing_javascript_templates_spec.rb +278 -0
- data/spec/lib/application/routing_not_found_spec.rb +254 -0
- data/spec/lib/application/routing_public_files_spec.rb +9 -8
- data/spec/lib/application/{routing_style_sheets_spec.rb → routing_stylesheet_templates_spec.rb} +61 -24
- data/spec/lib/application_spec.rb +31 -2
- data/spec/lib/content_page/initializing_spec.rb +399 -126
- data/spec/lib/content_page_spec.rb +23 -19
- data/spec/lib/core_ext/string_spec.rb +12 -0
- data/spec/lib/core_ext/uri_spec.rb +42 -0
- data/spec/lib/dependencies_spec.rb +0 -1
- data/spec/lib/flavored_markdown_spec.rb +18 -3
- data/spec/lib/runner_spec.rb +40 -39
- data/spec/lib/version_spec.rb +4 -4
- metadata +145 -64
- data/lib/mango/templates/content/index.md +0 -5
- data/lib/mango/templates/themes/default/public/javascripts/timer.js +0 -5
- data/spec/fixture/content/engines/mdown.mdown +0 -7
- data/spec/lib/content_page/finding_spec.rb +0 -213
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
# encoding: UTF-8
|
|
2
|
-
require "spec_helper"
|
|
3
|
-
|
|
4
|
-
describe Mango::ContentPage do
|
|
5
|
-
|
|
6
|
-
#################################################################################################
|
|
7
|
-
|
|
8
|
-
describe "finding app_root/content/engines/haml.haml" do
|
|
9
|
-
before(:all) do
|
|
10
|
-
path = FIXTURE_ROOT + "content/engines/haml"
|
|
11
|
-
@page = Mango::ContentPage.find_by_path(path)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
it "is an instance of Mango::ContentPage" do
|
|
15
|
-
@page.should be_instance_of(Mango::ContentPage)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it "saves the data" do
|
|
19
|
-
@page.data.should == <<-EOS
|
|
20
|
-
---
|
|
21
|
-
title: Haml!
|
|
22
|
-
category:
|
|
23
|
-
- content
|
|
24
|
-
- engine
|
|
25
|
-
---
|
|
26
|
-
%p /engines/haml.haml
|
|
27
|
-
EOS
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
it "detects the content engine" do
|
|
31
|
-
@page.content_engine.should == :haml
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
it "loads the attributes" do
|
|
35
|
-
@page.attributes.should have(3).items
|
|
36
|
-
@page.attributes.should include("title" => "Haml!",)
|
|
37
|
-
@page.attributes.should include("category" => ["content", "engine"])
|
|
38
|
-
@page.attributes.should include("view" => :page)
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
it "loads the body" do
|
|
42
|
-
@page.body.should == "%p /engines/haml.haml\n"
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
it "converts to HTML" do
|
|
46
|
-
@page.to_html.should == "<p>/engines/haml.haml</p>\n"
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
it "determines the view template's base file name" do
|
|
50
|
-
@page.view.should == :page
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
#################################################################################################
|
|
55
|
-
|
|
56
|
-
describe "finding app_root/content/engines/md.md" do
|
|
57
|
-
before(:all) do
|
|
58
|
-
path = FIXTURE_ROOT + "content/engines/md"
|
|
59
|
-
@page = Mango::ContentPage.find_by_path(path)
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
it "is an instance of Mango::ContentPage" do
|
|
63
|
-
@page.should be_instance_of(Mango::ContentPage)
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
it "saves the data" do
|
|
67
|
-
@page.data.should == <<-EOS
|
|
68
|
-
---
|
|
69
|
-
title: Markdown!
|
|
70
|
-
category:
|
|
71
|
-
- content
|
|
72
|
-
- engine
|
|
73
|
-
---
|
|
74
|
-
### /engines/md.md
|
|
75
|
-
EOS
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
it "detects the content engine" do
|
|
79
|
-
@page.content_engine.should == :markdown
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
it "loads the attributes" do
|
|
83
|
-
@page.attributes.should have(3).items
|
|
84
|
-
@page.attributes.should include("title" => "Markdown!",)
|
|
85
|
-
@page.attributes.should include("category" => ["content", "engine"])
|
|
86
|
-
@page.attributes.should include("view" => :page)
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
it "loads the body" do
|
|
90
|
-
@page.body.should == "### /engines/md.md\n"
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
it "converts to HTML" do
|
|
94
|
-
@page.to_html.should == "<h3>/engines/md.md</h3>"
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
it "determines the view template's base file name" do
|
|
98
|
-
@page.view.should == :page
|
|
99
|
-
end
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
#################################################################################################
|
|
103
|
-
|
|
104
|
-
describe "finding app_root/content/engines/mdown.mdown" do
|
|
105
|
-
before(:all) do
|
|
106
|
-
path = FIXTURE_ROOT + "content/engines/mdown"
|
|
107
|
-
@page = Mango::ContentPage.find_by_path(path)
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
it "is an instance of Mango::ContentPage" do
|
|
111
|
-
@page.should be_instance_of(Mango::ContentPage)
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
it "saves the data" do
|
|
115
|
-
@page.data.should == <<-EOS
|
|
116
|
-
---
|
|
117
|
-
title: Markdown!
|
|
118
|
-
category:
|
|
119
|
-
- content
|
|
120
|
-
- engine
|
|
121
|
-
---
|
|
122
|
-
### /engines/mdown.mdown
|
|
123
|
-
EOS
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
it "detects the content engine" do
|
|
127
|
-
@page.content_engine.should == :markdown
|
|
128
|
-
end
|
|
129
|
-
|
|
130
|
-
it "loads the attributes" do
|
|
131
|
-
@page.attributes.should have(3).items
|
|
132
|
-
@page.attributes.should include("title" => "Markdown!",)
|
|
133
|
-
@page.attributes.should include("category" => ["content", "engine"])
|
|
134
|
-
@page.attributes.should include("view" => :page)
|
|
135
|
-
end
|
|
136
|
-
|
|
137
|
-
it "loads the body" do
|
|
138
|
-
@page.body.should == "### /engines/mdown.mdown\n"
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
it "converts to HTML" do
|
|
142
|
-
@page.to_html.should == "<h3>/engines/mdown.mdown</h3>"
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
it "determines the view template's base file name" do
|
|
146
|
-
@page.view.should == :page
|
|
147
|
-
end
|
|
148
|
-
end
|
|
149
|
-
|
|
150
|
-
#################################################################################################
|
|
151
|
-
|
|
152
|
-
describe "finding app_root/content/engines/markdown.markdown" do
|
|
153
|
-
before(:all) do
|
|
154
|
-
path = FIXTURE_ROOT + "content/engines/markdown"
|
|
155
|
-
@page = Mango::ContentPage.find_by_path(path)
|
|
156
|
-
end
|
|
157
|
-
|
|
158
|
-
it "is an instance of Mango::ContentPage" do
|
|
159
|
-
@page.should be_instance_of(Mango::ContentPage)
|
|
160
|
-
end
|
|
161
|
-
|
|
162
|
-
it "saves the data" do
|
|
163
|
-
@page.data.should == <<-EOS
|
|
164
|
-
---
|
|
165
|
-
title: Markdown!
|
|
166
|
-
category:
|
|
167
|
-
- content
|
|
168
|
-
- engine
|
|
169
|
-
---
|
|
170
|
-
### /engines/markdown.markdown
|
|
171
|
-
EOS
|
|
172
|
-
end
|
|
173
|
-
|
|
174
|
-
it "detects the content engine" do
|
|
175
|
-
@page.content_engine.should == :markdown
|
|
176
|
-
end
|
|
177
|
-
|
|
178
|
-
it "loads the attributes" do
|
|
179
|
-
@page.attributes.should have(3).items
|
|
180
|
-
@page.attributes.should include("title" => "Markdown!",)
|
|
181
|
-
@page.attributes.should include("category" => ["content", "engine"])
|
|
182
|
-
@page.attributes.should include("view" => :page)
|
|
183
|
-
end
|
|
184
|
-
|
|
185
|
-
it "loads the body" do
|
|
186
|
-
@page.body.should == "### /engines/markdown.markdown\n"
|
|
187
|
-
end
|
|
188
|
-
|
|
189
|
-
it "converts to HTML" do
|
|
190
|
-
@page.to_html.should == "<h3>/engines/markdown.markdown</h3>"
|
|
191
|
-
end
|
|
192
|
-
|
|
193
|
-
it "determines the view template's base file name" do
|
|
194
|
-
@page.view.should == :page
|
|
195
|
-
end
|
|
196
|
-
end
|
|
197
|
-
|
|
198
|
-
#################################################################################################
|
|
199
|
-
|
|
200
|
-
describe "finding app_root/content/unknown.anyengine" do
|
|
201
|
-
before(:all) do
|
|
202
|
-
@path = FIXTURE_ROOT + "content/unknown"
|
|
203
|
-
end
|
|
204
|
-
|
|
205
|
-
it "raises Mango::ContentPage::PageNotFound" do
|
|
206
|
-
expected_message = "Unable to find content page for path -- #{@path}"
|
|
207
|
-
lambda {
|
|
208
|
-
Mango::ContentPage.find_by_path(@path)
|
|
209
|
-
}.should raise_exception(Mango::ContentPage::PageNotFound, expected_message)
|
|
210
|
-
end
|
|
211
|
-
end
|
|
212
|
-
|
|
213
|
-
end
|