foreign-fqdn-routing 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,2 +1,3 @@
1
1
  .DS_Store
2
- *.log
2
+ *.log
3
+ pkg/*
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ begin
5
5
  require 'jeweler'
6
6
  Jeweler::Tasks.new do |gem|
7
7
  gem.name = "foreign-fqdn-routing"
8
- gem.summary = %Q{This version of foreign_fqdn_routing merges foreign_fqdn_routing with request_routing}
8
+ gem.summary = %Q{Adds domain, subdomain and fqdn routing support to Rails}
9
9
  gem.email = "william@kyakia.com"
10
10
  gem.homepage = "http://github.com/autodata/foreign-fqdn-routing"
11
11
  gem.authors = ["Brian Mulloy", "Joe Scharf", "William Melody"]
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 1
3
2
  :major: 0
4
3
  :minor: 0
4
+ :patch: 2
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{foreign-fqdn-routing}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Brian Mulloy", "Joe Scharf", "William Melody"]
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
32
32
  s.rdoc_options = ["--charset=UTF-8"]
33
33
  s.require_paths = ["lib"]
34
34
  s.rubygems_version = %q{1.3.5}
35
- s.summary = %q{This version of foreign_fqdn_routing merges foreign_fqdn_routing with request_routing}
35
+ s.summary = %q{Adds domain, subdomain and fqdn routing support to Rails}
36
36
  s.test_files = [
37
37
  "test/foreign_fqdn_routing_test.rb",
38
38
  "test/test_helper.rb"
@@ -1,19 +1,28 @@
1
1
  module ForeignFQDNRouting
2
2
  module RouteExtensions
3
3
 
4
- TESTABLE_REQUEST_METHODS = [:subdomain, :domain, :method, :port, :remote_ip,
5
- :content_type, :accepts, :request_uri, :protocol]
4
+ TESTABLE_REQUEST_METHODS = [
5
+ :subdomain,
6
+ :domain,
7
+ :method,
8
+ :port,
9
+ :remote_ip,
10
+ :content_type,
11
+ :accepts,
12
+ :request_uri,
13
+ :protocol
14
+ ]
6
15
 
7
16
  def self.included(base)
8
17
  base.alias_method_chain :recognition_conditions, :foreign_domain
9
18
  end
10
19
 
11
- def recognition_conditions_with_foreign_domain
20
+ def recognition_conditions_with_foreign_domain
12
21
  result = recognition_conditions_without_foreign_domain
13
- result << "ForeignFQDNRouting.foreign_domain?(env[:host])" if conditions[:foreign_domain] == true
14
- result << "!ForeignFQDNRouting.foreign_domain?(env[:host])" if conditions[:foreign_domain] == false
15
- result << "ForeignFQDNRouting.foreign_fqdn?(env[:host])" if conditions[:foreign_fqdn] == true
16
- result << "!ForeignFQDNRouting.foreign_fqdn?(env[:host])" if conditions[:foreign_fqdn] == false
22
+ result << "ForeignFQDNRouting.foreign_domain?(env[:host])" if conditions[:foreign_domain] == true
23
+ result << "!ForeignFQDNRouting.foreign_domain?(env[:host])" if conditions[:foreign_domain] == false
24
+ result << "ForeignFQDNRouting.foreign_fqdn?(env[:host])" if conditions[:foreign_fqdn] == true
25
+ result << "!ForeignFQDNRouting.foreign_fqdn?(env[:host])" if conditions[:foreign_fqdn] == false
17
26
 
18
27
  conditions.each do |method, value|
19
28
  if TESTABLE_REQUEST_METHODS.include? method
@@ -22,14 +31,11 @@ module ForeignFQDNRouting
22
31
  else
23
32
  "conditions[#{method.inspect}] === env[#{method.inspect}]"
24
33
  end
25
- else
26
34
  end
27
- end
28
-
29
-
35
+ end # conditions
30
36
  result
31
- end
32
- end
37
+ end # def
38
+ end # RouteExtensions
33
39
 
34
40
  module RouteSetExtensions
35
41
  def self.included(base)
@@ -38,16 +44,16 @@ module ForeignFQDNRouting
38
44
 
39
45
  def extract_request_environment_with_foreign_domain(request)
40
46
  extract_request_environment_without_foreign_domain(request).merge({
41
- :host => request.host,
42
- :method => request.method,
43
- :subdomain => request.subdomains.first.to_s,
44
- :domain => request.domain,
45
- :port => request.port,
46
- :remote_ip => request.remote_ip,
47
+ :host => request.host,
48
+ :method => request.method,
49
+ :subdomain => request.subdomains.first.to_s,
50
+ :domain => request.domain,
51
+ :port => request.port,
52
+ :remote_ip => request.remote_ip,
47
53
  :content_type => request.content_type,
48
- :accepts => request.accepts.map(&:to_s).join(','),
49
- :request_uri => request.request_uri,
50
- :protocol => request.protocol
54
+ :accepts => request.accepts.map(&:to_s).join(','),
55
+ :request_uri => request.request_uri,
56
+ :protocol => request.protocol
51
57
  })
52
58
  end
53
59
  end
@@ -1,4 +1,4 @@
1
- require 'foreign_domain_routing'
1
+ require 'foreign_fqdn_routing'
2
2
 
3
3
  ActionController::Base.send :include, ForeignFQDNRouting::Controller
4
4
 
@@ -6,7 +6,7 @@ require 'action_controller'
6
6
 
7
7
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
8
8
  $LOAD_PATH.unshift(File.dirname(__FILE__))
9
- require 'foreign_domain_routing'
9
+ require 'foreign_fqdn_routing'
10
10
 
11
11
  class Test::Unit::TestCase
12
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreign-fqdn-routing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Mulloy
@@ -63,7 +63,7 @@ rubyforge_project:
63
63
  rubygems_version: 1.3.5
64
64
  signing_key:
65
65
  specification_version: 3
66
- summary: This version of foreign_fqdn_routing merges foreign_fqdn_routing with request_routing
66
+ summary: Adds domain, subdomain and fqdn routing support to Rails
67
67
  test_files:
68
68
  - test/foreign_fqdn_routing_test.rb
69
69
  - test/test_helper.rb