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 ADDED
@@ -0,0 +1,2 @@
1
+ lib/**/*.rb
2
+ README.md
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use 1.9.3@whitelabel --create
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
1
+ script: "bundle exec rake"
2
+ rvm:
3
+ - 1.8.7
4
+ - 1.9.2
5
+ - 1.9.3
6
+ - rbx
7
+ - rbx-2.0
8
+ - ree
9
+ - ruby-head
10
+ - jruby
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- whitelabel (0.0.1)
4
+ whitelabel (0.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Whitelabel
2
2
 
3
- TODO: Write a gem description
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
- TODO: Write usage instructions here
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
@@ -1,2 +1,12 @@
1
1
  #!/usr/bin/env rake
2
2
  require "bundler/gem_tasks"
3
+ require "rspec/core/rake_task"
4
+
5
+ Bundler::GemHelper.install_tasks
6
+
7
+ RSpec::Core::RakeTask.new do |t|
8
+ t.rspec_opts = ["--color"]
9
+ t.pattern = 'spec/**/*_spec.rb'
10
+ end
11
+
12
+ task :default => :spec
@@ -1,3 +1,3 @@
1
1
  module Whitelabel
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -1,5 +1,7 @@
1
1
  ---
2
- - &70266423416560 !ruby/struct:Dummy
2
+ - !ruby/struct:Dummy
3
3
  label_id: test
4
4
  name: bla
5
- - *70266423416560
5
+ - !ruby/struct:Dummy
6
+ label_id: uschi
7
+ name: "Uschi Müller"
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 Schröder"]
5
+ gem.authors = ["Peter Schröder"]
6
6
  gem.email = ["phoetmail@googlemail.com"]
7
- gem.description = %q{whitelabel your application}
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.1
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
- - Peter Schröder
8
+ - Peter Schröder
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-03 00:00:00.000000000 Z
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: &70306368111360 !ruby/object:Gem::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: *70306368111360
24
+ version_requirements: *70301997873560
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: pry
27
- requirement: &70306368110860 !ruby/object:Gem::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: *70306368110860
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: use this gem if you want to provide whitelabel functionality for your app
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.