madride 1.0.2 → 1.0.3

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/bin/madride CHANGED
@@ -19,7 +19,7 @@ options = { :host => '0.0.0.0', :port => 3000, :data => {} }
19
19
  #
20
20
 
21
21
  OptionParser.new("", 24, ' ') do |opts|
22
- opts.banner = "Usage: madride [options] [PATH ...]"
22
+ opts.banner = "Usage: madride [options] PATH [PATH ...]"
23
23
 
24
24
  opts.separator ""
25
25
  opts.separator "Options:"
@@ -1,4 +1,5 @@
1
1
  require "sprockets"
2
+ require "tilt/haml"
2
3
 
3
4
 
4
5
  require "madride/templates/slim"
@@ -11,6 +12,7 @@ module Madride
11
12
  super
12
13
 
13
14
  register_engine '.slim', SlimTemplate
15
+ register_engine '.haml', Tilt::HamlTemplate
14
16
 
15
17
  Madride.paths.each do |path|
16
18
  append_path path
@@ -24,5 +26,11 @@ module Madride
24
26
  def locals
25
27
  @context_class.locals
26
28
  end
29
+
30
+
31
+ def call env
32
+ env['PATH_INFO'] += '.html' if File.extname(unescape(env['PATH_INFO'].to_s)).empty?
33
+ super
34
+ end
27
35
  end
28
36
  end
@@ -1,3 +1,3 @@
1
1
  module Madride
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
data/madride.gemspec CHANGED
@@ -13,6 +13,7 @@ Gem::Specification.new do |gem|
13
13
  gem.add_dependency "sprockets", "~> 2.4"
14
14
  gem.add_dependency "rack", "~> 1.0"
15
15
  gem.add_dependency "slim", "~> 1.2"
16
+ gem.add_dependency "haml", "~> 3.1"
16
17
  gem.add_dependency "sass", "~> 3.1"
17
18
 
18
19
  gem.add_development_dependency "rake", "~> 0.9"
@@ -0,0 +1,6 @@
1
+ html
2
+ head
3
+ title About
4
+
5
+ body
6
+ h1 About
@@ -0,0 +1,6 @@
1
+ html
2
+ head
3
+ title Music
4
+
5
+ body
6
+ h1 Music
data/spec/server_spec.rb CHANGED
@@ -35,5 +35,26 @@ module Madride
35
35
  get "/foobar.html"
36
36
  last_response.should_not be_ok
37
37
  end
38
+
39
+
40
+ it "should try serve index.html for directory if exists" do
41
+ get "/about"
42
+ last_response.should be_ok
43
+ last_response.body.should match(%r{<title>\s*About\s*</title>})
44
+ end
45
+
46
+
47
+ it "should try serve directory as <dir>.html if such file exists" do
48
+ get "/music"
49
+ last_response.should be_ok
50
+ last_response.body.should match(%r{<title>\s*Music\s*</title>})
51
+ end
52
+
53
+
54
+ it "should try serve /index.html for /" do
55
+ get "/"
56
+ last_response.should be_ok
57
+ last_response.body.should match(%r{<title>\s*Madride Demo\s*</title>})
58
+ end
38
59
  end
39
60
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: madride
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-28 00:00:00.000000000 Z
12
+ date: 2012-08-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sprockets
@@ -59,6 +59,22 @@ dependencies:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.2'
62
+ - !ruby/object:Gem::Dependency
63
+ name: haml
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '3.1'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '3.1'
62
78
  - !ruby/object:Gem::Dependency
63
79
  name: sass
64
80
  requirement: !ruby/object:Gem::Requirement
@@ -156,7 +172,9 @@ files:
156
172
  - spec/fixtures/assets/app.js
157
173
  - spec/fixtures/assets/madride.js
158
174
  - spec/fixtures/data.yml
175
+ - spec/fixtures/pages/about/index.html.slim
159
176
  - spec/fixtures/pages/index.html.slim
177
+ - spec/fixtures/pages/music.html.slim
160
178
  - spec/fixtures/pages/music/bands.html.slim
161
179
  - spec/server_spec.rb
162
180
  - spec/spec_helper.rb
@@ -172,18 +190,24 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
190
  - - ! '>='
173
191
  - !ruby/object:Gem::Version
174
192
  version: '0'
193
+ segments:
194
+ - 0
195
+ hash: 731189075
175
196
  required_rubygems_version: !ruby/object:Gem::Requirement
176
197
  none: false
177
198
  requirements:
178
199
  - - ! '>='
179
200
  - !ruby/object:Gem::Version
180
201
  version: '0'
202
+ segments:
203
+ - 0
204
+ hash: 731189075
181
205
  requirements: []
182
206
  rubyforge_project:
183
207
  rubygems_version: 1.8.23
184
208
  signing_key:
185
209
  specification_version: 3
186
- summary: madride-1.0.2
210
+ summary: madride-1.0.3
187
211
  test_files:
188
212
  - spec/.gitkeep
189
213
  - spec/environment_spec.rb
@@ -191,7 +215,9 @@ test_files:
191
215
  - spec/fixtures/assets/app.js
192
216
  - spec/fixtures/assets/madride.js
193
217
  - spec/fixtures/data.yml
218
+ - spec/fixtures/pages/about/index.html.slim
194
219
  - spec/fixtures/pages/index.html.slim
220
+ - spec/fixtures/pages/music.html.slim
195
221
  - spec/fixtures/pages/music/bands.html.slim
196
222
  - spec/server_spec.rb
197
223
  - spec/spec_helper.rb