prelaunch 0.0.5 → 0.0.6
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 +8 -8
- data/app/controllers/prelaunch/prelaunch_controller.rb +1 -3
- data/lib/prelaunch/constraints.rb +18 -0
- data/lib/prelaunch/functions.rb +8 -0
- data/lib/prelaunch/helpers.rb +2 -8
- data/lib/prelaunch/routing.rb +4 -2
- data/lib/prelaunch/version.rb +1 -1
- data/lib/prelaunch.rb +3 -2
- metadata +3 -2
- data/lib/prelaunch/constraint.rb +0 -7
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTMxMGRmMWZjZTYyODJhMzFkZmE1N2NiMmEzZTYxYzMyNjU2NGEzYQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YWEzYTA2Mjk0OWZjMDg1NjFhNWVlNzc2ODkzZjA4NGYwOGM1YWVlNQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDMxYjUyOTM3YzNjM2E4M2U2ODAyNmY4YmFlNmEwOTg5YWRlYWI1NmIwMzhk
|
10
|
+
N2I3M2QxMTk3N2M5ZDVkNTk5MTkyMDkyZTgxYTdmZmY1ODQyNWNmOGQ5MzZj
|
11
|
+
YWUyM2RlMGFkYWIxZTUwMDk4NTY4NjRmZmRjNzBmNzM5ODUzNDM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDM0ZmUxN2FmNTM4NTdlMmQ0MDYyMWE0MTYwNzJkODAxOGVkOWE2MmNjNjk3
|
14
|
+
NTA4NzM5ZjRiODgwMjJmMjhjOTIzNTA2YWNiZGViYjg2MDg5YjhkMTkyNWI4
|
15
|
+
OWRmYzc1YjRlZDhkYzhlZGRiYWY0YzFjNTM3OGNhMzdhYzViODY=
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Prelaunch
|
2
|
+
class SessionConstraint
|
3
|
+
def matches? request
|
4
|
+
not Prelaunch::valid? request.session[:prelaunch_token]
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
class TokenConstraint
|
9
|
+
def matches? request
|
10
|
+
path = Prelaunch::strip_slashes(Prelaunch.path)
|
11
|
+
match = request.fullpath.match(/^#{path}\/([A-Za-z0-9]*)([\/\?])?/)
|
12
|
+
|
13
|
+
return false if match.nil?
|
14
|
+
|
15
|
+
Prelaunch::valid? match[1]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/prelaunch/helpers.rb
CHANGED
@@ -3,7 +3,8 @@ module Prelaunch
|
|
3
3
|
def prelaunch_logout_link name = nil, html_options = nil, &block
|
4
4
|
return unless Prelaunch::valid_env?
|
5
5
|
|
6
|
-
|
6
|
+
path = Prelaunch::strip_slashes(Prelaunch.path)
|
7
|
+
url = "#{path}/logout"
|
7
8
|
|
8
9
|
html_options = name if block_given?
|
9
10
|
html_options ||= {}
|
@@ -12,12 +13,5 @@ module Prelaunch
|
|
12
13
|
|
13
14
|
content_tag(:a, name || url, html_options, &block)
|
14
15
|
end
|
15
|
-
|
16
|
-
private
|
17
|
-
def strip_slashes string
|
18
|
-
result = string.gsub(/^(\/|\\)+/, '').gsub(/(\/|\\)+$/, '')
|
19
|
-
|
20
|
-
result.length > 0 ? '/' + result : result
|
21
|
-
end
|
22
16
|
end
|
23
17
|
end
|
data/lib/prelaunch/routing.rb
CHANGED
@@ -3,10 +3,12 @@ module ActionDispatch::Routing
|
|
3
3
|
def prelaunch_routes
|
4
4
|
return unless Prelaunch.valid_env?
|
5
5
|
|
6
|
-
|
6
|
+
token = Prelaunch::TokenConstraint.new
|
7
7
|
|
8
8
|
get "#{Prelaunch.path}/logout", to: 'prelaunch/prelaunch#logout', as: ''
|
9
|
-
get "#{Prelaunch.path}/:token", to: 'prelaunch/prelaunch#verify', constraints:
|
9
|
+
get "#{Prelaunch.path}/:token", to: 'prelaunch/prelaunch#verify', constraints: token
|
10
|
+
|
11
|
+
contraint = Prelaunch::SessionConstraint.new
|
10
12
|
|
11
13
|
get '*path', to: 'prelaunch/prelaunch#redirect', constraints: contraint
|
12
14
|
get '/' , to: 'prelaunch/prelaunch#index' , constraints: contraint
|
data/lib/prelaunch/version.rb
CHANGED
data/lib/prelaunch.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prelaunch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey Chernetsov
|
@@ -49,8 +49,9 @@ files:
|
|
49
49
|
- lib/generators/prelaunch/view_generator.rb
|
50
50
|
- lib/generators/templates/prelaunch.rb
|
51
51
|
- lib/prelaunch.rb
|
52
|
-
- lib/prelaunch/
|
52
|
+
- lib/prelaunch/constraints.rb
|
53
53
|
- lib/prelaunch/engine.rb
|
54
|
+
- lib/prelaunch/functions.rb
|
54
55
|
- lib/prelaunch/helpers.rb
|
55
56
|
- lib/prelaunch/routing.rb
|
56
57
|
- lib/prelaunch/version.rb
|