padrino-routing 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -2
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/padrino-routing/helpers.rb +1 -1
- data/lib/padrino-routing/named_route.rb +1 -1
- data/lib/padrino-routing.rb +2 -2
- data/padrino-routing.gemspec +4 -8
- data/test/fixtures/adv_routing_app/app.rb +0 -1
- data/test/helper.rb +8 -16
- metadata +3 -5
- data/test/active_support_helpers.rb +0 -7
data/README.rdoc
CHANGED
@@ -12,7 +12,7 @@ To install the 'full-stack' padrino framework, simply grab the latest version fr
|
|
12
12
|
$ sudo gem install padrino --source http://gemcutter.org
|
13
13
|
|
14
14
|
This will install the necessary padrino gems to get you started.
|
15
|
-
Now you are ready to use this gem to enhance your
|
15
|
+
Now you are ready to use this gem to enhance your existing Sinatra projects or build new Padrino applications.
|
16
16
|
|
17
17
|
You can also install only the padrino-routing gem for more fine-grained use:
|
18
18
|
|
@@ -117,7 +117,7 @@ This will put all named routes within this controller block into the 'admin' nam
|
|
117
117
|
|
118
118
|
Note that controller namespaces are simply a shortcut for standard namespaces and do not differ in any other way.
|
119
119
|
|
120
|
-
You can freely use both named route aliases and traditional Sinatra routes in the same application without
|
120
|
+
You can freely use both named route aliases and traditional Sinatra routes in the same application without any conflicts.
|
121
121
|
|
122
122
|
See the wiki article for additional information: <...WIKI...>
|
123
123
|
|
data/Rakefile
CHANGED
@@ -8,7 +8,7 @@ begin
|
|
8
8
|
gem.summary = "Named route mapping system"
|
9
9
|
gem.description = "Enhances padrino with a named route mapping system allowing for advanced routes"
|
10
10
|
gem.email = "nesquena@gmail.com"
|
11
|
-
gem.homepage = "http://github.com/padrino/padrino-routing"
|
11
|
+
gem.homepage = "http://github.com/padrino/padrino-framework/tree/master/padrino-routing"
|
12
12
|
gem.authors = ["Padrino Team", "Nathan Esquenazi", "Davide D'Agostino", "Arthur Chiu"]
|
13
13
|
gem.add_runtime_dependency "sinatra", ">= 0.9.2"
|
14
14
|
gem.add_runtime_dependency "padrino-core", ">= 0.1.1"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
@@ -8,7 +8,7 @@ module Padrino
|
|
8
8
|
# url_for(:admin, show, :id => 5, :name => "demo") => '/admin/path/5/demo'
|
9
9
|
def url_for(*route_name)
|
10
10
|
values = route_name.extract_options!
|
11
|
-
mapped_url = self.class.named_paths[route_name] || self.class.named_paths[route_name.dup.unshift(self.class.app_name)]
|
11
|
+
mapped_url = self.class.named_paths[route_name] || self.class.named_paths[route_name.dup.unshift(self.class.app_name.to_sym)]
|
12
12
|
raise Padrino::RouteNotFound.new("Route alias #{route_name.inspect} is not mapped to a url") unless mapped_url
|
13
13
|
result_url = String.new(File.join(self.class.uri_root, mapped_url))
|
14
14
|
result_url.scan(%r{/?(:\S+?)(?:/|$)}).each do |placeholder|
|
@@ -12,7 +12,7 @@ module Padrino
|
|
12
12
|
# Used to define the url mapping to the supplied alias
|
13
13
|
# NamedRoute.new(@app, :account).to('/account/path')
|
14
14
|
def to(path)
|
15
|
-
@app.named_paths[@names.unshift(@app.app_name)] = path
|
15
|
+
@app.named_paths[@names.unshift(@app.app_name.to_sym)] = path
|
16
16
|
end
|
17
17
|
|
18
18
|
# Used to define the url mappings for child aliases within a namespace
|
data/lib/padrino-routing.rb
CHANGED
@@ -32,7 +32,7 @@ module Padrino
|
|
32
32
|
@_namespace = original
|
33
33
|
end
|
34
34
|
|
35
|
-
# Hijacking route method in
|
35
|
+
# Hijacking route method in Sinatra to replace a route alias (i.e :account) with the full url string mapping
|
36
36
|
# Supports namespaces by accessing the instance variable and appending this to the route alias name
|
37
37
|
# If the path is not a symbol, nothing is changed and the original route method is invoked
|
38
38
|
def route(verb, path, options={}, &block)
|
@@ -42,7 +42,7 @@ module Padrino
|
|
42
42
|
map(*route_name).to(mapped_url)
|
43
43
|
path = mapped_url
|
44
44
|
else # referencing prior named route
|
45
|
-
route_name.unshift(self.app_name)
|
45
|
+
route_name.unshift(self.app_name.to_sym)
|
46
46
|
path = named_paths[route_name]
|
47
47
|
end
|
48
48
|
end
|
data/padrino-routing.gemspec
CHANGED
@@ -5,24 +5,21 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{padrino-routing}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Padrino Team", "Nathan Esquenazi", "Davide D'Agostino", "Arthur Chiu"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-23}
|
13
13
|
s.description = %q{Enhances padrino with a named route mapping system allowing for advanced routes}
|
14
14
|
s.email = %q{nesquena@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
|
-
"
|
17
|
-
"README.rdoc"
|
16
|
+
"README.rdoc"
|
18
17
|
]
|
19
18
|
s.files = [
|
20
19
|
".document",
|
21
20
|
".gitignore",
|
22
21
|
"LICENSE",
|
23
22
|
"README.rdoc",
|
24
|
-
"README.rdoc",
|
25
|
-
"Rakefile",
|
26
23
|
"Rakefile",
|
27
24
|
"VERSION",
|
28
25
|
"lib/padrino-routing.rb",
|
@@ -30,7 +27,6 @@ Gem::Specification.new do |s|
|
|
30
27
|
"lib/padrino-routing/helpers.rb",
|
31
28
|
"lib/padrino-routing/named_route.rb",
|
32
29
|
"padrino-routing.gemspec",
|
33
|
-
"test/active_support_helpers.rb",
|
34
30
|
"test/fixtures/adv_routing_app/Gemfile",
|
35
31
|
"test/fixtures/adv_routing_app/app.rb",
|
36
32
|
"test/fixtures/adv_routing_app/config/apps.rb",
|
@@ -44,7 +40,7 @@ Gem::Specification.new do |s|
|
|
44
40
|
"test/test_padrino_adv_routing.rb",
|
45
41
|
"test/test_padrino_routing.rb"
|
46
42
|
]
|
47
|
-
s.homepage = %q{http://github.com/padrino/padrino-routing}
|
43
|
+
s.homepage = %q{http://github.com/padrino/padrino-framework/tree/master/padrino-routing}
|
48
44
|
s.rdoc_options = ["--charset=UTF-8"]
|
49
45
|
s.require_paths = ["lib"]
|
50
46
|
s.rubygems_version = %q{1.3.5}
|
data/test/helper.rb
CHANGED
@@ -7,13 +7,9 @@ require 'webrat'
|
|
7
7
|
|
8
8
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
9
9
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
10
|
-
require 'active_support_helpers'
|
11
10
|
require 'padrino-helpers'
|
12
11
|
|
13
12
|
class Test::Unit::TestCase
|
14
|
-
include Padrino::Helpers::OutputHelpers
|
15
|
-
include Padrino::Helpers::TagHelpers
|
16
|
-
include Padrino::Helpers::AssetTagHelpers
|
17
13
|
include Rack::Test::Methods
|
18
14
|
include Webrat::Methods
|
19
15
|
include Webrat::Matchers
|
@@ -47,27 +43,23 @@ class Test::Unit::TestCase
|
|
47
43
|
assert matcher.matches?(html), matcher.failure_message
|
48
44
|
end
|
49
45
|
|
50
|
-
#
|
51
|
-
|
52
|
-
|
53
|
-
|
46
|
+
# Asserts that a file matches the pattern
|
47
|
+
def assert_match_in_file(pattern, file)
|
48
|
+
assert File.exist?(file), "File '#{file}' does not exist!"
|
49
|
+
assert_match pattern, File.read(file)
|
54
50
|
end
|
55
|
-
|
51
|
+
end
|
52
|
+
|
53
|
+
class Object
|
56
54
|
# Silences the output by redirecting to stringIO
|
57
55
|
# silence_logger { ...commands... } => "...output..."
|
58
|
-
def
|
56
|
+
def silence_logger(&block)
|
59
57
|
orig_stdout = $stdout
|
60
58
|
$stdout = log_buffer = StringIO.new
|
61
59
|
block.call
|
62
60
|
$stdout = orig_stdout
|
63
61
|
log_buffer.rewind && log_buffer.read
|
64
62
|
end
|
65
|
-
|
66
|
-
# Asserts that a file matches the pattern
|
67
|
-
def assert_match_in_file(pattern, file)
|
68
|
-
assert File.exist?(file), "File '#{file}' does not exist!"
|
69
|
-
assert_match pattern, File.read(file)
|
70
|
-
end
|
71
63
|
end
|
72
64
|
|
73
65
|
module Webrat
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: padrino-routing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Padrino Team
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date: 2009-11-
|
15
|
+
date: 2009-11-23 00:00:00 -08:00
|
16
16
|
default_executable:
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
@@ -92,7 +92,6 @@ executables: []
|
|
92
92
|
extensions: []
|
93
93
|
|
94
94
|
extra_rdoc_files:
|
95
|
-
- LICENSE
|
96
95
|
- README.rdoc
|
97
96
|
files:
|
98
97
|
- .document
|
@@ -106,7 +105,6 @@ files:
|
|
106
105
|
- lib/padrino-routing/helpers.rb
|
107
106
|
- lib/padrino-routing/named_route.rb
|
108
107
|
- padrino-routing.gemspec
|
109
|
-
- test/active_support_helpers.rb
|
110
108
|
- test/fixtures/adv_routing_app/Gemfile
|
111
109
|
- test/fixtures/adv_routing_app/app.rb
|
112
110
|
- test/fixtures/adv_routing_app/config/apps.rb
|
@@ -120,7 +118,7 @@ files:
|
|
120
118
|
- test/test_padrino_adv_routing.rb
|
121
119
|
- test/test_padrino_routing.rb
|
122
120
|
has_rdoc: true
|
123
|
-
homepage: http://github.com/padrino/padrino-routing
|
121
|
+
homepage: http://github.com/padrino/padrino-framework/tree/master/padrino-routing
|
124
122
|
licenses: []
|
125
123
|
|
126
124
|
post_install_message:
|