rails-subdomain 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -1,24 +1,36 @@
1
- # Rails::Subdomain
1
+ # Rails Subdomain
2
2
 
3
- TODO: Write a gem description
3
+ Subdomains in rails are [still a bit hairy](https://gist.github.com/1939812).
4
4
 
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- gem 'rails-subdomain'
10
-
11
- And then execute:
12
-
13
- $ bundle
14
-
15
- Or install it yourself as:
16
-
17
- $ gem install rails-subdomain
5
+ This is a growing collection of helpers and monkey patches to make it better(tm).
18
6
 
19
7
  ## Usage
20
8
 
21
- TODO: Write usage instructions here
9
+ ```ruby
10
+ My::Application.routes.draw do
11
+ subdomain /\A(www|)\Z/, default: "www" do
12
+ root to: "home#show"
13
+ end
14
+
15
+ subdomain :admin, module: "admin", as: "admin" do
16
+ root to: "admin/dashboard#show"
17
+ end
18
+ end
19
+ ```
20
+
21
+ This will route `http://mydomain.com` and `http://www.mydomain.com` in the
22
+ first subdomain scope, and `http://admin.mydomain.com` in the second scope.
23
+ If you have different number of TLDs (the `.com` bit, default is 1) change
24
+ `config.action_dispatch.tld_length` in your `config/application.rb` or
25
+ any `config/environments/*.rb` file. For example, `http://www.mydomain.com.au`
26
+ would need to change the `tld_length` to 2 (`.com.au`).
27
+
28
+ When on the home show page, `admin_root_path` will render a full URL,
29
+ `http://admin.mydomain.com/`, because it knows you'll cross subdomains.
30
+ From the admin dashboard, `admin_root_path` will be `/`, but `root_path`
31
+ will be `http://www.mydomain.com/`.
32
+
33
+ There will be test helpers added for capybara/selenium/cucumber super-soon.
22
34
 
23
35
  ## Contributing
24
36
 
@@ -5,8 +5,5 @@ end
5
5
 
6
6
  require 'rails/subdomain/version'
7
7
  require 'rails/subdomain/cucumber' if defined? Cucumber
8
-
9
- ActiveSupport.on_load :action_controller do
10
- require 'rails/subdomain/mapper'
11
- require 'rails/subdomain/url_for'
12
- end
8
+ require 'rails/subdomain/mapper'
9
+ require 'rails/subdomain/url_for'
@@ -1,5 +1,5 @@
1
1
  module Rails
2
2
  module Subdomain
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-subdomain
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-08 00:00:00.000000000 Z
12
+ date: 2012-07-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70325238263920 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,7 +21,12 @@ dependencies:
21
21
  version: 3.2.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70325238263920
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.0
25
30
  description: Some convenience methods making subdomains in Rails a whole lot easier.
26
31
  email: sj26@sj26.com
27
32
  executables: []
@@ -60,9 +65,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
65
  version: '0'
61
66
  requirements: []
62
67
  rubyforge_project:
63
- rubygems_version: 1.8.11
68
+ rubygems_version: 1.8.23
64
69
  signing_key:
65
70
  specification_version: 3
66
71
  summary: Rails subdomain helpers.
67
72
  test_files: []
68
- has_rdoc: