whitelabel 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +2 -0
- data/.rvmrc +1 -0
- data/.travis.yml +10 -0
- data/Gemfile.lock +1 -1
- data/README.md +29 -2
- data/Rakefile +10 -0
- data/lib/whitelabel/version.rb +1 -1
- data/spec/fixtures/whitelabel.yml +4 -2
- data/whitelabel.gemspec +2 -3
- metadata +12 -10
- data/LICENSE +0 -22
data/.document
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use 1.9.3@whitelabel --create
|
data/.travis.yml
ADDED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Whitelabel
|
2
2
|
|
3
|
-
|
3
|
+
This gem helps you providing whitelabel functionality in your application.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,7 +18,34 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
You can start with a pretty simple, file driven whitelabel configuration.
|
22
|
+
|
23
|
+
All you need is a config file:
|
24
|
+
|
25
|
+
# config/whitelabel.yaml
|
26
|
+
---
|
27
|
+
- !ruby/struct:YourLabelClass
|
28
|
+
label_id: "white"
|
29
|
+
some_config: "for your application"
|
30
|
+
|
31
|
+
and an initializer:
|
32
|
+
|
33
|
+
# config/initializers/whitelabel.rb
|
34
|
+
YourLabelClass = Struct.new :label_id, :some_config
|
35
|
+
Whitelabel.from_file Rails.root.join("config/whitelabel.yml")
|
36
|
+
|
37
|
+
Whitelabel works the same way I18n does, just set it up in your ApplicationController:
|
38
|
+
|
39
|
+
# app/controllers/application_controller.rb
|
40
|
+
before_filter :switch_label
|
41
|
+
|
42
|
+
def switch_label
|
43
|
+
unless Whitelabel.label_for(request.subdomains.first)
|
44
|
+
redirect_to(labels_url(subdomain: false), alert: "Please select a Label!") and return
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
This example uses the subdomain to determine which label should be active, but you can implement whatever you like here.
|
22
49
|
|
23
50
|
## Contributing
|
24
51
|
|
data/Rakefile
CHANGED
data/lib/whitelabel/version.rb
CHANGED
data/whitelabel.gemspec
CHANGED
@@ -2,10 +2,9 @@
|
|
2
2
|
require File.expand_path('../lib/whitelabel/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
|
-
gem.authors = ["Peter
|
5
|
+
gem.authors = ["Peter Schröder"]
|
6
6
|
gem.email = ["phoetmail@googlemail.com"]
|
7
|
-
gem.description
|
8
|
-
gem.summary = %q{use this gem if you want to provide whitelabel functionality for your app}
|
7
|
+
gem.description = gem.summary = %q{This gem helps you providing whitelabel functionality in your application}
|
9
8
|
gem.homepage = "https://github.com/phoet/whitelabel"
|
10
9
|
|
11
10
|
gem.files = `git ls-files`.split($\)
|
metadata
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whitelabel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
- Peter
|
8
|
+
- Peter Schröder
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70301997873560 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '2.9'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70301997873560
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: pry
|
27
|
-
requirement: &
|
27
|
+
requirement: &70301997873060 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,18 +32,20 @@ dependencies:
|
|
32
32
|
version: '0.9'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
36
|
-
description: whitelabel your application
|
35
|
+
version_requirements: *70301997873060
|
36
|
+
description: This gem helps you providing whitelabel functionality in your application
|
37
37
|
email:
|
38
38
|
- phoetmail@googlemail.com
|
39
39
|
executables: []
|
40
40
|
extensions: []
|
41
41
|
extra_rdoc_files: []
|
42
42
|
files:
|
43
|
+
- .document
|
43
44
|
- .rspec
|
45
|
+
- .rvmrc
|
46
|
+
- .travis.yml
|
44
47
|
- Gemfile
|
45
48
|
- Gemfile.lock
|
46
|
-
- LICENSE
|
47
49
|
- README.md
|
48
50
|
- Rakefile
|
49
51
|
- lib/whitelabel.rb
|
@@ -75,7 +77,7 @@ rubyforge_project:
|
|
75
77
|
rubygems_version: 1.8.17
|
76
78
|
signing_key:
|
77
79
|
specification_version: 3
|
78
|
-
summary:
|
80
|
+
summary: This gem helps you providing whitelabel functionality in your application
|
79
81
|
test_files:
|
80
82
|
- spec/fixtures/whitelabel.yml
|
81
83
|
- spec/lib/whitelabel_spec.rb
|
data/LICENSE
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2012 Peter Schröder
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|