mango 0.5.0.beta1 → 0.5.0.beta2
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/.rspec +1 -0
- data/.yardopts +1 -2
- data/{doc/HISTORY.mdown → CHANGES.mdown} +31 -7
- data/README.mdown +33 -21
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/lib/mango/application.rb +4 -0
- data/lib/mango/dependencies.rb +6 -6
- data/lib/mango/runner.rb +1 -0
- data/lib/mango/templates/.gitignore +3 -0
- data/lib/mango/templates/Gemfile +1 -1
- data/lib/mango/templates/config.ru +0 -1
- data/lib/mango/version.rb +1 -1
- data/mango.gemspec +8 -8
- data/spec/mango/application/routing_content_pages_spec.rb +31 -31
- data/spec/mango/application/routing_public_files_spec.rb +18 -18
- data/spec/mango/application/routing_style_sheets_spec.rb +27 -27
- data/spec/mango/content_page/finding_spec.rb +29 -29
- data/spec/mango/content_page/initializing_spec.rb +45 -46
- data/spec/mango/content_page_spec.rb +4 -4
- data/spec/mango/dependencies_spec.rb +22 -22
- data/spec/mango/flavored_markdown_spec.rb +8 -8
- data/spec/mango/rack/debugger_spec.rb +15 -17
- data/spec/mango/version_spec.rb +3 -3
- data/spec/quality_spec.rb +2 -2
- data/spec/spec_helper.rb +3 -3
- metadata +32 -33
- data/doc/ROAD-MAP.mdown +0 -10
- data/spec/spec.opts +0 -3
@@ -18,29 +18,29 @@ EOS
|
|
18
18
|
@page = Mango::ContentPage.new(@expected_data, :content_engine => @expected_content_engine)
|
19
19
|
end
|
20
20
|
|
21
|
-
it "
|
21
|
+
it "saves the data" do
|
22
22
|
@page.data.should == @expected_data
|
23
23
|
end
|
24
24
|
|
25
|
-
it "
|
25
|
+
it "uses default content engine" do
|
26
26
|
@page.content_engine.should == @expected_content_engine
|
27
27
|
end
|
28
28
|
|
29
|
-
it "
|
29
|
+
it "loads the attributes" do
|
30
30
|
@page.attributes.should have(2).items
|
31
31
|
@page.attributes.should include("title" => "Delicious Cake!")
|
32
32
|
@page.attributes.should include("view" => "blog")
|
33
33
|
end
|
34
34
|
|
35
|
-
it "
|
35
|
+
it "loads the body" do
|
36
36
|
@page.body.should == "%p So delicious!\n"
|
37
37
|
end
|
38
38
|
|
39
|
-
it "
|
39
|
+
it "converts to HTML" do
|
40
40
|
@page.to_html.should == "<p>So delicious!</p>\n"
|
41
41
|
end
|
42
42
|
|
43
|
-
it "
|
43
|
+
it "determines the view template's base file name" do
|
44
44
|
@page.view.should == :blog
|
45
45
|
end
|
46
46
|
end
|
@@ -60,29 +60,29 @@ EOS
|
|
60
60
|
@page = Mango::ContentPage.new(@expected_data, :content_engine => @expected_content_engine)
|
61
61
|
end
|
62
62
|
|
63
|
-
it "
|
63
|
+
it "saves the data" do
|
64
64
|
@page.data.should == @expected_data
|
65
65
|
end
|
66
66
|
|
67
|
-
it "
|
67
|
+
it "uses default content engine" do
|
68
68
|
@page.content_engine.should == @expected_content_engine
|
69
69
|
end
|
70
70
|
|
71
|
-
it "
|
71
|
+
it "loads the attributes" do
|
72
72
|
@page.attributes.should have(2).items
|
73
73
|
@page.attributes.should include("title" => "Chocolate Pie!")
|
74
74
|
@page.attributes.should include("view" => "blog")
|
75
75
|
end
|
76
76
|
|
77
|
-
it "
|
77
|
+
it "loads the body" do
|
78
78
|
@page.body.should == "### Sweet and crumbly!\n"
|
79
79
|
end
|
80
80
|
|
81
|
-
it "
|
81
|
+
it "converts to HTML" do
|
82
82
|
@page.to_html.should == "<h3>Sweet and crumbly!</h3>"
|
83
83
|
end
|
84
84
|
|
85
|
-
it "
|
85
|
+
it "determines the view template's base file name" do
|
86
86
|
@page.view.should == :blog
|
87
87
|
end
|
88
88
|
end
|
@@ -100,29 +100,29 @@ EOS
|
|
100
100
|
@page = Mango::ContentPage.new(@expected_data)
|
101
101
|
end
|
102
102
|
|
103
|
-
it "
|
103
|
+
it "saves the data" do
|
104
104
|
@page.data.should == @expected_data
|
105
105
|
end
|
106
106
|
|
107
|
-
it "
|
107
|
+
it "uses default content engine" do
|
108
108
|
@page.content_engine.should == Mango::ContentPage::DEFAULT[:content_engine]
|
109
109
|
end
|
110
110
|
|
111
|
-
it "
|
111
|
+
it "loads the attributes" do
|
112
112
|
@page.attributes.should have(2).items
|
113
113
|
@page.attributes.should include("title" => "Delicious Cake!")
|
114
114
|
@page.attributes.should include("view" => "blog.haml")
|
115
115
|
end
|
116
116
|
|
117
|
-
it "
|
117
|
+
it "loads the body" do
|
118
118
|
@page.body.should be_empty
|
119
119
|
end
|
120
120
|
|
121
|
-
it "
|
121
|
+
it "converts to HTML" do
|
122
122
|
@page.to_html.should be_empty
|
123
123
|
end
|
124
124
|
|
125
|
-
it "
|
125
|
+
it "determines the view template's base file name" do
|
126
126
|
@page.view.should == :blog
|
127
127
|
end
|
128
128
|
end
|
@@ -137,28 +137,28 @@ EOS
|
|
137
137
|
@page = Mango::ContentPage.new(@expected_data)
|
138
138
|
end
|
139
139
|
|
140
|
-
it "
|
140
|
+
it "saves the data" do
|
141
141
|
@page.data.should == @expected_data
|
142
142
|
end
|
143
143
|
|
144
|
-
it "
|
144
|
+
it "uses default content engine" do
|
145
145
|
@page.content_engine.should == Mango::ContentPage::DEFAULT[:content_engine]
|
146
146
|
end
|
147
147
|
|
148
|
-
it "
|
148
|
+
it "loads the attributes" do
|
149
149
|
@page.attributes.should have(1).items
|
150
150
|
@page.attributes.should include("view" => :page)
|
151
151
|
end
|
152
152
|
|
153
|
-
it "
|
153
|
+
it "loads the body" do
|
154
154
|
@page.body.should == "### So delicious!\n"
|
155
155
|
end
|
156
156
|
|
157
|
-
it "
|
157
|
+
it "converts to HTML" do
|
158
158
|
@page.to_html.should == "<h3>So delicious!</h3>"
|
159
159
|
end
|
160
160
|
|
161
|
-
it "
|
161
|
+
it "determines the view template's base file name" do
|
162
162
|
@page.view.should == :page
|
163
163
|
end
|
164
164
|
end
|
@@ -174,28 +174,28 @@ EOS
|
|
174
174
|
@page = Mango::ContentPage.new(@expected_data)
|
175
175
|
end
|
176
176
|
|
177
|
-
it "
|
177
|
+
it "saves the data" do
|
178
178
|
@page.data.should == @expected_data
|
179
179
|
end
|
180
180
|
|
181
|
-
it "
|
181
|
+
it "uses default content engine" do
|
182
182
|
@page.content_engine.should == Mango::ContentPage::DEFAULT[:content_engine]
|
183
183
|
end
|
184
184
|
|
185
|
-
it "
|
185
|
+
it "loads the attributes" do
|
186
186
|
@page.attributes.should have(1).items
|
187
187
|
@page.attributes.should include("view" => :page)
|
188
188
|
end
|
189
189
|
|
190
|
-
it "
|
190
|
+
it "loads the body" do
|
191
191
|
@page.body.should be_empty
|
192
192
|
end
|
193
193
|
|
194
|
-
it "
|
194
|
+
it "converts to HTML" do
|
195
195
|
@page.to_html.should be_empty
|
196
196
|
end
|
197
197
|
|
198
|
-
it "
|
198
|
+
it "determines the view template's base file name" do
|
199
199
|
@page.view.should == :page
|
200
200
|
end
|
201
201
|
end
|
@@ -208,28 +208,28 @@ EOS
|
|
208
208
|
@page = Mango::ContentPage.new(@expected_data)
|
209
209
|
end
|
210
210
|
|
211
|
-
it "
|
211
|
+
it "saves the data" do
|
212
212
|
@page.data.should == @expected_data
|
213
213
|
end
|
214
214
|
|
215
|
-
it "
|
215
|
+
it "uses default content engine" do
|
216
216
|
@page.content_engine.should == Mango::ContentPage::DEFAULT[:content_engine]
|
217
217
|
end
|
218
218
|
|
219
|
-
it "
|
219
|
+
it "loads the attributes" do
|
220
220
|
@page.attributes.should have(1).items
|
221
221
|
@page.attributes.should include("view" => :page)
|
222
222
|
end
|
223
223
|
|
224
|
-
it "
|
224
|
+
it "loads the body" do
|
225
225
|
@page.body.should be_empty
|
226
226
|
end
|
227
227
|
|
228
|
-
it "
|
228
|
+
it "converts to HTML" do
|
229
229
|
@page.to_html.should be_empty
|
230
230
|
end
|
231
231
|
|
232
|
-
it "
|
232
|
+
it "determines the view template's base file name" do
|
233
233
|
@page.view.should == :page
|
234
234
|
end
|
235
235
|
end
|
@@ -243,28 +243,28 @@ EOS
|
|
243
243
|
@page = Mango::ContentPage.new(@expected_data, :content_engine => @expected_content_engine)
|
244
244
|
end
|
245
245
|
|
246
|
-
it "
|
246
|
+
it "saves the data" do
|
247
247
|
@page.data.should == @expected_data
|
248
248
|
end
|
249
249
|
|
250
|
-
it "
|
250
|
+
it "uses unknown content engine" do
|
251
251
|
@page.content_engine.should == @expected_content_engine
|
252
252
|
end
|
253
253
|
|
254
|
-
it "
|
254
|
+
it "loads the attributes" do
|
255
255
|
@page.attributes.should have(1).items
|
256
256
|
@page.attributes.should include("view" => :page)
|
257
257
|
end
|
258
258
|
|
259
|
-
it "
|
259
|
+
it "loads the body" do
|
260
260
|
@page.body.should be_empty
|
261
261
|
end
|
262
262
|
|
263
|
-
it "
|
264
|
-
lambda { @page.to_html }.should raise_exception("Unknown content engine -- unknown")
|
263
|
+
it "raises a RuntimeError when converting to HTML" do
|
264
|
+
lambda { @page.to_html }.should raise_exception(RuntimeError,"Unknown content engine -- unknown")
|
265
265
|
end
|
266
266
|
|
267
|
-
it "
|
267
|
+
it "determines the view template's base file name" do
|
268
268
|
@page.view.should == :page
|
269
269
|
end
|
270
270
|
end
|
@@ -272,7 +272,7 @@ EOS
|
|
272
272
|
#################################################################################################
|
273
273
|
|
274
274
|
describe "initializing with seasonable Markdown body" do
|
275
|
-
it "
|
275
|
+
it "seasons the rendered markup with Mango::FlavoredMarkdown" do
|
276
276
|
data = <<-EOS
|
277
277
|
Mango is like a drug.
|
278
278
|
You must have more_and_more and more of the Mango
|
@@ -286,8 +286,7 @@ Not even for Mango!
|
|
286
286
|
<p>Mango is like a drug.<br/>
|
287
287
|
You must have more_and_more and more of the Mango<br/>
|
288
288
|
until there is no Mango left.<br/>
|
289
|
-
Not even for Mango
|
290
|
-
</p>
|
289
|
+
Not even for Mango!</p>
|
291
290
|
EOS
|
292
291
|
|
293
292
|
page.to_html.should == expected.strip
|
@@ -6,13 +6,13 @@ describe Mango::ContentPage do
|
|
6
6
|
#################################################################################################
|
7
7
|
|
8
8
|
describe "class constants" do
|
9
|
-
it "
|
9
|
+
it "defines CONTENT_ENGINES" do
|
10
10
|
Mango::ContentPage::CONTENT_ENGINES.should have(2).item
|
11
11
|
Mango::ContentPage::CONTENT_ENGINES.should include(:haml => ["haml"])
|
12
12
|
Mango::ContentPage::CONTENT_ENGINES.should include(:markdown => ["md", "mdown", "markdown"])
|
13
13
|
end
|
14
14
|
|
15
|
-
it "
|
15
|
+
it "defines DEFAULT" do
|
16
16
|
Mango::ContentPage::DEFAULT.should have(3).items
|
17
17
|
Mango::ContentPage::DEFAULT.should include(:body => "")
|
18
18
|
Mango::ContentPage::DEFAULT.should include(:content_engine => :markdown)
|
@@ -33,10 +33,10 @@ title: Syntactic Sugar Makes Life Sweeter
|
|
33
33
|
EOS
|
34
34
|
end
|
35
35
|
|
36
|
-
it "
|
36
|
+
it "makes the title sweeter" do
|
37
37
|
@page.title.should == @page.attributes["title"]
|
38
38
|
end
|
39
|
-
it "
|
39
|
+
it "doesn't make unknown sweeter" do
|
40
40
|
lambda { @page.unknown }.should raise_exception(NoMethodError)
|
41
41
|
end
|
42
42
|
end
|
@@ -12,11 +12,11 @@ describe Mango::Dependencies do
|
|
12
12
|
|
13
13
|
it "development gem names and versions should be correct" do
|
14
14
|
expected = {
|
15
|
-
:"rack-test" => "0.5.
|
16
|
-
:rspec => "
|
15
|
+
:"rack-test" => "0.5.6",
|
16
|
+
:rspec => "2.0.1",
|
17
17
|
:yard => "0.5.8",
|
18
|
-
:"yard-sinatra" => "0.5.
|
19
|
-
:bluecloth => "2.0.
|
18
|
+
:"yard-sinatra" => "0.5.1",
|
19
|
+
:bluecloth => "2.0.9"
|
20
20
|
}
|
21
21
|
|
22
22
|
Mango::Dependencies::DEVELOPMENT_GEMS.should == expected
|
@@ -54,35 +54,35 @@ Please visit http://www.ruby-lang.org/ for installation instructions.
|
|
54
54
|
ERROR
|
55
55
|
end
|
56
56
|
|
57
|
-
it "
|
57
|
+
it "aborts for ruby 1.8.6" do
|
58
58
|
version = "1.8.6"
|
59
59
|
lambda {
|
60
60
|
Mango::Dependencies.send(:check_ruby_version, version)
|
61
61
|
}.should raise_exception(SystemExit, expected_message(version))
|
62
62
|
end
|
63
63
|
|
64
|
-
it "
|
64
|
+
it "aborts for ruby 1.8.7" do
|
65
65
|
version = "1.8.7"
|
66
66
|
lambda {
|
67
67
|
Mango::Dependencies.send(:check_ruby_version, version)
|
68
68
|
}.should raise_exception(SystemExit, expected_message(version))
|
69
69
|
end
|
70
70
|
|
71
|
-
it "
|
71
|
+
it "aborts for ruby 1.9.0" do
|
72
72
|
version = "1.9.0"
|
73
73
|
lambda {
|
74
74
|
Mango::Dependencies.send(:check_ruby_version, version)
|
75
75
|
}.should raise_exception(SystemExit, expected_message(version))
|
76
76
|
end
|
77
77
|
|
78
|
-
it "
|
78
|
+
it "doesn't abort for ruby 1.9.1" do
|
79
79
|
version = "1.9.1"
|
80
80
|
lambda {
|
81
81
|
Mango::Dependencies.send(:check_ruby_version, version)
|
82
82
|
}.should_not raise_exception(SystemExit, expected_message(version))
|
83
83
|
end
|
84
84
|
|
85
|
-
it "
|
85
|
+
it "aborts for ruby 1.9.2" do
|
86
86
|
version = "1.9.2"
|
87
87
|
lambda {
|
88
88
|
Mango::Dependencies.send(:check_ruby_version, version)
|
@@ -93,7 +93,7 @@ Please visit http://www.ruby-lang.org/ for installation instructions.
|
|
93
93
|
#################################################################################################
|
94
94
|
|
95
95
|
describe ".destroy_warnings" do
|
96
|
-
it "
|
96
|
+
it "empties the warnings cache" do
|
97
97
|
Mango::Dependencies.class_variable_get(:@@warnings_cache).should be_empty
|
98
98
|
|
99
99
|
Mango::Dependencies.create_warning_for(LoadError.new("no such file to load -- yard"))
|
@@ -111,12 +111,12 @@ Please visit http://www.ruby-lang.org/ for installation instructions.
|
|
111
111
|
Mango::Dependencies.destroy_warnings
|
112
112
|
end
|
113
113
|
|
114
|
-
it "
|
114
|
+
it "creates and caches and cache one warning from a known development gem dependency" do
|
115
115
|
Mango::Dependencies.create_warning_for(LoadError.new("no such file to load -- yard"))
|
116
116
|
Mango::Dependencies.class_variable_get(:@@warnings_cache).should == ["yard --version '0.5.8'"]
|
117
117
|
end
|
118
118
|
|
119
|
-
it "
|
119
|
+
it "creates and caches and cache warnings from all known development gem dependencies" do
|
120
120
|
Mango::Dependencies::DEVELOPMENT_GEMS.each_key do |file_name|
|
121
121
|
gem_name = if Mango::Dependencies::FILE_NAME_TO_GEM_NAME.has_key?(file_name)
|
122
122
|
Mango::Dependencies::FILE_NAME_TO_GEM_NAME[file_name]
|
@@ -128,16 +128,16 @@ Please visit http://www.ruby-lang.org/ for installation instructions.
|
|
128
128
|
end
|
129
129
|
|
130
130
|
expected = [
|
131
|
-
"rack-test --version '0.5.
|
132
|
-
"rspec --version '
|
131
|
+
"rack-test --version '0.5.6'",
|
132
|
+
"rspec --version '2.0.1'",
|
133
133
|
"yard --version '0.5.8'",
|
134
|
-
"yard-sinatra --version '0.5.
|
135
|
-
"bluecloth --version '2.0.
|
134
|
+
"yard-sinatra --version '0.5.1'",
|
135
|
+
"bluecloth --version '2.0.9'"
|
136
136
|
]
|
137
137
|
Mango::Dependencies.class_variable_get(:@@warnings_cache).should == expected
|
138
138
|
end
|
139
139
|
|
140
|
-
it "
|
140
|
+
it "raises a RuntimeError when creating a warning from an unknown development gem dependency" do
|
141
141
|
lambda {
|
142
142
|
Mango::Dependencies.create_warning_for(LoadError.new("no such file to load -- _fakegem"))
|
143
143
|
}.should raise_exception(RuntimeError, "Cannot create a dependency warning for unknown development gem -- _fakegem")
|
@@ -155,7 +155,7 @@ Please visit http://www.ruby-lang.org/ for installation instructions.
|
|
155
155
|
$stdout = STDOUT
|
156
156
|
end
|
157
157
|
|
158
|
-
it "
|
158
|
+
it "displays a warning message to the user on the standard output channel" do
|
159
159
|
Mango::Dependencies.create_warning_for(LoadError.new("no such file to load -- spec/rake/spectask"))
|
160
160
|
Mango::Dependencies.create_warning_for(LoadError.new("no such file to load -- yard"))
|
161
161
|
Mango::Dependencies.create_warning_for(LoadError.new("no such file to load -- bluecloth"))
|
@@ -163,13 +163,13 @@ Please visit http://www.ruby-lang.org/ for installation instructions.
|
|
163
163
|
$stdout.string.should == <<-MESSAGE
|
164
164
|
|
165
165
|
The following development gem dependencies could not be found. Without them, some available development features are missing:
|
166
|
-
rspec --version '
|
166
|
+
rspec --version '2.0.1'
|
167
167
|
yard --version '0.5.8'
|
168
|
-
bluecloth --version '2.0.
|
168
|
+
bluecloth --version '2.0.9'
|
169
169
|
MESSAGE
|
170
170
|
end
|
171
171
|
|
172
|
-
it "
|
172
|
+
it "doesn't display a warning message to the user if there are no warnings in the cache" do
|
173
173
|
Mango::Dependencies.destroy_warnings
|
174
174
|
Mango::Dependencies.render_warnings
|
175
175
|
$stdout.string.should be_empty
|
@@ -179,7 +179,7 @@ bluecloth --version '2.0.7'
|
|
179
179
|
#################################################################################################
|
180
180
|
|
181
181
|
describe ".warn_at_exit" do
|
182
|
-
it "
|
182
|
+
it "ensures Kernel#at_exit is invoked with a block" do
|
183
183
|
Mango::Dependencies.should_receive(:at_exit)
|
184
184
|
# TODO how to specify that #at_exit receives a block?
|
185
185
|
# maybe i can intercept the block, execute it and test the output?
|
@@ -6,30 +6,30 @@ describe Mango::FlavoredMarkdown do
|
|
6
6
|
#################################################################################################
|
7
7
|
|
8
8
|
describe ".shake" do
|
9
|
-
it "
|
9
|
+
it "doesn't touch single underscores inside words" do
|
10
10
|
Mango::FlavoredMarkdown.shake("foo_bar").should == "foo_bar"
|
11
11
|
end
|
12
12
|
|
13
|
-
it "
|
13
|
+
it "doesn't touch underscores in code blocks" do
|
14
14
|
Mango::FlavoredMarkdown.shake(" foo_bar_baz").should == " foo_bar_baz"
|
15
15
|
end
|
16
16
|
|
17
|
-
it "
|
17
|
+
it "doesn't touch underscores in pre blocks" do
|
18
18
|
Mango::FlavoredMarkdown.shake("<pre>\nfoo_bar_baz\n</pre>").should
|
19
19
|
equal("\n\n<pre>\nfoo_bar_baz\n</pre>")
|
20
20
|
end
|
21
21
|
|
22
|
-
it "
|
22
|
+
it "doesn't treat pre blocks with pre-text differently" do
|
23
23
|
a = "\n\n<pre>\nthis is `a\\_test` and this\\_too\n</pre>"
|
24
24
|
b = "hmm<pre>\nthis is `a\\_test` and this\\_too\n</pre>"
|
25
25
|
Mango::FlavoredMarkdown.shake(b)[3..-1].should == Mango::FlavoredMarkdown.shake(a)[2..-1]
|
26
26
|
end
|
27
27
|
|
28
|
-
it "
|
28
|
+
it "escapes two or more underscores inside words" do
|
29
29
|
Mango::FlavoredMarkdown.shake("foo_bar_baz").should == "foo\\_bar\\_baz"
|
30
30
|
end
|
31
31
|
|
32
|
-
it "
|
32
|
+
it "converts newlines into br tags in simple cases" do
|
33
33
|
Mango::FlavoredMarkdown.shake("foo\nbar").should == "foo \nbar"
|
34
34
|
end
|
35
35
|
|
@@ -38,12 +38,12 @@ describe Mango::FlavoredMarkdown do
|
|
38
38
|
equal("apple \npear \norange\n\nruby \npython \nerlang")
|
39
39
|
end
|
40
40
|
|
41
|
-
it "
|
41
|
+
it "converts newlines in long groups" do
|
42
42
|
Mango::FlavoredMarkdown.shake("apple\npear\norange\nbanana\n\nruby\npython\nerlang").should
|
43
43
|
equal("apple \npear \norange \nbanana\n\nruby \npython \nerlang")
|
44
44
|
end
|
45
45
|
|
46
|
-
it "
|
46
|
+
it "doesn't convert newlines in lists" do
|
47
47
|
Mango::FlavoredMarkdown.shake("# foo\n# bar").should == "# foo\n# bar"
|
48
48
|
Mango::FlavoredMarkdown.shake("* foo\n* bar").should == "* foo\n* bar"
|
49
49
|
end
|