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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 47e75e77bbe676fe75044de45fd56441e7c11a2b
4
- data.tar.gz: f6d446dab10cf91edbd16cacb326d75a70bfa5f3
3
+ metadata.gz: f37c423eff6bfd9da867704180a01ca6abcc650f
4
+ data.tar.gz: e9689b0ea723de0b76c90e9e10ae59f429ec4840
5
5
  SHA512:
6
- metadata.gz: 7bc750e7f13b7ee420c77c129095c69193b6f35a1bc481925431244fbccaca33ae993ee5c3e416b880b0855156630e73240eb8fdc6b83bafb5b8b9824c9db32d
7
- data.tar.gz: 01bd77ac13587d13301a5a31bbddc8b8cf0e9da4616233e1da1f779bf16854f2747c65f3c2bcf851a720eb97c6ddd56cf7d9cb0f513eca506f03be2cd8d8ddda
6
+ metadata.gz: 743b38a9e68e39887fa93529191793d70af8721e8df2113929a6daf95357ae423c4f07ae903f18e4f6dd93c10d92942b5265d0ad49277e705b8a5f37129edf73
7
+ data.tar.gz: eac0cf7983556bf5383b6372928fb84df773ba3bcd4db2b309a912f36a87ea12bda5d50d6efdd546c21b2b6a63f488685e549a6e97269c1dad431187b0386772
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- passages (0.0.1)
4
+ passages (0.1.0)
5
5
  rails (~> 4.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,8 +1,12 @@
1
- ## Roots
1
+ ## Passages
2
2
 
3
- ![Build Status](https://travis-ci.org/yez/roots.svg?branch=master)
3
+ ![Build Status](https://travis-ci.org/yez/passages.svg?branch=master)
4
4
 
5
- Route display and search for Ruby on Rails applications.
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 'roots'
17
+ gem 'passages'
14
18
  ```
15
19
 
16
20
  `bundle install`
17
21
 
18
- The `Roots` engine will **prepend** a `/roots` route to the application
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
- Visiting `/roots` will
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.
@@ -6,6 +6,8 @@ require 'passages/engine_route_collection'
6
6
 
7
7
  module Passages
8
8
  class RoutesController < ActionController::Base
9
+ http_basic_authenticate_with name: Passages.username, password: Passages.password
10
+
9
11
  layout false
10
12
 
11
13
  def routes
@@ -0,0 +1,11 @@
1
+ module Passages
2
+ def username
3
+ ENV['passages_username'] || 'username'
4
+ end
5
+
6
+ def password
7
+ ENV['passages_password'] || 'password'
8
+ end
9
+
10
+ module_function :username, :password
11
+ end
data/lib/passages.rb CHANGED
@@ -1,5 +1,12 @@
1
- require 'passages/engine'
2
- require 'controllers/passages/routes_controller'
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/roots'
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
@@ -2,3 +2,4 @@ require 'action_dispatch/routing'
2
2
  require 'action_dispatch/routing/inspector'
3
3
  require 'active_support'
4
4
  require 'action_controller'
5
+ require './lib/passages'
data/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Passages
2
2
  MAJOR = 0
3
- MINOR = 1
3
+ MINOR = 2
4
4
  TINY = 0
5
5
 
6
6
  VERSION = [MAJOR, MINOR, TINY].join('.').freeze
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.1.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-22 00:00:00.000000000 Z
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/roots
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