passages 0.1.0 → 0.2.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 +22 -6
- data/app/controllers/passages/routes_controller.rb +2 -0
- data/config/initializers/basic_auth.rb +11 -0
- data/lib/passages.rb +9 -2
- data/passages.gemspec +1 -1
- data/spec/config/initializers/basic_auth_spec.rb +41 -0
- data/spec/spec_helper.rb +1 -0
- data/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f37c423eff6bfd9da867704180a01ca6abcc650f
|
4
|
+
data.tar.gz: e9689b0ea723de0b76c90e9e10ae59f429ec4840
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 743b38a9e68e39887fa93529191793d70af8721e8df2113929a6daf95357ae423c4f07ae903f18e4f6dd93c10d92942b5265d0ad49277e705b8a5f37129edf73
|
7
|
+
data.tar.gz: eac0cf7983556bf5383b6372928fb84df773ba3bcd4db2b309a912f36a87ea12bda5d50d6efdd546c21b2b6a63f488685e549a6e97269c1dad431187b0386772
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,12 @@
|
|
1
|
-
##
|
1
|
+
## Passages
|
2
2
|
|
3
|
-
![Build Status](https://travis-ci.org/yez/
|
3
|
+
![Build Status](https://travis-ci.org/yez/passages.svg?branch=master)
|
4
4
|
|
5
|
-
|
5
|
+
## Purpose
|
6
|
+
|
7
|
+
This Rails Engine adds the ability to search over different attributes of Ruby on Rails routes within an application.
|
8
|
+
|
9
|
+
For example, an internal (or very permissive external) API can now expose a single page that will answer simple questions like: *"What was the HTTP verb for the `/users/clear_password` route?"* or *"Does a v2 or v3 version for this route exist?"*.
|
6
10
|
|
7
11
|
## Install
|
8
12
|
|
@@ -10,11 +14,23 @@ In your `Gemfile`
|
|
10
14
|
|
11
15
|
```ruby
|
12
16
|
source 'https://rubygems.org'
|
13
|
-
gem '
|
17
|
+
gem 'passages'
|
14
18
|
```
|
15
19
|
|
16
20
|
`bundle install`
|
17
21
|
|
18
|
-
The `
|
22
|
+
The `Passages` engine will **prepend** a `/passages` route to the application's routes.
|
23
|
+
|
24
|
+
Visiting `/passages` will display a search box and list of all known routes in an application.
|
25
|
+
|
26
|
+
## Authorization
|
27
|
+
|
28
|
+
Since there is no environment dependent checks, the `/passages` page uses configurable http basic authentication.
|
29
|
+
|
30
|
+
Default username: **username**
|
31
|
+
|
32
|
+
Default password: **password**
|
33
|
+
|
34
|
+
## Contributing
|
19
35
|
|
20
|
-
|
36
|
+
Please feel free to fork and contribute your own changes to the Passages project. Single commits are preferred with a description of why the contribution is useful.
|
data/lib/passages.rb
CHANGED
@@ -1,5 +1,12 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
$LOAD_PATH << File.dirname(__FILE__) + '/../lib'
|
2
|
+
$LOAD_PATH << File.dirname(__FILE__) + '/../config'
|
3
3
|
|
4
4
|
module Passages
|
5
5
|
end
|
6
|
+
|
7
|
+
require 'initializers/basic_auth'
|
8
|
+
|
9
|
+
if defined? Rails
|
10
|
+
require 'passages/engine'
|
11
|
+
require 'controllers/passages/routes_controller'
|
12
|
+
end
|
data/passages.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.description = %q{Rails Engine to make internal routes searchable and discoverable for more than just the name of the route. All aspects of a route are searchable from the HTTP verb to the paramters a route supports.}
|
11
11
|
s.authors = ['Jake Yesbeck']
|
12
12
|
s.email = 'yesbeckjs@gmail.com'
|
13
|
-
s.homepage = 'https://github.com/yez/
|
13
|
+
s.homepage = 'https://github.com/yez/passages'
|
14
14
|
s.license = 'MIT'
|
15
15
|
|
16
16
|
s.require_paths = %w(lib app)
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Passages do
|
4
|
+
describe '.username' do
|
5
|
+
context 'when the ENV variable is set' do
|
6
|
+
let(:username) { 'thisisausername' }
|
7
|
+
before do
|
8
|
+
allow(ENV).to receive(:[]).with('passages_username') { username }
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'uses the ENV var' do
|
12
|
+
expect(described_class.username).to eq(username)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'when the ENV variable is not set' do
|
17
|
+
it 'uses the default value' do
|
18
|
+
expect(described_class.username).to eq('username')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '.password' do
|
24
|
+
context 'when the ENV variable is set' do
|
25
|
+
let(:password) { 'thisisapassword' }
|
26
|
+
before do
|
27
|
+
allow(ENV).to receive(:[]).with('passages_password') { password }
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'uses the ENV var' do
|
31
|
+
expect(described_class.password).to eq(password)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'when the ENV variable is not set' do
|
36
|
+
it 'uses the default value' do
|
37
|
+
expect(described_class.password).to eq('password')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/spec/spec_helper.rb
CHANGED
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: 0.
|
4
|
+
version: 0.2.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: 2015-12-
|
11
|
+
date: 2015-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -59,6 +59,7 @@ files:
|
|
59
59
|
- app/views/passages/routes/_routes_header.html.erb
|
60
60
|
- app/views/passages/routes/routes.html.erb
|
61
61
|
- config/initializers/assets.rb
|
62
|
+
- config/initializers/basic_auth.rb
|
62
63
|
- config/routes.rb
|
63
64
|
- lib/passages.rb
|
64
65
|
- lib/passages/engine.rb
|
@@ -68,6 +69,7 @@ files:
|
|
68
69
|
- lib/passages/route.rb
|
69
70
|
- lib/passages/route_collection.rb
|
70
71
|
- passages.gemspec
|
72
|
+
- spec/config/initializers/basic_auth_spec.rb
|
71
73
|
- spec/controllers/passages/routes_controller_spec.rb
|
72
74
|
- spec/lib/passages/engine_route_collection_spec.rb
|
73
75
|
- spec/lib/passages/mount_route_spec.rb
|
@@ -84,7 +86,7 @@ files:
|
|
84
86
|
- vendor/assets/stylesheets/bootstrap-theme.min.css
|
85
87
|
- vendor/assets/stylesheets/bootstrap.min.css
|
86
88
|
- version.rb
|
87
|
-
homepage: https://github.com/yez/
|
89
|
+
homepage: https://github.com/yez/passages
|
88
90
|
licenses:
|
89
91
|
- MIT
|
90
92
|
metadata: {}
|
@@ -110,6 +112,7 @@ signing_key:
|
|
110
112
|
specification_version: 4
|
111
113
|
summary: Display and search capabilities for Ruby on Rails routes
|
112
114
|
test_files:
|
115
|
+
- spec/config/initializers/basic_auth_spec.rb
|
113
116
|
- spec/controllers/passages/routes_controller_spec.rb
|
114
117
|
- spec/lib/passages/engine_route_collection_spec.rb
|
115
118
|
- spec/lib/passages/mount_route_spec.rb
|