rack-rewrite 0.1.2 → 0.1.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/HISTORY.rdoc ADDED
@@ -0,0 +1,10 @@
1
+ === 0.1.3 / 2009-11-14
2
+ * Maintenance
3
+ * Ensure Content-Type header is set for 301's and 302's (thanks to Sebastian Röbke)
4
+ * Documentation
5
+ * Add HISTORY.rdoc
6
+
7
+ === 0.1.2 / 2009-10-15
8
+ * API
9
+ * rewrite, r301 and r302 rules
10
+ * regular expression matching and substitution rules
data/README.rdoc CHANGED
@@ -32,6 +32,8 @@ to these routes and keep your routes.rb clean.
32
32
 
33
33
  == Sample rackup file
34
34
 
35
+ gem 'rack-rewrite', '~> 0.1.2'
36
+ require 'rack-rewrite
35
37
  use Rack::Rewrite do
36
38
  rewrite '/wiki/John_Trupiano', '/john'
37
39
  r301 '/wiki/Yair_Flicker', '/yair'
@@ -40,7 +42,7 @@ to these routes and keep your routes.rb clean.
40
42
  end
41
43
 
42
44
  == Sample usage in a rails app
43
- config.gem 'rack-rewrite', '~> 0.1.0'
45
+ config.gem 'rack-rewrite', '~> 0.1.2'
44
46
  require 'rack-rewrite
45
47
  config.middleware.insert_before(Rack::Lock, Rack::Rewrite) do
46
48
  rewrite '/wiki/John_Trupiano', '/john'
data/TODO ADDED
@@ -0,0 +1,4 @@
1
+ * Add :host support to restrict which URL's a rewrite rule matches [10/15/09]
2
+ * Add :if => lambda support for arbitrary conditional rule application (this will allow us to do the capistrano maintenance page w/o apache's mod_rewrite)
3
+ * Add support for specifying a config file instead of passing a block (e.g. config/rewrite.rb)
4
+ * Better message than "Redirecting..." -- how about html that says where it's being redirected to?
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -61,9 +61,9 @@ module Rack
61
61
  interpreted_to = self.send(:interpret_to, env['REQUEST_URI'])
62
62
  case self.rule_type
63
63
  when :r301
64
- [301, {'Location' => interpreted_to}, ['Redirecting...']]
64
+ [301, {'Location' => interpreted_to, 'Content-Type' => 'text/html'}, ['Redirecting...']]
65
65
  when :r302
66
- [302, {'Location' => interpreted_to}, ['Redirecting...']]
66
+ [302, {'Location' => interpreted_to, 'Content-Type' => 'text/html'}, ['Redirecting...']]
67
67
  when :rewrite
68
68
  # return [200, {}, {:content => env.inspect}]
69
69
  env['REQUEST_URI'] = interpreted_to
data/rack-rewrite.gemspec CHANGED
@@ -1,15 +1,15 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rack-rewrite}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["John Trupiano"]
12
- s.date = %q{2009-10-13}
12
+ s.date = %q{2009-11-14}
13
13
  s.description = %q{A rack middleware for enforcing rewrite rules. In many cases you can get away with rack-rewrite instead of writing Apache mod_rewrite rules.}
14
14
  s.email = %q{jtrupiano@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -19,9 +19,11 @@ Gem::Specification.new do |s|
19
19
  s.files = [
20
20
  ".document",
21
21
  ".gitignore",
22
+ "HISTORY.rdoc",
22
23
  "LICENSE",
23
24
  "README.rdoc",
24
25
  "Rakefile",
26
+ "TODO",
25
27
  "VERSION",
26
28
  "lib/rack-rewrite.rb",
27
29
  "lib/rack-rewrite/rule.rb",
@@ -55,3 +57,4 @@ Gem::Specification.new do |s|
55
57
  s.add_dependency(%q<shoulda>, [">= 0"])
56
58
  end
57
59
  end
60
+
data/test/rule_test.rb CHANGED
@@ -32,6 +32,14 @@ class RuleTest < Test::Unit::TestCase
32
32
  assert_equal 'bio=1', env['QUERYSTRING']
33
33
  assert_equal '/john?bio=1', env['REQUEST_URI']
34
34
  end
35
+
36
+ should 'set Content-Type header to text/html for a 301 and 302' do
37
+ [:r301, :r302].each do |rule_type|
38
+ rule = Rack::Rewrite::Rule.new(rule_type, %r{/abc}, '/def')
39
+ env = {'PATH_INFO' => '/abc'}
40
+ assert_equal 'text/html', rule.apply!(env)[1]['Content-Type']
41
+ end
42
+ end
35
43
  end
36
44
 
37
45
  context 'Rule#matches' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-rewrite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Trupiano
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-13 00:00:00 -04:00
12
+ date: 2009-11-14 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -34,9 +34,11 @@ extra_rdoc_files:
34
34
  files:
35
35
  - .document
36
36
  - .gitignore
37
+ - HISTORY.rdoc
37
38
  - LICENSE
38
39
  - README.rdoc
39
40
  - Rakefile
41
+ - TODO
40
42
  - VERSION
41
43
  - lib/rack-rewrite.rb
42
44
  - lib/rack-rewrite/rule.rb