current_domain 0.1 → 1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f1f419cf7392240c684f72be31a34a5aa09a3081
4
- data.tar.gz: e9f38edee46a2022383909f757fcd818ecbc5779
3
+ metadata.gz: a97fed5087cb94a9e0cdc46a9e643174ba3f7612
4
+ data.tar.gz: 6ff78889a3a1b98020c74b3e8a8291b846d5df44
5
5
  SHA512:
6
- metadata.gz: bcb4cba719a7a71770effedc11903a854e9a9f29daffd55a60ef12d8c0afaeeef522b2f7e5a870c82db3ce79f5252ae8919c84992dc31686868d5d36f0cb7241
7
- data.tar.gz: acdd1bfb50c98882536434c80860f9a55ead3082135831aeb6f5f30bd6a9e7681766bb1932896332d83e1d506191f2edb3be9688f812fc583334e20ab8417956
6
+ metadata.gz: f8e3e4ebe1dbe19a8a77403da50d581dbe5f8cc132db07888aff9890a372d30820486bdab802b67561850efdaa165e4818c0222c7204bb5c7b371a70bc7fde35
7
+ data.tar.gz: 757d0c73d183f701931dd232aa558daa0f78c74d55a724b3d4ea51aae4e6933e52aeafc516f52c28be3c9bcce33014e8854d30cefaf288783c31c206b8daf253
@@ -3,3 +3,6 @@ rvm:
3
3
  - 2.1.0
4
4
  - 2.0.0
5
5
  - 1.9.3
6
+ addons:
7
+ code_climate:
8
+ repo_token: 6df994a3bb7f7f6b4028d88684576ea7d1e69c126a0bd25b8a3fca03cdb390cc
data/README.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/andrewgr/current_domain.png)](https://travis-ci.org/andrewgr/current_domain)
4
4
  [![Code Climate](https://codeclimate.com/github/andrewgr/current_domain/badges/gpa.svg)](https://codeclimate.com/github/andrewgr/current_domain)
5
+ [![Test Coverage](https://codeclimate.com/github/andrewgr/current_domain/badges/coverage.svg)](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
- TODO
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
 
@@ -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 'shoulda', '~> 3.5'
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
@@ -1,4 +1,4 @@
1
1
  module CurrentDomain
2
2
  # Gem version
3
- VERSION = '0.1'
3
+ VERSION = '1.0'
4
4
  end
@@ -1,2 +1,5 @@
1
+ require 'codeclimate-test-reporter'
2
+ CodeClimate::TestReporter.start
3
+
1
4
  require 'current_domain'
2
5
  require 'action_controller'
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.1'
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-04-25 00:00:00.000000000 Z
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: shoulda
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: '3.5'
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: 2.8.0
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: '2.8'
105
+ version: '0.4'
120
106
  - - ">="
121
107
  - !ruby/object:Gem::Version
122
- version: 2.8.0
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