jcnetdev-subdomain-fu 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/MIT-LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2008 Michael Bleigh (http://www.mbleigh.com) and
2
+ Intridea, Inc (http://www.intridea.com)
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,102 @@
1
+ SubdomainFu
2
+ ===========
3
+
4
+ SubdomainFu provides a modern implementation of subdomain handling in Rails.
5
+ It takes aspects from account_location, request_routing, and other snippets
6
+ found around the web and combines them to provide a single, simple solution
7
+ for subdomain-based route and url management.
8
+
9
+ Installation
10
+ ============
11
+
12
+ SubdomainFu is available both as a traditional plugin and a GemPlugin. To
13
+ install it as a traditional plugin (Rails 2.1 or later):
14
+
15
+ script/plugin install git://github.com/mbleigh/subdomain-fu.git
16
+
17
+ To use it as a GemPlugin, add it to your environment.rb:
18
+
19
+ config.gem 'mbleigh-subdomain-fu', :source => "http://gems.github.com", :lib => "subdomain-fu"
20
+
21
+
22
+ Examples
23
+ ========
24
+
25
+ SubdomainFu works inside of Rails's URL Writing mechanisms to provide an easy and seamless
26
+ way to link and otherwise understand cross-subdomain routing. You can use the :subdomain
27
+ option both in named and non-named routes as well as in generated resources routes.
28
+
29
+ Let's say my domain is 'intridea.com'. Here are some examples of the use of the :subdomain
30
+ option:
31
+
32
+ url_for(:controller => "my_controller",
33
+ :action => "my_action",
34
+ :subdomain => "awesome") # => http://awesome.intridea.com/my_controller/my_action
35
+
36
+ Now let's say I'm at http://awesome.intridea.com/ and I want back to the root.
37
+ Specifying "false" will remove any current subdomain:
38
+
39
+ users_url(:subdomain => false) # => http://intridea.com/users
40
+
41
+ Note that this plugin does not honor the :only_path notion of routing when doing
42
+ so would go against the intent of the command. For example, if I were at http://intridea.com
43
+ again:
44
+
45
+ users_path(:subdomain => "fun") # => http://fun.intridea.com/users
46
+ users_path(:subdomain => false) # => /users
47
+
48
+ In this way you can rest assured that you will never misdirect your links to the
49
+ same subdomain when you meant to change it.
50
+
51
+ Configuration
52
+ =============
53
+
54
+ You may need to configure SubdomainFu based on your development setup. The
55
+ configuration required is:
56
+
57
+ tld_size
58
+ --------
59
+
60
+ A hash for each environment of the size of the top-level domain name.
61
+ (something.com = 1, localhost = 0, etc.)
62
+
63
+ SubdomainFu.tld_size = 1 # sets for current environment
64
+ SubdomainFu.tld_sizes = {:development => 0,
65
+ :test => 0,
66
+ :production => 1} # set all at once (also the defaults)
67
+
68
+ mirrors
69
+ -------
70
+
71
+ Mirrors are the subdomains that are equivalent to no subdomain (i.e. they 'mirror')
72
+ the usage of the root domain.
73
+
74
+ SubdomainFu.mirrors = %w(www site we) # Defaults to %w(www)
75
+
76
+ preferred_mirror
77
+ ----------------
78
+
79
+ SubdomainFu also understands the notion of a 'preferred mirror', that is, if you
80
+ always want your links going to 'www.yourdomain.com' instead of 'yourdomain.com',
81
+ you can set the preferred mirror like so:
82
+
83
+ SubdomainFu.preferred_mirror = "www"
84
+
85
+ Now when you create a link to a false subdomain
86
+
87
+ Known Issues / Future Work
88
+ ==========================
89
+
90
+ SubdomainFu will eventually integrate with Rails' routing internals to provide
91
+ the ability to specify routes based on the condition of a specific subdomain or
92
+ simply whether a subdomain is present (or a mirror).
93
+
94
+ Resources
95
+ =========
96
+
97
+ * Acts As Community Project: http://actsascommunity.com/projects/subdomain-fu
98
+ * GitHub Repository: http://github.com/mbleigh/subdomain-fu
99
+ * Lighthouse: http://mbleigh.lighthouseapp.com/projects/13148-subdomain-fu
100
+
101
+ Copyright (c) 2008 Michael Bleigh (http://www.mbleigh.com/) and
102
+ Intridea, Inc. (http://www.intridea.com/). Released under the MIT license
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require File.dirname(__FILE__) + "/rails/init"
@@ -0,0 +1,103 @@
1
+ #require 'subdomain_fu/routing_extensions'
2
+ require 'subdomain_fu/url_rewriter'
3
+
4
+ module SubdomainFu
5
+ # The length of the period-split top-level domain for each environment.
6
+ # For example, "localhost" has a tld_size of zero, and "something.co.uk"
7
+ # has a tld_size of two.
8
+ #
9
+ # To set a tld size for a given environment, just call SubdomainFu.tld_sizes[:environment] = value
10
+ DEFAULT_TLD_SIZES = {:development => 0, :test => 0, :production => 1}
11
+ mattr_accessor :tld_sizes
12
+ @@tld_sizes = DEFAULT_TLD_SIZES.dup
13
+
14
+ # Subdomains that are equivalent to going to the website with no subdomain at all.
15
+ # Defaults to "www" as the only member.
16
+ mattr_accessor :mirrors
17
+ @@mirrors = %w(www)
18
+
19
+ mattr_accessor :preferred_mirror
20
+ @@preferred_mirror = nil
21
+
22
+ # Returns the TLD Size of the current environment.
23
+ def self.tld_size
24
+ tld_sizes[RAILS_ENV.to_sym]
25
+ end
26
+
27
+ # Sets the TLD Size of the current environment
28
+ def self.tld_size=(value)
29
+ tld_sizes[RAILS_ENV.to_sym] = value
30
+ end
31
+
32
+ # Is the current subdomain either nil or a mirror?
33
+ def self.has_subdomain?(subdomain)
34
+ !subdomain.blank? && !SubdomainFu.mirrors.include?(subdomain)
35
+ end
36
+
37
+ # Gets the subdomain from the host based on the TLD size
38
+ def self.subdomain_from(host)
39
+ return nil unless host
40
+ parts = host.split('.')
41
+ sub = parts[0..-(SubdomainFu.tld_size+2)].join(".")
42
+ sub.blank? ? nil : sub
43
+ end
44
+
45
+ def self.host_without_subdomain(host)
46
+ parts = host.split('.')
47
+ parts[-(SubdomainFu.tld_size+1)..-1].join(".")
48
+ end
49
+
50
+ # Rewrites the subdomain of the host unless they are equivalent (i.e. mirrors of each other)
51
+ def self.rewrite_host_for_subdomains(subdomain, host)
52
+ unless needs_rewrite?(subdomain, host)
53
+ if has_subdomain?(subdomain) || (subdomain_from(host) == SubdomainFu.preferred_mirror) || (!has_subdomain?(subdomain) && SubdomainFu.preferred_mirror == nil)
54
+ host
55
+ else
56
+ change_subdomain_of_host(SubdomainFu.preferred_mirror, host)
57
+ end
58
+ else
59
+ change_subdomain_of_host(subdomain || SubdomainFu.preferred_mirror, host)
60
+ end
61
+ end
62
+
63
+ # Changes the subdomain of the host to whatever is passed in.
64
+ def self.change_subdomain_of_host(subdomain, host)
65
+ host = SubdomainFu.host_without_subdomain(host)
66
+ host = "#{subdomain}.#{host}" if subdomain
67
+ host
68
+ end
69
+
70
+ # Is this subdomain equivalent to the subdomain found in this host string?
71
+ def self.same_subdomain?(subdomain, host)
72
+ subdomain = nil unless subdomain
73
+ (subdomain == SubdomainFu.subdomain_from(host)) ||
74
+ (!SubdomainFu.has_subdomain?(subdomain) && !SubdomainFu.has_subdomain?(SubdomainFu.subdomain_from(host)))
75
+ end
76
+
77
+ def self.needs_rewrite?(subdomain, host)
78
+ subdomain = nil if subdomain.blank?
79
+ (!has_subdomain?(subdomain) && subdomain != SubdomainFu.preferred_mirror && SubdomainFu.preferred_mirror != nil) ||
80
+ !same_subdomain?(subdomain, host)
81
+ end
82
+
83
+ def self.current_subdomain(request)
84
+ subdomain = request.subdomains(SubdomainFu.tld_size).join(".")
85
+ if has_subdomain?(subdomain)
86
+ subdomain
87
+ else
88
+ nil
89
+ end
90
+ end
91
+
92
+ module Controller
93
+ def self.included(controller)
94
+ controller.helper_method(:current_subdomain)
95
+ end
96
+
97
+ protected
98
+
99
+ def current_subdomain
100
+ SubdomainFu.current_subdomain(request)
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,33 @@
1
+ # Thanks to Jamis Buck for ideas on this stuff
2
+ # http://weblog.jamisbuck.org/2006/10/26/monkey-patching-rails-extending-routes-2
3
+ # This is not yet a working part of SubdomainFu.
4
+
5
+ module SubdomainFu
6
+ module RouteExtensions
7
+ def self.included(base)
8
+ base.alias_method_chain :recognition_conditions, :subdomain
9
+ end
10
+
11
+ def recognition_conditions_with_subdomain
12
+ result = recognition_conditions_without_subdomain
13
+ result << "conditions[:subdomain] === env[:subdomain]" if conditions[:subdomain] && conditions[:subdomain] != true && conditions[:subdomain] != false
14
+ result << "SubdomainFu.has_subdomain?(env[:subdomain])" if conditions[:subdomain] == true
15
+ result << "!SubdomainFu.has_subdomain?(env[:subdomain])" if conditions[:subdomain] == false
16
+ result
17
+ end
18
+ end
19
+
20
+ module RouteSetExtensions
21
+ def self.included(base)
22
+ base.alias_method_chain :extract_request_environment, :subdomain
23
+ end
24
+
25
+ def extract_request_environment_with_subdomain(request)
26
+ env = extract_request_environment_without_subdomain(request)
27
+ env.merge(:host => request.host, :domain => request.domain, :subdomain => SubdomainFu.subdomain_from(request.host))
28
+ end
29
+ end
30
+ end
31
+
32
+ ActionController::Routing::RouteSet.send :include, SubdomainFu::RouteSetExtensions
33
+ ActionController::Routing::Route.send :include, SubdomainFu::RouteExtensions
@@ -0,0 +1,29 @@
1
+ module ActionController
2
+ module UrlWriter
3
+ def url_for_with_subdomains(options)
4
+ unless SubdomainFu.needs_rewrite?(options[:subdomain], options[:host] || default_url_options[:host])
5
+ options.delete(:subdomain)
6
+ else
7
+ options[:only_path] = false
8
+ options[:host] = SubdomainFu.rewrite_host_for_subdomains(options.delete(:subdomain), options[:host] || default_url_options[:host])
9
+ end
10
+ url_for_without_subdomains(options)
11
+ end
12
+ alias_method_chain :url_for, :subdomains
13
+ end
14
+
15
+ class UrlRewriter #:nodoc:
16
+ private
17
+
18
+ def rewrite_url_with_subdomains(options)
19
+ unless SubdomainFu.needs_rewrite?(options[:subdomain], (options[:host] || @request.host_with_port))
20
+ options.delete(:subdomain)
21
+ else
22
+ options[:only_path] = false
23
+ options[:host] = SubdomainFu.rewrite_host_for_subdomains(options.delete(:subdomain), options[:host] || @request.host_with_port)
24
+ end
25
+ rewrite_url_without_subdomains(options)
26
+ end
27
+ alias_method_chain :rewrite_url, :subdomains
28
+ end
29
+ end
data/rails/init.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'subdomain-fu'
2
+
3
+ ActionController::Base.send :include, SubdomainFu::Controller
4
+
5
+ RAILS_DEFAULT_LOGGER.info("** SubdomainFu: initialized properly")
@@ -0,0 +1,33 @@
1
+ begin
2
+ require File.dirname(__FILE__) + '/../../../../spec/spec_helper'
3
+ rescue LoadError
4
+ puts "You need to install rspec in your base app"
5
+ exit
6
+ end
7
+
8
+ plugin_spec_dir = File.dirname(__FILE__)
9
+ ActiveRecord::Base.logger = Logger.new(plugin_spec_dir + "/debug.log")
10
+
11
+ ActionController::Routing::Routes.draw do |map|
12
+ map.needs_subdomain '/needs_subdomain', :controller => "fu", :action => "awesome"
13
+ map.no_subdomain '/no_subdomain', :controller => "fu", :action => "lame"
14
+ map.needs_awesome '/needs_awesome', :controller => "fu", :action => "lame"
15
+
16
+ map.resources :foos do |fu|
17
+ fu.resources :bars
18
+ end
19
+
20
+ map.connect '/:controller/:action/:id'
21
+ end
22
+
23
+ class Paramed
24
+ def initialize(param)
25
+ @param = param
26
+ end
27
+
28
+ def to_param
29
+ @param || "param"
30
+ end
31
+ end
32
+
33
+ include ActionController::UrlWriter
@@ -0,0 +1,131 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ describe "SubdomainFu" do
4
+ describe "TLD Sizes" do
5
+ before do
6
+ SubdomainFu.tld_sizes = SubdomainFu::DEFAULT_TLD_SIZES.dup
7
+ end
8
+
9
+ it { SubdomainFu.tld_sizes.should be_kind_of(Hash) }
10
+
11
+ it "should have default values for development, test, and production" do
12
+ SubdomainFu.tld_sizes[:development].should == 0
13
+ SubdomainFu.tld_sizes[:test].should == 0
14
+ SubdomainFu.tld_sizes[:production].should == 1
15
+ end
16
+
17
+ it "#tld_size should be for the current environment" do
18
+ SubdomainFu.tld_size.should == SubdomainFu.tld_sizes[RAILS_ENV.to_sym]
19
+ end
20
+
21
+ it "should be able to be set for the current environment" do
22
+ SubdomainFu.tld_size = 5
23
+ SubdomainFu.tld_size.should == 5
24
+ SubdomainFu.tld_sizes[:test].should == 5
25
+ end
26
+ end
27
+
28
+ describe "#has_subdomain?" do
29
+ it "should be true for non-mirrored subdomains" do
30
+ SubdomainFu.has_subdomain?("awesome").should be_true
31
+ end
32
+
33
+ it "should be false for mirrored subdomains" do
34
+ SubdomainFu.has_subdomain?(SubdomainFu.mirrors.first).should be_false
35
+ end
36
+
37
+ it "shoud be false for a nil or blank subdomain" do
38
+ SubdomainFu.has_subdomain?("").should be_false
39
+ SubdomainFu.has_subdomain?(nil).should be_false
40
+ end
41
+ end
42
+
43
+ describe "#subdomain_from" do
44
+ it "should return the subdomain based on the TLD of the current environment" do
45
+ SubdomainFu.subdomain_from("awesome.localhost").should == "awesome"
46
+ SubdomainFu.tld_size = 1
47
+ SubdomainFu.subdomain_from("awesome.localhost.com").should == "awesome"
48
+ SubdomainFu.tld_size = 0
49
+ end
50
+
51
+ it "should join deep subdomains with a period" do
52
+ SubdomainFu.subdomain_from("awesome.coolguy.localhost").should == "awesome.coolguy"
53
+ end
54
+
55
+ it "should return nil for no subdomain" do
56
+ SubdomainFu.subdomain_from("localhost").should be_nil
57
+ end
58
+ end
59
+
60
+ it "#host_without_subdomain should chop of the subdomain and return the rest" do
61
+ SubdomainFu.host_without_subdomain("awesome.localhost:3000").should == "localhost:3000"
62
+ SubdomainFu.host_without_subdomain("something.awful.localhost:3000").should == "localhost:3000"
63
+ end
64
+
65
+ describe "#rewrite_host_for_subdomains" do
66
+ it "should not change the same subdomain" do
67
+ SubdomainFu.rewrite_host_for_subdomains("awesome","awesome.localhost").should == "awesome.localhost"
68
+ end
69
+
70
+ it "should not change an equivalent (mirrored) subdomain" do
71
+ SubdomainFu.rewrite_host_for_subdomains("www","localhost").should == "localhost"
72
+ end
73
+
74
+ it "should change the subdomain if it's different" do
75
+ SubdomainFu.rewrite_host_for_subdomains("cool","www.localhost").should == "cool.localhost"
76
+ end
77
+
78
+ it "should remove the subdomain if passed nil when it's not a mirror" do
79
+ SubdomainFu.rewrite_host_for_subdomains(nil,"cool.localhost").should == "localhost"
80
+ end
81
+
82
+ it "should not remove the subdomain if passed nil when it is a mirror" do
83
+ SubdomainFu.rewrite_host_for_subdomains(nil,"www.localhost").should == "www.localhost"
84
+ end
85
+ end
86
+
87
+ describe "#change_subdomain_of_host" do
88
+ it "should change it if passed a different one" do
89
+ SubdomainFu.change_subdomain_of_host("awesome","cool.localhost").should == "awesome.localhost"
90
+ end
91
+
92
+ it "should remove it if passed nil" do
93
+ SubdomainFu.change_subdomain_of_host(nil,"cool.localhost").should == "localhost"
94
+ end
95
+
96
+ it "should add it if there isn't one" do
97
+ SubdomainFu.change_subdomain_of_host("awesome","localhost").should == "awesome.localhost"
98
+ end
99
+ end
100
+
101
+ describe "#current_subdomain" do
102
+ it "should return the current subdomain if there is one" do
103
+ request = mock("request", :subdomains => ["awesome"])
104
+ SubdomainFu.current_subdomain(request).should == "awesome"
105
+ end
106
+
107
+ it "should return nil if there's no subdomain" do
108
+ request = mock("request", :subdomains => [])
109
+ SubdomainFu.current_subdomain(request).should be_nil
110
+ end
111
+
112
+ it "should return nil if the current subdomain is a mirror" do
113
+ request = mock("request", :subdomains => ["www"])
114
+ SubdomainFu.current_subdomain(request).should be_nil
115
+ end
116
+
117
+ it "should return the whole thing (including a .) if there's multiple subdomains" do
118
+ request = mock("request", :subdomains => ["awesome","rad"])
119
+ SubdomainFu.current_subdomain(request).should == "awesome.rad"
120
+ end
121
+ end
122
+
123
+ describe "#same_subdomain?" do
124
+ it { SubdomainFu.same_subdomain?("www","www.localhost").should be_true }
125
+ it { SubdomainFu.same_subdomain?("www","localhost").should be_true }
126
+ it { SubdomainFu.same_subdomain?("awesome","www.localhost").should be_false }
127
+ it { SubdomainFu.same_subdomain?("cool","awesome.localhost").should be_false }
128
+ it { SubdomainFu.same_subdomain?(nil,"www.localhost").should be_true }
129
+ it { SubdomainFu.same_subdomain?("www","awesome.localhost").should be_false }
130
+ end
131
+ end
@@ -0,0 +1,95 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ describe "SubdomainFu URL Writing" do
4
+ before do
5
+ SubdomainFu.tld_size = 1
6
+ default_url_options[:host] = "testapp.com"
7
+ end
8
+
9
+ describe "#url_for" do
10
+ it "should be able to add a subdomain" do
11
+ url_for(:controller => "something", :action => "other", :subdomain => "awesome").should == "http://awesome.testapp.com/something/other"
12
+ end
13
+
14
+ it "should be able to remove a subdomain" do
15
+ url_for(:controller => "something", :action => "other", :subdomain => false, :host => "awesome.testapp.com").should == "http://testapp.com/something/other"
16
+ end
17
+
18
+ it "should not change a mirrored subdomain" do
19
+ url_for(:controller => "something", :action => "other", :subdomain => false, :host => "www.testapp.com").should == "http://www.testapp.com/something/other"
20
+ end
21
+
22
+ it "should should force the full url, even with :only_path" do
23
+ url_for(:controller => "something", :action => "other", :subdomain => "awesome", :only_path => true).should == "http://awesome.testapp.com/something/other"
24
+ end
25
+ end
26
+
27
+ describe "Standard Routes" do
28
+ it "should be able to add a subdomain" do
29
+ needs_subdomain_url(:subdomain => "awesome").should == "http://awesome.testapp.com/needs_subdomain"
30
+ end
31
+
32
+ it "should be able to remove a subdomain" do
33
+ default_url_options[:host] = "awesome.testapp.com"
34
+ needs_subdomain_url(:subdomain => false).should == "http://testapp.com/needs_subdomain"
35
+ end
36
+
37
+ it "should not change a mirrored subdomain" do
38
+ default_url_options[:host] = "www.testapp.com"
39
+ needs_subdomain_url(:subdomain => false).should == "http://www.testapp.com/needs_subdomain"
40
+ end
41
+
42
+ it "should should force the full url, even with _path" do
43
+ needs_subdomain_path(:subdomain => "awesome").should == needs_subdomain_url(:subdomain => "awesome")
44
+ end
45
+ end
46
+
47
+ describe "Resourced Routes" do
48
+ it "should be able to add a subdomain" do
49
+ foo_path(:id => "something", :subdomain => "awesome").should == "http://awesome.testapp.com/foos/something"
50
+ end
51
+
52
+ it "should be able to remove a subdomain" do
53
+ default_url_options[:host] = "awesome.testapp.com"
54
+ foo_path(:id => "something", :subdomain => false).should == "http://testapp.com/foos/something"
55
+ end
56
+
57
+ it "should work when passed in a paramable object" do
58
+ foo_path(Paramed.new("something"), :subdomain => "awesome").should == "http://awesome.testapp.com/foos/something"
59
+ end
60
+
61
+ it "should work on nested resource collections" do
62
+ foo_bars_path(Paramed.new("something"), :subdomain => "awesome").should == "http://awesome.testapp.com/foos/something/bars"
63
+ end
64
+
65
+ it "should work on nested resource members" do
66
+ foo_bar_path(Paramed.new("something"),Paramed.new("else"), :subdomain => "awesome").should == "http://awesome.testapp.com/foos/something/bars/else"
67
+ end
68
+ end
69
+
70
+ describe "Preferred Mirror" do
71
+ before do
72
+ SubdomainFu.preferred_mirror = "www"
73
+ end
74
+
75
+ it "should switch to the preferred mirror instead of no subdomain" do
76
+ default_url_options[:host] = "awesome.testapp.com"
77
+ needs_subdomain_url(:subdomain => false).should == "http://www.testapp.com/needs_subdomain"
78
+ end
79
+
80
+ it "should force a switch to no subdomain on a mirror if preferred_mirror is false" do
81
+ SubdomainFu.preferred_mirror = false
82
+ default_url_options[:host] = "www.testapp.com"
83
+ needs_subdomain_url(:subdomain => false).should == "http://testapp.com/needs_subdomain"
84
+ end
85
+
86
+ after do
87
+ SubdomainFu.preferred_mirror = nil
88
+ end
89
+ end
90
+
91
+ after do
92
+ SubdomainFu.tld_size = 0
93
+ default_url_options[:host] = "localhost"
94
+ end
95
+ end
@@ -0,0 +1,26 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "subdomain-fu"
3
+ s.version = "0.0.2"
4
+ s.date = "2008-07-04"
5
+ s.summary = "Provides a simple solution for route handling and linking between subdomains in a Rails application."
6
+ s.email = "michael@intridea.com"
7
+ s.homepage = "http://www.actsascommunity.com/projects/subdomain-fu"
8
+ s.description = "SubdomainFu aims to solve the problem of subdomain-based routing and in a unified way, establishing simple conventions for linking between subdomains of a Rails app."
9
+ s.has_rdoc = true
10
+ s.authors = ["Michael Bleigh"]
11
+ s.files = [ "MIT-LICENSE",
12
+ "README",
13
+ "init.rb",
14
+ "lib/subdomain_fu",
15
+ "lib/subdomain_fu/routing_extensions.rb",
16
+ "lib/subdomain_fu/url_rewriter.rb",
17
+ "lib/subdomain-fu.rb",
18
+ "rails/init.rb",
19
+ "spec/spec_helper.rb",
20
+ "spec/subdomain_fu_spec.rb",
21
+ "spec/url_rewriter_spec.rb",
22
+ "subdomain-fu.gemspec" ]
23
+ s.rdoc_options = ["--main", "README"]
24
+ #s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
25
+ #s.add_dependency("mbleigh-mash", [">= 0.0.5"])
26
+ end
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jcnetdev-subdomain-fu
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Michael Bleigh
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-07-04 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: SubdomainFu aims to solve the problem of subdomain-based routing and in a unified way, establishing simple conventions for linking between subdomains of a Rails app.
17
+ email: michael@intridea.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - MIT-LICENSE
26
+ - README
27
+ - init.rb
28
+ - lib/subdomain_fu
29
+ - lib/subdomain_fu/routing_extensions.rb
30
+ - lib/subdomain_fu/url_rewriter.rb
31
+ - lib/subdomain-fu.rb
32
+ - rails/init.rb
33
+ - spec/spec_helper.rb
34
+ - spec/subdomain_fu_spec.rb
35
+ - spec/url_rewriter_spec.rb
36
+ - subdomain-fu.gemspec
37
+ has_rdoc: true
38
+ homepage: http://www.actsascommunity.com/projects/subdomain-fu
39
+ post_install_message:
40
+ rdoc_options:
41
+ - --main
42
+ - README
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: "0"
50
+ version:
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: "0"
56
+ version:
57
+ requirements: []
58
+
59
+ rubyforge_project:
60
+ rubygems_version: 1.2.0
61
+ signing_key:
62
+ specification_version: 2
63
+ summary: Provides a simple solution for route handling and linking between subdomains in a Rails application.
64
+ test_files: []
65
+