cuba 2.0.0.rc1 → 2.0.0.rc2

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.
@@ -84,7 +84,7 @@ Here's an example showcasing how different matchers work:
84
84
  end
85
85
 
86
86
  # /styles/basic.css
87
- on "styles", extname("css") do |file|
87
+ on "styles", extension("css") do |file|
88
88
  res.write "Filename: #{file}" #=> "Filename: basic"
89
89
  end
90
90
 
@@ -142,4 +142,4 @@ To read more about testing, check the documentation for [Cutest][cutest] and
142
142
  Installation
143
143
  ------------
144
144
 
145
- $ gem install cuba
145
+ $ gem install cuba
@@ -1,12 +1,12 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cuba"
3
- s.version = "2.0.0.rc1"
3
+ s.version = "2.0.0.rc2"
4
4
  s.summary = "Rum based microframework for web applications."
5
5
  s.description = "Cuba is a light wrapper for Rum, a microframework for Rack applications."
6
6
  s.authors = ["Michel Martens"]
7
7
  s.email = ["michel@soveran.com"]
8
8
  s.homepage = "http://github.com/soveran/cuba"
9
- s.files = ["LICENSE", "README.markdown", "Rakefile", "lib/cuba/ron.rb", "lib/cuba/test.rb", "lib/cuba/version.rb", "lib/cuba.rb", "cuba.gemspec", "test/accept.rb", "test/captures.rb", "test/extname.rb", "test/helper.rb", "test/host.rb", "test/integration.rb", "test/match.rb", "test/number.rb", "test/on.rb", "test/path.rb", "test/run.rb", "test/segment.rb"]
9
+ s.files = ["LICENSE", "README.markdown", "Rakefile", "lib/cuba/ron.rb", "lib/cuba/test.rb", "lib/cuba/version.rb", "lib/cuba.rb", "cuba.gemspec", "test/accept.rb", "test/captures.rb", "test/extension.rb", "test/helper.rb", "test/host.rb", "test/integration.rb", "test/match.rb", "test/number.rb", "test/on.rb", "test/path.rb", "test/run.rb", "test/segment.rb"]
10
10
  s.add_dependency "rack", "~> 1.2"
11
11
  s.add_dependency "tilt", "~> 1.2"
12
12
  s.add_development_dependency "cutest", "~> 1.0"
@@ -90,7 +90,7 @@ module Cuba
90
90
  # res.write "User: #{uid}"
91
91
  # end
92
92
  #
93
- # on "styles", extname("css") do |file|
93
+ # on "styles", extension("css") do |file|
94
94
  # res.write render("styles/#{file}.sass")
95
95
  # end
96
96
  #
@@ -133,12 +133,8 @@ module Cuba
133
133
 
134
134
  yield
135
135
 
136
- env["SCRIPT_NAME"], env["PATH_INFO"] = script, path
137
-
138
136
  ensure
139
- unless @matched
140
- env["SCRIPT_NAME"], env["PATH_INFO"] = script, path
141
- end
137
+ env["SCRIPT_NAME"], env["PATH_INFO"] = script, path
142
138
  end
143
139
  private :try
144
140
 
@@ -165,14 +161,14 @@ module Cuba
165
161
  end
166
162
  end
167
163
 
168
- # A matcher for files with a certain extname.
164
+ # A matcher for files with a certain extension.
169
165
  #
170
166
  # @example
171
167
  # # PATH_INFO=/style/app.css
172
- # on "style", extname("css") do |file|
168
+ # on "style", extension("css") do |file|
173
169
  # res.write file # writes app
174
170
  # end
175
- def extname(ext = "\\w+")
171
+ def extension(ext = "\\w+")
176
172
  lambda { consume("([^\\/]+?)\.#{ext}\\z") }
177
173
  end
178
174
 
@@ -257,4 +253,4 @@ module Cuba
257
253
  throw :ron_run_next_app, app
258
254
  end
259
255
  end
260
- end
256
+ end
@@ -1,3 +1,3 @@
1
1
  module Cuba
2
- VERSION = "2.0.0.rc1"
2
+ VERSION = "2.0.0.rc2"
3
3
  end
@@ -74,9 +74,9 @@ test "yields a number" do
74
74
  assert_equal ["101"], resp.body
75
75
  end
76
76
 
77
- test "yields an extname" do
77
+ test "yield a file name with a matching extension" do
78
78
  Cuba.define do
79
- on get, "css", extname("css") do |file|
79
+ on get, "css", extension("css") do |file|
80
80
  res.write file
81
81
  end
82
82
  end
@@ -139,4 +139,4 @@ test "consumes a slash if needed" do
139
139
  _, _, resp = Cuba.call(env)
140
140
 
141
141
  assert_equal ["foo/bar.css"], resp.body
142
- end
142
+ end
@@ -3,7 +3,7 @@ require File.expand_path("helper", File.dirname(__FILE__))
3
3
  setup do
4
4
  Cuba.define do
5
5
  on "styles" do
6
- on extname("css") do |file|
6
+ on extension("css") do |file|
7
7
  res.write file
8
8
  end
9
9
  end
@@ -18,4 +18,4 @@ test "/styles/reset.css" do |env|
18
18
  _, _, resp = Cuba.call(env)
19
19
 
20
20
  assert_equal ["reset"], resp.body
21
- end
21
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: cuba
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: 6
5
- version: 2.0.0.rc1
5
+ version: 2.0.0.rc2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Michel Martens
@@ -77,7 +77,7 @@ files:
77
77
  - cuba.gemspec
78
78
  - test/accept.rb
79
79
  - test/captures.rb
80
- - test/extname.rb
80
+ - test/extension.rb
81
81
  - test/helper.rb
82
82
  - test/host.rb
83
83
  - test/integration.rb