padrino-sextant 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 20994bba5b44232d52e1bde9685034b017a4d09d
4
+ data.tar.gz: 848990c395c2025c525fa138924be4cd79951184
5
+ SHA512:
6
+ metadata.gz: 7ecf3355bb89bb9ee532a9dfd18a15ad3d61ba99eccfbf3666f1fe22173ccca5ce096a97f499e457192b5a3c713e5c8e75caa0cae084c9a06c99fb5f272171e0
7
+ data.tar.gz: 44ca8b1c5501458ff9cdd62c3ed473c678411a8ed8eee7123c343f4a5fb93b602d65c1d5441db49f095795689c003fd36527ef39ebe82fba542212caa0e8db04
@@ -0,0 +1,24 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
23
+ *.DS_Store
24
+ .idea
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in padrino-sextant.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Jörgen Nilsson
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,31 @@
1
+ # Padrino::Sextant
2
+
3
+ .View your Padrino routes straight in the browser by visit /padrino/routes. Padrino-sextant is a shameless rip-off of Rails engine Sextant.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'padrino-sextant', group: :development
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install padrino-sextant
18
+
19
+ ## Usage
20
+
21
+ In your `app.rb` file put
22
+
23
+ register Padrino::Sextant
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/coffeepunk/padrino-sextant/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,10 @@
1
+ require "padrino/sextant/version"
2
+ require 'padrino/sextant/controller'
3
+
4
+ module Padrino
5
+ module Sextant
6
+ def self.registered(app)
7
+ Controller.registered app
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,26 @@
1
+ require 'erubis'
2
+ module Padrino
3
+ module Sextant
4
+ module Controller
5
+ def self.registered(app)
6
+ app.controller :routes do
7
+
8
+ ## /padrino/routes
9
+ get :index , map: '/padrino/routes' do
10
+
11
+ app_routes = []
12
+ Padrino.mounted_apps.each do |mounted_app|
13
+ app_routes.concat(mounted_app.named_routes)
14
+ end
15
+
16
+ app_routes.map! { |r| [r.name, r.verb, r.path, r.identifier] }
17
+
18
+ template = File.read(File.join(File.dirname(__FILE__), 'sextant_index.erb'))
19
+ template = Erubis::Eruby.new(template)
20
+ template.result(app_routes: app_routes)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,104 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>Your routes presented by Padrino Sextant</title>
6
+ <meta name="description" content="Padrino sextant is a simple gem that shows your routes." />
7
+ <meta name="author" content="Jörgen Nilsson" />
8
+ <meta name="viewport" content="initial-scale=1.0" />
9
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
10
+
11
+ <style>
12
+ body {
13
+ font-family: arial, helvetica, sans-serif;
14
+ font-size: 100%;
15
+ line-height: 1.4;
16
+ margin: 0;
17
+ padding: 0;
18
+ }
19
+
20
+ a {
21
+ text-decoration: none;
22
+ }
23
+
24
+ a:hover {
25
+ text-decoration: underline;
26
+ }
27
+
28
+ footer {
29
+ text-align: center;
30
+ }
31
+
32
+ footer > p {
33
+ font-size: 0.875em;
34
+ }
35
+
36
+ .page-header {
37
+ border-bottom: 1px solid #ccc;
38
+ font-family: Georgia, serif;
39
+ font-size: 2em;
40
+ font-weight: normal;
41
+ padding: 0 0 4px 6px;
42
+ }
43
+
44
+ .routes-table {
45
+ border-bottom: 1px solid #cccccc;
46
+ border-collapse: collapse;
47
+ border-spacing: 0;
48
+ width: 100%;
49
+ }
50
+
51
+ .routes-table th {
52
+ border-bottom: 2px solid #cccccc;
53
+ font-weight: bold;
54
+ text-align: left;
55
+ }
56
+
57
+ .routes-table th,
58
+ .routes-table td {
59
+ padding: 0.4em 0.6em;
60
+ }
61
+
62
+ .routes-table tr:nth-child(even) {
63
+ background-color: #e2f0fc;
64
+ }
65
+
66
+ .page {
67
+ max-width: 80%;
68
+ margin: 0 auto;
69
+ }
70
+ </style>
71
+ </head>
72
+ <body>
73
+ <section class="page">
74
+ <header>
75
+ <h1 class="page-header">Your Padrino routes</h1>
76
+ </header>
77
+
78
+ <table class="routes-table">
79
+ <thead>
80
+ <tr>
81
+ <th>Url helper</th>
82
+ <th>HTTP verb</th>
83
+ <th>Path</th>
84
+ <th>Controller#action</th>
85
+ </tr>
86
+ </thead>
87
+ <tbody>
88
+ <% app_routes.each do |route| %>
89
+ <tr>
90
+ <td><%= route[0] %></td>
91
+ <td><%= route[1] %></td>
92
+ <td><%= route[2] %></td>
93
+ <td><%= route[3].to_s.gsub(' ', '#') %></td>
94
+ </tr>
95
+ <% end %>
96
+ </tbody>
97
+ </table>
98
+ <footer>
99
+ <p>Routes presented by <a href="#">Padrino Sextant</a></p>
100
+ <p>Brought to you by <a href="http://jorgennilsson.com">Jörgen Nilsson</a></p>
101
+ </footer>
102
+ </section>
103
+ </body>
104
+ </html>
@@ -0,0 +1,5 @@
1
+ module Padrino
2
+ module Sextant
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'padrino/sextant/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "padrino-sextant"
8
+ spec.version = Padrino::Sextant::VERSION
9
+ spec.authors = ["Jörgen Nilsson"]
10
+ spec.email = ["me@jorgennilsson.com"]
11
+ spec.summary = %q{View your Padrino routes in the browser.}
12
+ spec.description = %q{An easy way to view your routes from internal mounted apps in the browser as an alternative to run rake routes.}
13
+ spec.homepage = "https://github.com/coffeepunk/padrino-sextant"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.6'
22
+ spec.add_development_dependency 'rake'
23
+ spec.add_development_dependency 'erubis', '~> 2.7.0'
24
+ end
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: padrino-sextant
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jörgen Nilsson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: erubis
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 2.7.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 2.7.0
55
+ description: An easy way to view your routes from internal mounted apps in the browser
56
+ as an alternative to run rake routes.
57
+ email:
58
+ - me@jorgennilsson.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - .gitignore
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - lib/padrino/sextant.rb
69
+ - lib/padrino/sextant/controller.rb
70
+ - lib/padrino/sextant/sextant_index.erb
71
+ - lib/padrino/sextant/version.rb
72
+ - padrino-sextant.gemspec
73
+ homepage: https://github.com/coffeepunk/padrino-sextant
74
+ licenses:
75
+ - MIT
76
+ metadata: {}
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubyforge_project:
93
+ rubygems_version: 2.2.2
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: View your Padrino routes in the browser.
97
+ test_files: []