passages 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +32 -4
- data/config/config.rb +15 -0
- data/config/initializers/basic_auth.rb +2 -2
- data/lib/passages/engine.rb +6 -4
- data/lib/passages.rb +1 -0
- data/spec/config/initializers/basic_auth_spec.rb +24 -0
- data/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e97a75c881bbc4231d06586a70743f9aabe9e23b
|
4
|
+
data.tar.gz: 48147ce8dab999ba0b281aff172c5b1c12878118
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d81bac070a968f9fed29694502dbbacb63c49118793981351c55b2d9e31675a6fdc49450818171fd9020d449a610b3bc645cc14389aa07a30de2bd5765322901
|
7
|
+
data.tar.gz: 9a29c7f74cc21601f974b51373766ed57f34cce3ce4387e5964d0570f154f908d77d058596d021ad287a485534b37997796079dcde5f569a2cd67820bb2f08a6
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -23,17 +23,45 @@ gem 'passages'
|
|
23
23
|
|
24
24
|
`bundle install`
|
25
25
|
|
26
|
-
|
26
|
+
By default, the `Passages` Engine must be mounted in your `routes.rb` file.
|
27
27
|
|
28
|
-
|
28
|
+
Example:
|
29
|
+
|
30
|
+
*routes.rb*
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
Rails.application.routes.draw do
|
34
|
+
mount Passages::Engine, at: '/passages'
|
35
|
+
end
|
36
|
+
```
|
37
|
+
|
38
|
+
*Alternatively*, an initializer can be created that will allow the `Passages` Engine to mount itself.
|
39
|
+
|
40
|
+
Create a new file: `initializers/passages.rb` and add the following:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
Passages.configure do |config|
|
44
|
+
config.automount = true
|
45
|
+
end
|
46
|
+
```
|
47
|
+
|
48
|
+
With the Engine mounted at `/passages`, the rendered page will display a search box and list of all known routes within the application.
|
29
49
|
|
30
50
|
## Authorization
|
31
51
|
|
32
52
|
Since there are no environment dependent checks, the `/passages` page uses configurable http basic authentication.
|
33
53
|
|
34
|
-
|
54
|
+
To set a `username` and `password` in the `Passages` Engine, add an `ENV` variable for each value.
|
55
|
+
|
56
|
+
`ENV['passages_username']` should be the desired `username` and `ENV['passages_password']` should be the desired `password`
|
57
|
+
|
58
|
+
By default these values are:
|
59
|
+
|
60
|
+
username: **username**
|
61
|
+
|
62
|
+
password: **password**
|
35
63
|
|
36
|
-
|
64
|
+
`ENV` variables can prefix a Ruby server command from the command line interface, set with a helper `.ENV` file for systems like `foreman` or set through a web interface on platforms like `heroku`.
|
37
65
|
|
38
66
|
## Contributing
|
39
67
|
|
data/config/config.rb
ADDED
@@ -1,10 +1,10 @@
|
|
1
1
|
module Passages
|
2
2
|
def username
|
3
|
-
ENV['passages_username'] || 'username'
|
3
|
+
ENV['passages_username'] || ENV['PASSAGES_USERNAME'] || 'username'
|
4
4
|
end
|
5
5
|
|
6
6
|
def password
|
7
|
-
ENV['passages_password'] || 'password'
|
7
|
+
ENV['passages_password'] || ENV['PASSAGES_PASSWORD'] || 'password'
|
8
8
|
end
|
9
9
|
|
10
10
|
def no_auth=(no_auth)
|
data/lib/passages/engine.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
module Passages
|
2
2
|
class Engine < ::Rails::Engine
|
3
|
-
|
3
|
+
isolate_namespace Passages
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
initializer 'passages', after: :load_config_initializers do |app|
|
6
|
+
if Passages.config.automount
|
7
|
+
Rails.application.routes.prepend do
|
8
|
+
mount Passages::Engine, at: '/passages'
|
9
|
+
end
|
8
10
|
end
|
9
11
|
end
|
10
12
|
end
|
data/lib/passages.rb
CHANGED
@@ -11,6 +11,18 @@ describe Passages do
|
|
11
11
|
it 'uses the ENV var' do
|
12
12
|
expect(described_class.username).to eq(username)
|
13
13
|
end
|
14
|
+
|
15
|
+
context 'uppercase' do
|
16
|
+
let(:upper_username) { 'THISISANUPPERUSERNAME' }
|
17
|
+
before do
|
18
|
+
allow(ENV).to receive(:[]).with('passages_username') { nil }
|
19
|
+
allow(ENV).to receive(:[]).with('PASSAGES_USERNAME') { upper_username }
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'uses the ENV var' do
|
23
|
+
expect(described_class.username).to eq(upper_username)
|
24
|
+
end
|
25
|
+
end
|
14
26
|
end
|
15
27
|
|
16
28
|
context 'when the ENV variable is not set' do
|
@@ -30,6 +42,18 @@ describe Passages do
|
|
30
42
|
it 'uses the ENV var' do
|
31
43
|
expect(described_class.password).to eq(password)
|
32
44
|
end
|
45
|
+
|
46
|
+
context 'uppercase' do
|
47
|
+
let(:upper_password) { 'THISISANUPPERPASSWORD' }
|
48
|
+
before do
|
49
|
+
allow(ENV).to receive(:[]).with('passages_password') { nil }
|
50
|
+
allow(ENV).to receive(:[]).with('PASSAGES_PASSWORD') { upper_password }
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'uses the ENV var' do
|
54
|
+
expect(described_class.password).to eq(upper_password)
|
55
|
+
end
|
56
|
+
end
|
33
57
|
end
|
34
58
|
|
35
59
|
context 'when the ENV variable is not set' do
|
data/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: passages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jake Yesbeck
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -58,6 +58,7 @@ files:
|
|
58
58
|
- app/views/passages/routes/_route.html.erb
|
59
59
|
- app/views/passages/routes/_routes_header.html.erb
|
60
60
|
- app/views/passages/routes/routes.html.erb
|
61
|
+
- config/config.rb
|
61
62
|
- config/initializers/assets.rb
|
62
63
|
- config/initializers/basic_auth.rb
|
63
64
|
- config/routes.rb
|