mango 0.5.0.beta2 → 0.5.0.beta3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES.mdown CHANGED
@@ -1,4 +1,4 @@
1
- Mango release 0.5.0.beta2 (October 21, 2010)
1
+ Mango release 0.5.0.beta3 (October 21, 2010)
2
2
  ============================================
3
3
 
4
4
  ### Features
data/README.mdown CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Image courtesy of [B.C. Tree Fruits LTD.](http://www.bctree.com/products/sourced/mango.php)
4
4
 
5
- Mango release 0.5.0.beta2 (October 21, 2010)
5
+ Mango release 0.5.0.beta3 (October 21, 2010)
6
6
  ============================================
7
7
 
8
8
  Copyright (c) 2010 Ryan Sobol. Licensed under the MIT license. Please see the {file:LICENSE} for more information.
@@ -158,6 +158,6 @@ Patches are always welcome and appreciated! The process is straight-forward for
158
158
 
159
159
  Before making your change, take a moment to get a feel for the style of coding, specifications, and in-line documentation.
160
160
 
161
- Please see {file:doc/ROAD-MAP.mdown} to learn how to flow with the project. In the near future, I plan on pushing this content directly into the [Issue Tracker](http://github.com/ryansobol/mango/issues).
161
+ Visit the [Issue Tracker](http://github.com/ryansobol/mango/issues) learn how you can lend a hand and where to start.
162
162
 
163
163
  Again, thank you for taking the time to help improve Mango.
@@ -275,7 +275,7 @@ module Mango
275
275
  # @param [String] uri_path
276
276
  #
277
277
  def render_index_file!(uri_path)
278
- return unless uri_path[-1] == "/"
278
+ return unless directory_path?(uri_path)
279
279
 
280
280
  index_match = File.join(settings.public, "*")
281
281
  index_file_path = build_index_file_path(uri_path)
@@ -292,7 +292,7 @@ module Mango
292
292
  # @return [String] The path to a potential index.html file
293
293
  #
294
294
  def build_index_file_path(uri_path)
295
- uri_path = File.join(uri_path, "index.html")
295
+ uri_path += "index.html"
296
296
  File.expand_path(uri_path, settings.public)
297
297
  end
298
298
 
@@ -330,9 +330,21 @@ module Mango
330
330
  # @return [String] The path to a potential content page
331
331
  #
332
332
  def build_content_page_path(uri_path)
333
- uri_path += "index" if uri_path.empty? || uri_path[-1] == "/"
333
+ uri_path += "index" if directory_path?(uri_path)
334
334
  File.expand_path(uri_path, settings.content)
335
335
  end
336
336
 
337
+ ###############################################################################################
338
+
339
+ private
340
+
341
+ # Given a URI path, determine whether or no it looks like a directory path
342
+ #
343
+ # @param [String] uri_path
344
+ # @return [Boolean] `true` if the path is empty or has a trailing `/`, otherwise `false`
345
+ #
346
+ def directory_path?(uri_path)
347
+ uri_path.empty? || uri_path[-1] == "/"
348
+ end
337
349
  end
338
350
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: UTF-8
2
2
  source "http://rubygems.org"
3
3
 
4
- gem "mango", "0.5.0.beta2"
4
+ gem "mango", "0.5.0.beta3"
data/lib/mango/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Mango
4
4
  # Current stable released version
5
- VERSION = "0.5.0.beta2"
5
+ VERSION = "0.5.0.beta3"
6
6
  end
@@ -34,9 +34,9 @@ Disallow: /cgi-bin/
34
34
 
35
35
  #################################################################################################
36
36
 
37
- describe "GET /images/index.html" do
37
+ describe "GET /images/" do
38
38
  before(:each) do
39
- get "/images/index.html"
39
+ get "/images/"
40
40
  end
41
41
 
42
42
  it "returns 200 status code" do
@@ -65,6 +65,46 @@ Disallow: /cgi-bin/
65
65
 
66
66
  #################################################################################################
67
67
 
68
+ describe "GET /" do
69
+ before(:each) do
70
+ @file_name = File.join(Mango::Application.public, "index.html")
71
+ @expected_body = <<-EXPECTED
72
+ <!DOCTYPE html>
73
+ <html>
74
+ <head>
75
+ <meta charset='utf-8' />
76
+ <title>/themes/default/public/index.html</title>
77
+ </head>
78
+ <body>
79
+ <p>/themes/default/public/index.html</p>
80
+ </body>
81
+ </html>
82
+ EXPECTED
83
+
84
+ File.open(@file_name, "w") { |f| f.write(@expected_body) }
85
+
86
+ get "/"
87
+ end
88
+
89
+ after(:each) do
90
+ File.delete(@file_name)
91
+ end
92
+
93
+ it "returns 200 status code" do
94
+ last_response.should be_ok
95
+ end
96
+
97
+ it "sends the correct Content-Type header" do
98
+ last_response["Content-Type"] == "text/html"
99
+ end
100
+
101
+ it "sends the correct body content" do
102
+ last_response.body.should == @expected_body
103
+ end
104
+ end
105
+
106
+ #################################################################################################
107
+
68
108
  describe "GET /images/ripe-mango.jpg" do
69
109
  before(:each) do
70
110
  get "/images/ripe-mango.jpg"
@@ -4,15 +4,19 @@ require "spec_helper"
4
4
  describe Mango do
5
5
  describe "version synchronizing" do
6
6
  before(:each) do
7
- @expected = "0.5.0.beta2"
7
+ @expected = "0.5.0.beta3"
8
8
  end
9
9
 
10
10
  it "is correct for Mango::VERSION" do
11
11
  Mango::VERSION.should == @expected
12
12
  end
13
13
 
14
- it "is correct for the VERSION file" do
15
- Dir.chdir(PROJECT_ROOT) { File.read("VERSION").chomp.should == @expected }
14
+ it "is correct for the README.mdown file" do
15
+ Dir.chdir(PROJECT_ROOT) do
16
+ readme = File.read("README.mdown", 250)
17
+ match = /^Mango release (\d+\.\d+\.\d+\.?\w*)/.match(readme)
18
+ match.captures.first.should == @expected
19
+ end
16
20
  end
17
21
  end
18
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mango
3
3
  version: !ruby/object:Gem::Version
4
- hash: -792433516
4
+ hash: 1162428694
5
5
  prerelease: true
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
9
  - 0
10
- - beta2
11
- version: 0.5.0.beta2
10
+ - beta3
11
+ version: 0.5.0.beta3
12
12
  platform: ruby
13
13
  authors:
14
14
  - Ryan Sobol
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-10-21 00:00:00 -07:00
19
+ date: 2010-10-23 00:00:00 -07:00
20
20
  default_executable: mango
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -210,7 +210,6 @@ files:
210
210
  - LICENSE
211
211
  - README.mdown
212
212
  - Rakefile
213
- - VERSION
214
213
  - bin/mango
215
214
  - lib/mango.rb
216
215
  - lib/mango/application.rb
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.5.0.beta2