lockup 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -17,12 +17,10 @@ _“…what's the codeword?”_
17
17
  1. Add this line to your application's Gemfile:
18
18
 
19
19
  gem 'lockup'
20
-
21
- 2. Define a codeword (see Usage below).
22
20
 
23
- 3. That's it!**
21
+ 2. Define a codeword (see Usage below).
24
22
 
25
- **If you're passing parameters right at your root (i.e. somedomain.com/:parameter), you'll want to place this mount statement in your routes.rb file, _before_ your other route statements:
23
+ 3. Mount the engine in your application's routes file (usually first, for best results):
26
24
 
27
25
  mount Lockup::Engine, at: '/lockup'
28
26
 
@@ -39,19 +37,19 @@ If you think you might need a hint:
39
37
  If you're using [Figaro](https://github.com/laserlemon/figaro), set your lockup codeword and hint (optional) in your application.yml file:
40
38
 
41
39
  LOCKUP_CODEWORD: "love"
42
-
40
+
43
41
  LOCKUP_HINT: "Pepé Le Pew"
44
-
42
+
45
43
  **Codewords are not case-sensitive, by design. Keep it simple.**
46
44
 
47
45
  ### Link it with no typing:
48
46
 
49
47
  http://somedomain.com/or_path/?lockup_codeword=love
50
-
48
+
51
49
  The visitor is redirected and the cookie is set without them ever seeing the Lockup splash page.
52
50
 
53
51
  (Lockup also makes a rudimentary attempt based on user agent to **block major search engine bots/crawlers** from following this link and indexing the site, just in case it ever gets out into the wild.)
54
52
 
55
53
  ## Contribute
56
54
 
57
- Pull requests are welcome, but please make the to the _development_ branch.
55
+ Pull requests are welcome, but please make them to the _development_ branch.
data/config/routes.rb CHANGED
@@ -1,7 +1,3 @@
1
- Rails.application.routes.draw do
2
- mount Lockup::Engine, at: '/lockup', :as => 'lockup'
3
- end
4
-
5
1
  Lockup::Engine.routes.draw do
6
2
  get 'unlock' => 'lockup#unlock', :as => 'unlock'
7
3
  post 'unlock' => 'lockup#unlock'
@@ -1,3 +1,3 @@
1
1
  module Lockup
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -2,4 +2,8 @@ class ApplicationController < ActionController::Base
2
2
  # Prevent CSRF attacks by raising an exception.
3
3
  # For APIs, you may want to use :null_session instead.
4
4
  protect_from_forgery with: :exception
5
+
6
+ def render_404
7
+ render :file => Rails.root.join('public', '404.html'), :status => 404
8
+ end
5
9
  end
@@ -1,3 +1,10 @@
1
1
  Rails.application.routes.draw do
2
+
3
+ mount Lockup::Engine, :at => '/lockup', :as => 'lockup'
4
+
2
5
  resources :posts, :only => [:index, :show]
6
+
7
+ # this makes tests fail with endless redirect loop b/c it is before lockup routes
8
+ # catch all route b/c Rails `rescue_from` doesn't catch ActionController::RoutingError
9
+ match '*path', :via => :all, :to => 'application#render_404'
3
10
  end
@@ -94,6 +94,12 @@ describe "Accessing a page in the application" do
94
94
  reset_user_agent
95
95
  end
96
96
 
97
+ it "works with a catch all route" do
98
+ visit '/this-does-not-exist?lockup_codeword=omgponies'
99
+
100
+ page.status_code.should == 404
101
+ end
102
+
97
103
  context "with a configured hint" do
98
104
  it "displays the hint to the user" do
99
105
  ENV['LOCKUP_HINT'] = 'Cute 4-legged animals'
@@ -108,4 +114,4 @@ describe "Accessing a page in the application" do
108
114
 
109
115
  end
110
116
 
111
- end
117
+ end
metadata CHANGED
@@ -1,95 +1,94 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: lockup
3
- version: !ruby/object:Gem::Version
4
- version: 1.1.0
3
+ version: !ruby/object:Gem::Version
4
+ hash: 31
5
5
  prerelease:
6
+ segments:
7
+ - 1
8
+ - 2
9
+ - 0
10
+ version: 1.2.0
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - gb Studio
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2013-11-27 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2014-01-15 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
15
21
  name: rails
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '3'
22
- - - <
23
- - !ruby/object:Gem::Version
24
- version: '5'
25
- type: :runtime
26
22
  prerelease: false
27
- version_requirements: !ruby/object:Gem::Requirement
23
+ requirement: &id001 !ruby/object:Gem::Requirement
28
24
  none: false
29
- requirements:
30
- - - ! '>='
31
- - !ruby/object:Gem::Version
32
- version: '3'
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 5
29
+ segments:
30
+ - 3
31
+ version: "3"
33
32
  - - <
