current_domain 0.1 → 1.0
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.
- checksums.yaml +4 -4
 - data/.travis.yml +3 -0
 - data/README.md +10 -1
 - data/current_domain.gemspec +1 -2
 - data/lib/current_domain/version.rb +1 -1
 - data/spec/spec_helper.rb +3 -0
 - metadata +7 -21
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: a97fed5087cb94a9e0cdc46a9e643174ba3f7612
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 6ff78889a3a1b98020c74b3e8a8291b846d5df44
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: f8e3e4ebe1dbe19a8a77403da50d581dbe5f8cc132db07888aff9890a372d30820486bdab802b67561850efdaa165e4818c0222c7204bb5c7b371a70bc7fde35
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 757d0c73d183f701931dd232aa558daa0f78c74d55a724b3d4ea51aae4e6933e52aeafc516f52c28be3c9bcce33014e8854d30cefaf288783c31c206b8daf253
         
     | 
    
        data/.travis.yml
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -2,6 +2,11 @@ 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            [](https://travis-ci.org/andrewgr/current_domain)
         
     | 
| 
       4 
4 
     | 
    
         
             
            [](https://codeclimate.com/github/andrewgr/current_domain)
         
     | 
| 
      
 5 
     | 
    
         
            +
            [](https://codeclimate.com/github/andrewgr/current_domain/coverage)
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Some Rails apps have to be available on multiple domains, for example, acmeinc.com, acmeinc.ru, acmeinc.com.au. Quite often in this case the app has to know the current domain to adjust the UI or do some customization.
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            This gem adds `current_domain` helper method to all the controllers and views of the app. The method returns the host name at which the web app is currently accessed. It can also be customized to return custom objects for different domains if, for example, the app has Domain or Host model that represent each of the app domains.
         
     | 
| 
       5 
10 
     | 
    
         | 
| 
       6 
11 
     | 
    
         
             
            ## Installation
         
     | 
| 
       7 
12 
     | 
    
         | 
| 
         @@ -19,7 +24,11 @@ Or install it yourself as: 
     | 
|
| 
       19 
24 
     | 
    
         | 
| 
       20 
25 
     | 
    
         
             
            ## Usage
         
     | 
| 
       21 
26 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
      
 27 
     | 
    
         
            +
            Once this gem is included into Gemfile of a Rails app, `current_domain` helper method is available in all controllers and views of the applications. If an app has models or other classes that represent each app domain then add similar code to `ApplicationController` to return custom objects instead of host names:
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                def find_domain(host)
         
     | 
| 
      
 30 
     | 
    
         
            +
                  Domain.find_by_host(host)
         
     | 
| 
      
 31 
     | 
    
         
            +
                end
         
     | 
| 
       23 
32 
     | 
    
         | 
| 
       24 
33 
     | 
    
         
             
            ## Contributing
         
     | 
| 
       25 
34 
     | 
    
         | 
    
        data/current_domain.gemspec
    CHANGED
    
    | 
         @@ -21,6 +21,5 @@ Gem::Specification.new do |gem| 
     | 
|
| 
       21 
21 
     | 
    
         
             
              gem.add_development_dependency 'actionpack', '~> 4'
         
     | 
| 
       22 
22 
     | 
    
         
             
              gem.add_development_dependency 'rubocop', '~> 0.30'
         
     | 
| 
       23 
23 
     | 
    
         
             
              gem.add_development_dependency 'cane', '~> 2.6', '>= 2.6.1'
         
     | 
| 
       24 
     | 
    
         
            -
              gem.add_development_dependency ' 
     | 
| 
       25 
     | 
    
         
            -
              gem.add_development_dependency 'shoulda-matchers', '~> 2.8', '>= 2.8.0'
         
     | 
| 
      
 24 
     | 
    
         
            +
              gem.add_development_dependency 'codeclimate-test-reporter', '~> 0.4', '>= 0.4.7'
         
     | 
| 
       26 
25 
     | 
    
         
             
            end
         
     | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: current_domain
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: '0 
     | 
| 
      
 4 
     | 
    
         
            +
              version: '1.0'
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Andrei Gridnev
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2015- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-05-10 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: activesupport
         
     | 
| 
         @@ -87,39 +87,25 @@ dependencies: 
     | 
|
| 
       87 
87 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       88 
88 
     | 
    
         
             
                    version: 2.6.1
         
     | 
| 
       89 
89 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       90 
     | 
    
         
            -
              name:  
     | 
| 
      
 90 
     | 
    
         
            +
              name: codeclimate-test-reporter
         
     | 
| 
       91 
91 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       92 
92 
     | 
    
         
             
                requirements:
         
     | 
| 
       93 
93 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       94 
94 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       95 
     | 
    
         
            -
                    version: ' 
     | 
| 
       96 
     | 
    
         
            -
              type: :development
         
     | 
| 
       97 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       98 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       99 
     | 
    
         
            -
                requirements:
         
     | 
| 
       100 
     | 
    
         
            -
                - - "~>"
         
     | 
| 
       101 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       102 
     | 
    
         
            -
                    version: '3.5'
         
     | 
| 
       103 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       104 
     | 
    
         
            -
              name: shoulda-matchers
         
     | 
| 
       105 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       106 
     | 
    
         
            -
                requirements:
         
     | 
| 
       107 
     | 
    
         
            -
                - - "~>"
         
     | 
| 
       108 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       109 
     | 
    
         
            -
                    version: '2.8'
         
     | 
| 
      
 95 
     | 
    
         
            +
                    version: '0.4'
         
     | 
| 
       110 
96 
     | 
    
         
             
                - - ">="
         
     | 
| 
       111 
97 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       112 
     | 
    
         
            -
                    version:  
     | 
| 
      
 98 
     | 
    
         
            +
                    version: 0.4.7
         
     | 
| 
       113 
99 
     | 
    
         
             
              type: :development
         
     | 
| 
       114 
100 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       115 
101 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       116 
102 
     | 
    
         
             
                requirements:
         
     | 
| 
       117 
103 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       118 
104 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       119 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 105 
     | 
    
         
            +
                    version: '0.4'
         
     | 
| 
       120 
106 
     | 
    
         
             
                - - ">="
         
     | 
| 
       121 
107 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       122 
     | 
    
         
            -
                    version:  
     | 
| 
      
 108 
     | 
    
         
            +
                    version: 0.4.7
         
     | 
| 
       123 
109 
     | 
    
         
             
            description: Adds current_domain helper method to ActionController::Base
         
     | 
| 
       124 
110 
     | 
    
         
             
            email:
         
     | 
| 
       125 
111 
     | 
    
         
             
            - andrew.gridnev@gmail.com
         
     |