rollout_control 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8e8d0f54996af6fb0ec39e04078ed85b55057eda
4
- data.tar.gz: 18b1a84f62fbfd48d0e42e5d6daa6fa71cc1b2a8
3
+ metadata.gz: 8393199604c124688b2befe39e071b0fb92d34fc
4
+ data.tar.gz: 6c30f2fb5862b01a177eee3f0da0b1fecf72ee1f
5
5
  SHA512:
6
- metadata.gz: 781441f63184353a65502c89be850bd4f83d4d11657714eb97c47cceff23f6ee0e4137e9406fee0261a1643de90d6ee6136ec9a58efce3efa721cc96447cf0dc
7
- data.tar.gz: 5f6833e79feba43b5746a486104fa7c61a47c39a3b56bcc8f509ed8471243802b16a3c9c37b2c595e65dc1177b5ab738dbcd110f805fa10e0e26e90508f77b85
6
+ metadata.gz: 558c4651305ad9059b54be11151167cd6f176f6dd403be15dd422d6c875df68b0765d98f7e818f7565614d9caf0986835c668319e6364a8c386dee7c191ed253
7
+ data.tar.gz: 6be784928448b8ef08cc17fdffe089c60f2947964d6679ee6ca20082d2c2da635758d2e63546f3edfd825170b4ac524357260ed2d2d524dd1b87dd68e28db606
@@ -1,10 +1,24 @@
1
1
  module RolloutControl
2
2
  class ApplicationController < ActionController::Base
3
+ before_filter :authenticate
3
4
 
4
5
  private
5
6
 
6
7
  def rollout
7
8
  RolloutControl.rollout
8
9
  end
10
+
11
+ def authenticate
12
+ unless RolloutControl.unprotected
13
+ authenticate_or_request_with_http_basic('Rollout Control') do |username, password|
14
+ rc_username, rc_password = RolloutControl.basic_auth_username, RolloutControl.basic_auth_password
15
+ if rc_username.present? && rc_password.present?
16
+ username == rc_username && password == rc_password
17
+ else
18
+ false
19
+ end
20
+ end
21
+ end
22
+ end
9
23
  end
10
24
  end
@@ -1,18 +1,5 @@
1
1
  module RolloutControl
2
2
  class Engine < ::Rails::Engine
3
3
  isolate_namespace RolloutControl
4
-
5
- initializer 'Basic Auth' do |app|
6
- unless RolloutControl.unprotected
7
- app.config.middleware.use Rack::Auth::Basic do |username, password|
8
- rc_username, rc_password = RolloutControl.basic_auth_username, RolloutControl.basic_auth_password
9
- if rc_username.present? && rc_password.present?
10
- username == rc_username && password == rc_password
11
- else
12
- false
13
- end
14
- end
15
- end
16
- end
17
4
  end
18
5
  end
@@ -1,3 +1,3 @@
1
1
  module RolloutControl
2
- VERSION = "0.0.1"
2
+ VERSION = '0.0.2'
3
3
  end