subdomain-fu 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,9 +12,9 @@ install it as a traditional plugin (Rails 2.1 or later):
12
12
 
13
13
  script/plugin install git://github.com/mbleigh/subdomain-fu.git
14
14
 
15
- To use it as a GemPlugin, add it to your environment.rb:
15
+ To use it as a gem, add it to your config/environment.rb:
16
16
 
17
- config.gem 'mbleigh-subdomain-fu', :source => "http://gems.github.com", :lib => "subdomain-fu"
17
+ config.gem 'subdomain-fu'
18
18
 
19
19
 
20
20
  == Examples
@@ -26,21 +26,21 @@ option both in named and non-named routes as well as in generated resources rout
26
26
  Let's say my domain is 'intridea.com'. Here are some examples of the use of the :subdomain
27
27
  option:
28
28
 
29
- url_for(:controller => "my_controller",
30
- :action => "my_action",
31
- :subdomain => "awesome") # => http://awesome.intridea.com/my_controller/my_action
29
+ url_for(:controller => "my_controller",
30
+ :action => "my_action",
31
+ :subdomain => "awesome") # => http://awesome.intridea.com/my_controller/my_action
32
32
 
33
33
  Now let's say I'm at http://awesome.intridea.com/ and I want back to the root.
34
34
  Specifying "false" will remove any current subdomain:
35
35
 
36
- users_url(:subdomain => false) # => http://intridea.com/users
36
+ users_url(:subdomain => false) # => http://intridea.com/users
37
37
 
38
38
  Note that this plugin does not honor the :only_path notion of routing when doing
39
39
  so would go against the intent of the command. For example, if I were at http://intridea.com
40
40
  again:
41
41
 
42
- users_path(:subdomain => "fun") # => http://fun.intridea.com/users
43
- users_path(:subdomain => false) # => /users
42
+ users_path(:subdomain => "fun") # => http://fun.intridea.com/users
43
+ users_path(:subdomain => false) # => /users
44
44
 
45
45
  In this way you can rest assured that you will never misdirect your links to the
46
46
  same subdomain when you meant to change it.
@@ -49,11 +49,9 @@ same subdomain when you meant to change it.
49
49
 
50
50
  You have access to current_subdomain and current_domain methods.
51
51
 
52
- current_subdomain - returns all subdomains.
53
- Example for the URL http://awesome.website.stuff.example.com current_subdomain will return "awesome.website.stuff"
52
+ [current_subdomain] returns all subdomains. For the URL http://awesome.website.stuff.example.com, it will return "awesome.website.stuff"
54
53
 
55
- current_domain - returns all subdomains except for the subdomain, including the TLD.
56
- Example for the URL http://awesome.website.stuff.example.com current_subdomain will return "website.stuff.example.com"
54
+ [current_domain] returns all subdomains except for the subdomain, including the TLD. For the URL http://awesome.website.stuff.example.com, it will return "website.stuff.example.com"
57
55
 
58
56
  If what you really want is the entire domain, then use <tt>request.domain</tt> in
59
57
  your controllers. The purpose of current_domain is to only strip off the first
@@ -69,17 +67,17 @@ configuration required is:
69
67
  A hash for each environment of the size of the top-level domain name.
70
68
  (something.com = 1, localhost = 0, etc.)
71
69
 
72
- SubdomainFu.tld_size = 1 # sets for current environment
73
- SubdomainFu.tld_sizes = {:development => 0,
74
- :test => 0,
75
- :production => 1} # set all at once (also the defaults)
70
+ SubdomainFu.tld_size = 1 # sets for current environment
71
+ SubdomainFu.tld_sizes = {:development => 0,
72
+ :test => 0,
73
+ :production => 1} # set all at once (also the defaults)
76
74
 
77
75
  === Mirrors
78
76
 
79
77
  Mirrors are the subdomains that are equivalent to no subdomain (i.e. they 'mirror')
80
78
  the usage of the root domain.
81
79
 
82
- SubdomainFu.mirrors = %w(www site we) # Defaults to %w(www)
80
+ SubdomainFu.mirrors = %w(www site we) # Defaults to %w(www)
83
81
 
84
82
  === Preferred Mirror
85
83
 
@@ -87,23 +85,21 @@ SubdomainFu also understands the notion of a 'preferred mirror', that is, if you
87
85
  always want your links going to 'www.yourdomain.com' instead of 'yourdomain.com',
88
86
  you can set the preferred mirror like so:
89
87
 
90
- SubdomainFu.preferred_mirror = "www"
88
+ SubdomainFu.preferred_mirror = "www"
91
89
 
92
- Now when you create a link with subdomain => false in the options the subdomain
90
+ Now when you create a link with <tt>:subdomain => false</tt> in the options the subdomain
93
91
  will default to the preferred mirror.
94
92
 
95
93
  == Routing
96
94
 
97
- SubdomainFu can also work within Rails' routing for subdomain-specific routes. For instance, if you only wanted your administrative tools available in the "admin" subdomain you could add this to your routes.rb file:
95
+ SubdomainFu can also work within Rails' routing for subdomain-specific routes. For instance, if you only wanted your administrative tools available in the "admin" subdomain you could add this to your <tt>config/routes.rb</tt> file:
98
96
 
99
- map.with_options :conditions => {:subdomain => 'admin'} do |admin|
100
- admin.resources :posts
101
- admin.resources :users
102
- end
97
+ map.with_options :conditions => {:subdomain => 'admin'} do |admin|
98
+ admin.resources :posts
99
+ admin.resources :users
100
+ end
103
101
 
104
- In addition to specifying a string, you could also specify <tt>false</tt> to
105
- require no subdomain (this includes mirrors that you've set up such as www)
106
- or a regular expression to match a range of subdomains.
102
+ In addition to specifying a string, you could also specify <tt>false</tt> to require no subdomain (this includes mirrors that you've set up such as www) or a regular expression to match a range of subdomains.
107
103
 
108
104
  == Resources
109
105
 
data/Rakefile CHANGED
@@ -22,6 +22,7 @@ begin
22
22
  gemspec.description = "SubdomainFu is a Rails plugin to provide all of the basic functionality necessary to handle multiple subdomain applications (such as Basecamp-esque subdomain accounts and more)."
23
23
  gemspec.authors = ["Michael Bleigh"]
24
24
  end
25
+ Jeweler::GemcutterTasks.new
25
26
  rescue LoadError
26
27
  puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
27
28
  end
@@ -1,4 +1,5 @@
1
1
  ---
2
- :minor: 5
3
- :patch: 3
4
2
  :major: 0
3
+ :build:
4
+ :minor: 5
5
+ :patch: 4
@@ -24,7 +24,7 @@ module SubdomainFu
24
24
 
25
25
  def extract_request_environment_with_subdomain(request)
26
26
  env = extract_request_environment_without_subdomain(request)
27
- env.merge(:host => request.host, :domain => request.domain, :subdomain => SubdomainFu.subdomain_from(request.host))
27
+ env.merge(:host => request.host, :domain => request.domain, :subdomain => SubdomainFu.current_subdomain(request))
28
28
  end
29
29
  end
30
30
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: subdomain-fu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bleigh
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-13 00:00:00 -04:00
12
+ date: 2010-01-18 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -59,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
59
59
  requirements: []
60
60
 
61
61
  rubyforge_project: subdomain-fu
62
- rubygems_version: 1.3.3
62
+ rubygems_version: 1.3.5
63
63
  signing_key:
64
64
  specification_version: 3
65
65
  summary: SubdomainFu is a Rails plugin that provides subdomain routing and URL writing helpers.