time_pilot 0.0.2 → 0.0.3

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: e30816cd185929b8db4677c3eeba8d1200f4acdf
4
- data.tar.gz: 7885bfb2cddd2862470aa34d38df4ed0179793ec
3
+ metadata.gz: c1f9afe164ee4f13577e874e73d5dbf04f8e39e2
4
+ data.tar.gz: dbf61d674c7ac05d8e8340e5fce3fdcfd7b0c44f
5
5
  SHA512:
6
- metadata.gz: b67e44321f7a86052d17c0bb73ca1a43eaa435b88b8c6bda7cef90f215efa627f9defbd6febdf27f705f0221730c45906c411569d29948b0fc2cf28d12f112d1
7
- data.tar.gz: 9924dcfc8baf230d40fa53b5935d5f635bfb9e73b3c451ec9636726afa4d01acffc8d070a5011c72a328625c9d351237dc43c93cbec2d6b16bae0e1c1329e9d4
6
+ metadata.gz: 72cdda496b3cde20855bc26c24816fd4fd9995b34c259d1b89c87d4dac6742ddce6ae6142e604c925224ceffc62aa6dfe243ed9aeb4e4fcbe861db01822ff478
7
+ data.tar.gz: 3075ae51b632e0c686b7ef75efaebec5aa905e6e34fdff0cb201ab5ac2477521366c64ed14f54d401ca87b4bd832512a07c756045e9b9a85e1a7c5f6c39ef57d
@@ -41,22 +41,22 @@ module TimePilot
41
41
  module ClassMethods
42
42
  attr_reader :time_pilot_groups
43
43
  def is_pilot_group options={}
44
- @time_pilot_groups = Array(options[:overridden_by]).map { |e| e.to_s } + [self.name.downcase.to_s]
44
+ @time_pilot_groups = Array(options[:overridden_by]).map { |e| e.to_s } + [self.to_s.underscore]
45
45
  end
46
46
  end
47
47
 
48
48
  def pilot_enable_feature(feature_name)
49
- TimePilot.redis.sadd TimePilot.key("#{feature_name}:#{self.class.to_s.downcase}_ids"), id
49
+ TimePilot.redis.sadd TimePilot.key("#{feature_name}:#{self.class.to_s.underscore}_ids"), id
50
50
  end
51
51
 
52
52
  def pilot_disable_feature(feature_name)
53
- TimePilot.redis.srem TimePilot.key("#{feature_name}:#{self.class.to_s.downcase}_ids"), id
53
+ TimePilot.redis.srem TimePilot.key("#{feature_name}:#{self.class.to_s.underscore}_ids"), id
54
54
  end
55
55
 
56
56
  def pilot_feature_enabled?(feature_name)
57
57
  TimePilot.redis.pipelined {
58
58
  self.class.time_pilot_groups.each do |group|
59
- method = group.to_s == self.class.to_s.downcase ? 'id' : group + '_id'
59
+ method = group.to_s == self.class.to_s.underscore ? 'id' : group + '_id'
60
60
  TimePilot.redis.sismember TimePilot.key("#{feature_name}:#{group}_ids"), send(method)
61
61
  end
62
62
  }.include? true
@@ -0,0 +1,3 @@
1
+ module TimePilot
2
+ VERSION = '0.0.3'
3
+ end
data/lib/time_pilot.rb CHANGED
@@ -1,3 +1,5 @@
1
1
  require 'redis'
2
+ require 'active_support/core_ext/string/inflections'
3
+ require_relative 'time_pilot/version'
2
4
  require_relative 'time_pilot/time_pilot'
3
5
  require_relative 'time_pilot/configuration'
@@ -112,3 +112,14 @@ describe TimePilot do
112
112
  @jane.planning_enabled?.must_equal true
113
113
  end
114
114
  end
115
+
116
+ class CamelCasedModel
117
+ include TimePilot::Features
118
+ is_pilot_group
119
+ end
120
+
121
+ describe TimePilot, 'converting CamelCase to camel_case' do
122
+ it do
123
+ CamelCasedModel.time_pilot_groups.must_equal ['camel_cased_model']
124
+ end
125
+ end
data/time_pilot.gemspec CHANGED
@@ -1,8 +1,10 @@
1
+ require_relative 'lib/time_pilot/version'
2
+
1
3
  Gem::Specification.new do |s|
2
4
  s.name = 'time_pilot'
3
5
  s.summary = 'Configure enabled features for a specific set of users.'
4
6
  s.description = ''
5
- s.version = '0.0.2'
7
+ s.version = TimePilot::VERSION
6
8
  s.platform = Gem::Platform::RUBY
7
9
  s.license = 'MIT'
8
10
 
@@ -15,5 +17,6 @@ Gem::Specification.new do |s|
15
17
  s.homepage = 'https://github.com/nedap/time_pilot'
16
18
 
17
19
  s.add_dependency 'redis', '>= 3.0.0'
20
+ s.add_dependency 'activesupport', '>= 3.0.0'
18
21
  s.add_development_dependency "minitest"
19
22
  end
metadata CHANGED
@@ -1,42 +1,56 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: time_pilot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
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-06-05 00:00:00.000000000 Z
12
+ date: 2014-07-02 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
+ - !ruby/object:Gem::Version
27
+ version: 3.0.0
28
+ - !ruby/object:Gem::Dependency
29
+ name: activesupport
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '>='
33
+ - !ruby/object:Gem::Version
34
+ version: 3.0.0
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '>='
26
40
  - !ruby/object:Gem::Version
27
41
  version: 3.0.0
28
42
  - !ruby/object:Gem::Dependency
29
43
  name: minitest
30
44
  requirement: !ruby/object:Gem::Requirement
31
45
  requirements:
32
- - - ">="
46
+ - - '>='
33
47
  - !ruby/object:Gem::Version
34
48
  version: '0'
35
49
  type: :development
36
50
  prerelease: false
37
51
  version_requirements: !ruby/object:Gem::Requirement
38
52
  requirements:
39
- - - ">="
53
+ - - '>='
40
54
  - !ruby/object:Gem::Version
41
55
  version: '0'
42
56
  description: ''
@@ -47,8 +61,8 @@ executables: []
47
61
  extensions: []
48
62
  extra_rdoc_files: []
49
63
  files:
50
- - ".gitignore"
51
- - ".travis.yml"
64
+ - .gitignore
65
+ - .travis.yml
52
66
  - AUTHORS
53
67
  - Gemfile
54
68
  - LICENSE
@@ -57,6 +71,7 @@ files:
57
71
  - lib/time_pilot.rb
58
72
  - lib/time_pilot/configuration.rb
59
73
  - lib/time_pilot/time_pilot.rb
74
+ - lib/time_pilot/version.rb
60
75
  - test/time_pilot_test.rb
61
76
  - time_pilot.gemspec
62
77
  homepage: https://github.com/nedap/time_pilot
@@ -69,12 +84,12 @@ require_paths:
69
84
  - lib
70
85
  required_ruby_version: !ruby/object:Gem::Requirement
71
86
  requirements:
72
- - - ">="
87
+ - - '>='
73
88
  - !ruby/object:Gem::Version
74
89
  version: '0'
75
90
  required_rubygems_version: !ruby/object:Gem::Requirement
76
91
  requirements:
77
- - - ">="
92
+ - - '>='
78
93
  - !ruby/object:Gem::Version
79
94
  version: '0'
80
95
  requirements: []
@@ -84,3 +99,4 @@ signing_key:
84
99
  specification_version: 4
85
100
  summary: Configure enabled features for a specific set of users.
86
101
  test_files: []
102
+ has_rdoc: