ar_rollout 0.0.15 → 0.0.17

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -118,6 +118,12 @@ List known features with:
118
118
  - Merge ArRollout and Rollout class methods
119
119
  - Autodetection of new features from code, before rollout begins
120
120
 
121
+ ## Version 0.0.17 - 29 Nov 2012
122
+ - ArRollout caches groups
123
+
124
+ ## Version 0.0.16 - 29 Nov 2012
125
+ - Add rake task 'rollout:summary'
126
+
121
127
  ## Version 0.0.14 - 28 Nov 2012
122
128
  - Add rake task 'rollout:list'
123
129
 
@@ -1,11 +1,19 @@
1
1
  require 'ar_rollout/rollout.rb'
2
2
  require 'ar_rollout/helper.rb'
3
3
  module ArRollout
4
+ @@groups = []
5
+
4
6
  def self.configure
5
7
  yield self
6
8
  end
7
9
 
10
+ def self.groups
11
+ @@groups
12
+ end
13
+
8
14
  def self.define_group(name, &block)
15
+ @@groups << name
16
+
9
17
  Rollout.send :define_method, "match_#{name}?" do |b|
10
18
  block.call(b)
11
19
  end
@@ -1,3 +1,3 @@
1
1
  module ArRollout
2
- VERSION = "0.0.15"
2
+ VERSION = "0.0.17"
3
3
  end
@@ -3,28 +3,51 @@ namespace :rollout do
3
3
  task :activate_user, [:feature, :user_id] => :environment do |t, args|
4
4
  ArRollout.activate_user(args.feature,args.user_id)
5
5
  end
6
+
6
7
  desc "Deactivate a feature for a specific user"
7
8
  task :deactivate_user, [:feature, :user_id] => :environment do |t, args|
8
9
  ArRollout.deactivate_user(args.feature,args.user_id)
9
10
  end
11
+
10
12
  desc "Activate a feature for a group"
11
13
  task :activate_group, [:feature, :user_id] => :environment do |t, args|
12
14
  ArRollout.activate_group(args.feature,args.user_id)
13
15
  end
16
+
14
17
  desc "Deactivate a feature for a group"
15
18
  task :deactivate_group, [:feature, :user_id] => :environment do |t, args|
16
19
  ArRollout.deactivate_group(args.feature,args.user_id)
17
20
  end
21
+
18
22
  desc "Activate a feature for a percentage"
19
23
  task :activate_percentage, [:feature, :percentage] => :environment do |t, args|
20
24
  ArRollout.activate_percentage(args.feature,args.percentage)
21
25
  end
26
+
22
27
  desc "Deactivate a feature"
23
28
  task :deactivate_all, [:feature] => :environment do |t, args|
24
29
  ArRollout.deactivate_all(args.feature)
25
30
  end
31
+
26
32
  desc "List all features"
27
33
  task :list, [] => :environment do |t, args|
28
34
  puts ArRollout.features
29
35
  end
36
+
37
+ desc "Display a summary of features"
38
+ task :summary, [] => :environment do |t, args|
39
+ puts(Rollout.all.group_by(&:name).to_a.inject('') do |output, feature|
40
+ feature_name = feature[0]
41
+ rollouts = feature[1]
42
+
43
+ output << "\n"
44
+ output << "#{feature[0]}\n"
45
+ output << " \033[31mGroups:\033[0m"
46
+ output << " #{rollouts.select(&:group).collect(&:group).join(', ')}\n"
47
+ output << " \033[31mUser ID count:\033[0m"
48
+ output << " #{rollouts.select(&:user_id).count}\n"
49
+ output << " \033[31mPercentage:\033[0m"
50
+ output << " #{rollouts.select(&:percentage).collect(&:percentage).join(', ')}\n"
51
+ end)
52
+ end
30
53
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ar_rollout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.17
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2012-11-29 00:00:00.000000000 Z
16
+ date: 2012-11-30 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: rails