34
- - !ruby/object:Gem::Version
35
- version: '5'
36
- - !ruby/object:Gem::Dependency
33
+ - !ruby/object:Gem::Version
34
+ hash: 9
35
+ segments:
36
+ - 5
37
+ version: "5"
38
+ type: :runtime
39
+ version_requirements: *id001
40
+ - !ruby/object:Gem::Dependency
37
41
  name: rspec-rails
38
- requirement: !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
41
- - - ! '>='
42
- - !ruby/object:Gem::Version
43
- version: '0'
44
- type: :development
45
42
  prerelease: false
46
- version_requirements: !ruby/object:Gem::Requirement
43
+ requirement: &id002 !ruby/object:Gem::Requirement
47
44
  none: false
48
- requirements:
49
- - - ! '>='
50
- - !ruby/object:Gem::Version
51
- version: '0'
52
- - !ruby/object:Gem::Dependency
53
- name: capybara
54
- requirement: !ruby/object:Gem::Requirement
55
- none: false
56
- requirements:
57
- - - ! '>='
58
- - !ruby/object:Gem::Version
59
- version: '0'
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ hash: 3
49
+ segments:
50
+ - 0
51
+ version: "0"
60
52
  type: :development
53
+ version_requirements: *id002
54
+ - !ruby/object:Gem::Dependency
55
+ name: capybara
61
56
  prerelease: false
62
- version_requirements: !ruby/object:Gem::Requirement
63
- none: false
64
- requirements:
65
- - - ! '>='
66
- - !ruby/object:Gem::Version
67
- version: '0'
68
- - !ruby/object:Gem::Dependency
69
- name: launchy
70
- requirement: !ruby/object:Gem::Requirement
57
+ requirement: &id003 !ruby/object:Gem::Requirement
71
58
  none: false
72
- requirements:
73
- - - ! '>='
74
- - !ruby/object:Gem::Version
75
- version: '0'
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ hash: 3
63
+ segments:
64
+ - 0
65
+ version: "0"
76
66
  type: :development
67
+ version_requirements: *id003
68
+ - !ruby/object:Gem::Dependency
69
+ name: launchy
77
70
  prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
71
+ requirement: &id004 !ruby/object:Gem::Requirement
79
72
  none: false
80
- requirements:
81
- - - ! '>='
82
- - !ruby/object:Gem::Version
83
- version: '0'
84
- description: A simple gem to more elegantly place a staging server or other in-progress
85
- application behind a basic codeword. It’s easy to implement, share with clients/collaborators,
86
- and more beautiful than the typical password-protection sheet.
87
- email:
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ hash: 3
77
+ segments:
78
+ - 0
79
+ version: "0"
80
+ type: :development
81
+ version_requirements: *id004
82
+ description: "A simple gem to more elegantly place a staging server or other in-progress application behind a basic codeword. It\xE2\x80\x99s easy to implement, share with clients/collaborators, and more beautiful than the typical password-protection sheet."
83
+ email:
88
84
  - hello@grantblakeman.com
89
85
  executables: []
86
+
90
87
  extensions: []
88
+
91
89
  extra_rdoc_files: []
92
- files:
90
+
91
+ files:
93
92
  - app/controllers/lockup/application_controller.rb
94
93
  - app/controllers/lockup/lockup_controller.rb
95
94
  - app/helpers/lockup/application_helper.rb
@@ -143,31 +142,39 @@ files:
143
142
  - spec/spec_helper.rb
144
143
  - spec/support/features/user_agent_helper.rb
145
144
  homepage: http://lockupgem.com
146
- licenses:
145
+ licenses:
147
146
  - MIT
148
147
  post_install_message:
149
148
  rdoc_options: []
150
- require_paths:
149
+
150
+ require_paths:
151
151
  - lib
152
- required_ruby_version: !ruby/object:Gem::Requirement
152
+ required_ruby_version: !ruby/object:Gem::Requirement
153
153
  none: false
154
- requirements:
155
- - - ! '>='
156
- - !ruby/object:Gem::Version
157
- version: '0'
158
- required_rubygems_version: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ hash: 3
158
+ segments:
159
+ - 0
160
+ version: "0"
161
+ required_rubygems_version: !ruby/object:Gem::Requirement
159
162
  none: false
160
- requirements:
161
- - - ! '>='
162
- - !ruby/object:Gem::Version
163
- version: '0'
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ hash: 3
167
+ segments:
168
+ - 0
169
+ version: "0"
164
170
  requirements: []
171
+
165
172
  rubyforge_project:
166
- rubygems_version: 1.8.23
173
+ rubygems_version: 1.8.24
167
174
  signing_key:
168
175
  specification_version: 3
169
176
  summary: Lock staging servers from search engines and prying eyes.
170
- test_files:
177
+ test_files:
171
178
  - spec/dummy/app/assets/javascripts/application.js
172
179
  - spec/dummy/app/assets/stylesheets/application.css
173
180
  - spec/dummy/app/controllers/application_controller.rb