sinatra-subroutes 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/{README.rdoc → README.markdown} +4 -2
- data/VERSION +1 -1
- data/lib/sinatra-subroutes.rb +1 -3
- data/sinatra-subroutes.gemspec +64 -0
- metadata +7 -6
@@ -25,7 +25,8 @@ end
|
|
25
25
|
</pre>
|
26
26
|
|
27
27
|
|
28
|
-
|
28
|
+
Contributing to sinatra-subroutes
|
29
|
+
---------------------------------
|
29
30
|
|
30
31
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
31
32
|
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
@@ -35,7 +36,8 @@ end
|
|
35
36
|
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
36
37
|
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
37
38
|
|
38
|
-
|
39
|
+
Copyright
|
40
|
+
---------
|
39
41
|
|
40
42
|
Copyright (c) 2010 Daniel Westendorf. See LICENSE.txt for
|
41
43
|
further details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.1
|
data/lib/sinatra-subroutes.rb
CHANGED
@@ -12,8 +12,7 @@ module Rack
|
|
12
12
|
# cache the result so we only compute it once.
|
13
13
|
@env['rack.env.subdomains'] ||= lambda {
|
14
14
|
# check if the current host is an IP address, if so return an empty array
|
15
|
-
return [] if (host.nil? ||
|
16
|
-
/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.match(host))
|
15
|
+
return [] if (host.nil? || /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.match(host))
|
17
16
|
host.split('.')[0...(1 - tld_len - 2)] # pull everything except the TLD
|
18
17
|
}.call
|
19
18
|
end
|
@@ -28,7 +27,6 @@ module Sinatra
|
|
28
27
|
def subdomain(pattern)
|
29
28
|
condition {
|
30
29
|
if request.subdomains[0] =~ pattern
|
31
|
-
@params[:subdomain] = $~[1..-1]
|
32
30
|
true
|
33
31
|
else
|
34
32
|
false
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{sinatra-subroutes}
|
8
|
+
s.version = "0.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Daniel Westendorf"]
|
12
|
+
s.date = %q{2010-12-27}
|
13
|
+
s.description = %q{Restrict routes in Sinatra based of the Subdomain in the URI}
|
14
|
+
s.email = %q{daniel@prowestech.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.markdown"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
"Gemfile",
|
22
|
+
"Gemfile.lock",
|
23
|
+
"LICENSE.txt",
|
24
|
+
"README.markdown",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"lib/sinatra-subroutes.rb",
|
28
|
+
"sinatra-subroutes.gemspec",
|
29
|
+
"test/helper.rb",
|
30
|
+
"test/test_sinatra-subroutes.rb"
|
31
|
+
]
|
32
|
+
s.homepage = %q{http://github.com/danielwestendorf/sinatra-subroutes}
|
33
|
+
s.licenses = ["MIT"]
|
34
|
+
s.require_paths = ["lib"]
|
35
|
+
s.rubygems_version = %q{1.3.7}
|
36
|
+
s.summary = %q{Allows restricting routes to a subdomain}
|
37
|
+
s.test_files = [
|
38
|
+
"test/helper.rb",
|
39
|
+
"test/test_sinatra-subroutes.rb"
|
40
|
+
]
|
41
|
+
|
42
|
+
if s.respond_to? :specification_version then
|
43
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
44
|
+
s.specification_version = 3
|
45
|
+
|
46
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
47
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
48
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
49
|
+
s.add_development_dependency(%q<sinatra>, [">= 0"])
|
50
|
+
s.add_runtime_dependency(%q<sinatra>, [">= 0"])
|
51
|
+
else
|
52
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
53
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
54
|
+
s.add_dependency(%q<sinatra>, [">= 0"])
|
55
|
+
s.add_dependency(%q<sinatra>, [">= 0"])
|
56
|
+
end
|
57
|
+
else
|
58
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
59
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
60
|
+
s.add_dependency(%q<sinatra>, [">= 0"])
|
61
|
+
s.add_dependency(%q<sinatra>, [">= 0"])
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Daniel Westendorf
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-12-
|
17
|
+
date: 2010-12-27 00:00:00 -08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -81,16 +81,17 @@ extensions: []
|
|
81
81
|
|
82
82
|
extra_rdoc_files:
|
83
83
|
- LICENSE.txt
|
84
|
-
- README.
|
84
|
+
- README.markdown
|
85
85
|
files:
|
86
86
|
- .document
|
87
87
|
- Gemfile
|
88
88
|
- Gemfile.lock
|
89
89
|
- LICENSE.txt
|
90
|
-
- README.
|
90
|
+
- README.markdown
|
91
91
|
- Rakefile
|
92
92
|
- VERSION
|
93
93
|
- lib/sinatra-subroutes.rb
|
94
|
+
- sinatra-subroutes.gemspec
|
94
95
|
- test/helper.rb
|
95
96
|
- test/test_sinatra-subroutes.rb
|
96
97
|
has_rdoc: true
|
@@ -107,7 +108,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
108
|
requirements:
|
108
109
|
- - ">="
|
109
110
|
- !ruby/object:Gem::Version
|
110
|
-
hash: -
|
111
|
+
hash: -1811455530190106172
|
111
112
|
segments:
|
112
113
|
- 0
|
113
114
|
version: "0"
|