time_pilot 0.0.3 → 0.0.4

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: c1f9afe164ee4f13577e874e73d5dbf04f8e39e2
4
- data.tar.gz: dbf61d674c7ac05d8e8340e5fce3fdcfd7b0c44f
3
+ metadata.gz: fbeca7afffcc0db740f30a3337ad4fc3b0841586
4
+ data.tar.gz: 22c08aef2488cdcdc7b85d2fb7a79c140ea3139a
5
5
  SHA512:
6
- metadata.gz: 72cdda496b3cde20855bc26c24816fd4fd9995b34c259d1b89c87d4dac6742ddce6ae6142e604c925224ceffc62aa6dfe243ed9aeb4e4fcbe861db01822ff478
7
- data.tar.gz: 3075ae51b632e0c686b7ef75efaebec5aa905e6e34fdff0cb201ab5ac2477521366c64ed14f54d401ca87b4bd832512a07c756045e9b9a85e1a7c5f6c39ef57d
6
+ metadata.gz: 374d7cf4de3ea502124796c2f45a78f2341e7d1a875683b5f0e94c12905d5dc7395f4c08a9bdf5e9547fc3bf158e196179fe899c8b48e9808d0455c12c1200cf
7
+ data.tar.gz: 4307f16f7c2d6a361405b6b2b2334bd168fcc056d8f6755a5ed918120769d0bac8739af1fe7cb2c68db9c888ffada1ae036df5a82f61d92a46922040bbbd3689
data/.travis.yml CHANGED
@@ -2,5 +2,6 @@ language: ruby
2
2
  rvm:
3
3
  - 2.0
4
4
  - 2.1
5
+ - 2.2
5
6
  services:
6
7
  - redis-server
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # TimePilot ![Build Status](https://magnum.travis-ci.com/nedap/time_pilot.svg?token=xp5ywq16hRcpzRui8vVa&branch=master) ![Code Climate](https://codeclimate.com/repos/538c225ae30ba00d55006394/badges/1741b217ec9818699a37/gpa.png)
1
+ # TimePilot [![Build Status](https://travis-ci.org/nedap/time_pilot.svg)](https://travis-ci.org/nedap/time_pilot) ![Code Climate](https://codeclimate.com/repos/538c225ae30ba00d55006394/badges/1741b217ec9818699a37/gpa.png)
2
2
 
3
3
  TimePilot is a RubyGem that makes it possible to define features that can be enabled for a certain group of users. It requires very little configuration, and is designed to work stand-alone on any object. TimePilot uses Redis for storage.
4
4
 
@@ -79,6 +79,22 @@ TimePilot.configure do |c|
79
79
  end
80
80
  ```
81
81
 
82
+ ## Multiple configure blocks
83
+
84
+ TimePilot allows you to specify more than one configure block. This allows you to specify features at multiple levels. For example, you could specify features in a Rails Engine located in a separate gem, as well as the host application. It's easy as this:
85
+
86
+ ```ruby
87
+ # vendor/gems/.../config/initializers/time_pilot.rb
88
+ TimePilot.configure do |c|
89
+ c.feature :this_could_be_my_rails_engine
90
+ end
91
+
92
+ # config/initializers/time_pilot.rb
93
+ TimePilot.configure do |c|
94
+ c.feature :this_is_my_host_application
95
+ end
96
+ ```
97
+
82
98
  TimePilot assumes you put in an object that responds to `#sadd`, `#srem` and `#sismember`.
83
99
 
84
100
  # Usage
@@ -2,7 +2,7 @@ module TimePilot
2
2
  NAMESPACE = 'timepilot'
3
3
 
4
4
  def self.configure
5
- @config = Configuration.new
5
+ @config ||= Configuration.new
6
6
  yield @config
7
7
  @config.features.each do |feature_name|
8
8
  Features.module_eval do
@@ -1,3 +1,3 @@
1
1
  module TimePilot
2
- VERSION = '0.0.3'
3
- end
2
+ VERSION = '0.0.4'
3
+ end
@@ -35,6 +35,10 @@ TimePilot.configure do |c|
35
35
  c.feature 'planning'
36
36
  end
37
37
 
38
+ TimePilot.configure do |c|
39
+ c.feature 'secret_feature'
40
+ end
41
+
38
42
  describe TimePilot do
39
43
  before do
40
44
  TimePilot.redis.flushdb
@@ -46,6 +50,12 @@ describe TimePilot do
46
50
  @jane = Employee.new(@nedap.id, @healthcare.id, 22)
47
51
  end
48
52
 
53
+ it 'allows multiple configure blocks to add features' do
54
+ TimePilot.features.must_equal ['planning', 'secret_feature']
55
+ @acme.planning_enabled?.must_equal false
56
+ @acme.secret_feature_enabled?.must_equal false
57
+ end
58
+
49
59
  it 'defines a getter on company' do
50
60
  TimePilot.redis.sadd 'timepilot:planning:company_ids', @acme.id
51
61
  @acme.planning_enabled?.must_equal true
metadata CHANGED
@@ -1,56 +1,56 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: time_pilot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
- - '@mlangenberg'
8
- - '@markoudev'
7
+ - "@mlangenberg"
8
+ - "@markoudev"
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-07-02 00:00:00.000000000 Z
12
+ date: 2015-01-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redis
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - '>='
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: 3.0.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - '>='
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: 3.0.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: activesupport
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - '>='
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: 3.0.0
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - '>='
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: 3.0.0
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: minitest
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - '>='
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - '>='
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  description: ''
@@ -61,8 +61,8 @@ executables: []
61
61
  extensions: []
62
62
  extra_rdoc_files: []
63
63
  files:
64
- - .gitignore
65
- - .travis.yml
64
+ - ".gitignore"
65
+ - ".travis.yml"
66
66
  - AUTHORS
67
67
  - Gemfile
68
68
  - LICENSE
@@ -84,12 +84,12 @@ require_paths:
84
84
  - lib
85
85
  required_ruby_version: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  requirements:
92
- - - '>='
92
+ - - ">="
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0'
95
95
  requirements: []