sextant 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/.travis.yml +3 -0
  2. data/CHANGELOG.md +3 -0
  3. data/Gemfile +30 -0
  4. data/Gemfile.lock +126 -0
  5. data/MIT-LICENSE +20 -0
  6. data/README.md +40 -0
  7. data/Rakefile +50 -0
  8. data/VERSION +1 -0
  9. data/app/controllers/rails/routes_controller.rb +15 -0
  10. data/app/views/layouts/rails/routes.html.erb +32 -0
  11. data/app/views/rails/routes/index.html.erb +9 -0
  12. data/config/routes.rb +9 -0
  13. data/lib/sextant.rb +15 -0
  14. data/lib/sextant/engine.rb +5 -0
  15. data/test/dummy/Rakefile +7 -0
  16. data/test/dummy/app/controllers/application_controller.rb +3 -0
  17. data/test/dummy/app/helpers/application_helper.rb +2 -0
  18. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  19. data/test/dummy/config.ru +4 -0
  20. data/test/dummy/config/application.rb +46 -0
  21. data/test/dummy/config/boot.rb +10 -0
  22. data/test/dummy/config/database.yml +22 -0
  23. data/test/dummy/config/environment.rb +5 -0
  24. data/test/dummy/config/environments/development.rb +25 -0
  25. data/test/dummy/config/environments/production.rb +49 -0
  26. data/test/dummy/config/environments/test.rb +35 -0
  27. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  28. data/test/dummy/config/initializers/inflections.rb +10 -0
  29. data/test/dummy/config/initializers/mime_types.rb +5 -0
  30. data/test/dummy/config/initializers/secret_token.rb +7 -0
  31. data/test/dummy/config/initializers/session_store.rb +8 -0
  32. data/test/dummy/config/locales/en.yml +5 -0
  33. data/test/dummy/config/routes.rb +61 -0
  34. data/test/dummy/public/404.html +26 -0
  35. data/test/dummy/public/422.html +26 -0
  36. data/test/dummy/public/500.html +26 -0
  37. data/test/dummy/public/favicon.ico +0 -0
  38. data/test/dummy/public/index.html +1 -0
  39. data/test/dummy/public/javascripts/application.js +2 -0
  40. data/test/dummy/public/javascripts/controls.js +965 -0
  41. data/test/dummy/public/javascripts/dragdrop.js +974 -0
  42. data/test/dummy/public/javascripts/effects.js +1123 -0
  43. data/test/dummy/public/javascripts/prototype.js +6001 -0
  44. data/test/dummy/public/javascripts/rails.js +202 -0
  45. data/test/dummy/public/stylesheets/.gitkeep +0 -0
  46. data/test/dummy/script/rails +6 -0
  47. data/test/integration/sextant_test.rb +13 -0
  48. data/test/route_inspector_test.rb +7 -0
  49. data/test/support/integration_case.rb +5 -0
  50. data/test/test_helper.rb +30 -0
  51. metadata +198 -0
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ## 0.0.1
2
+
3
+ * First Release
data/Gemfile ADDED
@@ -0,0 +1,30 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "activesupport" , ">= 3.1"
4
+ gem "rails" , ">= 3.1"
5
+
6
+
7
+
8
+ group :development, :test do
9
+ gem 'rake'
10
+ gem 'jeweler', "~> 1.6.4"
11
+ gem "capybara", ">= 0.4.0"
12
+ gem "sqlite3"
13
+ gem "launchy", "~> 2.1.0"
14
+ end
15
+
16
+ platforms :mri_18 do
17
+ group :development, :test do
18
+ gem "rcov"
19
+ end
20
+ end
21
+
22
+ platforms :mri_19 do
23
+ group :development, :test do
24
+ gem "simplecov"
25
+ end
26
+ end
27
+
28
+ # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
29
+ # gem 'ruby-debug'
30
+ # gem 'ruby-debug19'
data/Gemfile.lock ADDED
@@ -0,0 +1,126 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ actionmailer (3.2.3)
5
+ actionpack (= 3.2.3)
6
+ mail (~> 2.4.4)
7
+ actionpack (3.2.3)
8
+ activemodel (= 3.2.3)
9
+ activesupport (= 3.2.3)
10
+ builder (~> 3.0.0)
11
+ erubis (~> 2.7.0)
12
+ journey (~> 1.0.1)
13
+ rack (~> 1.4.0)
14
+ rack-cache (~> 1.2)
15
+ rack-test (~> 0.6.1)
16
+ sprockets (~> 2.1.2)
17
+ activemodel (3.2.3)
18
+ activesupport (= 3.2.3)
19
+ builder (~> 3.0.0)
20
+ activerecord (3.2.3)
21
+ activemodel (= 3.2.3)
22
+ activesupport (= 3.2.3)
23
+ arel (~> 3.0.2)
24
+ tzinfo (~> 0.3.29)
25
+ activeresource (3.2.3)
26
+ activemodel (= 3.2.3)
27
+ activesupport (= 3.2.3)
28
+ activesupport (3.2.3)
29
+ i18n (~> 0.6)
30
+ multi_json (~> 1.0)
31
+ addressable (2.2.7)
32
+ arel (3.0.2)
33
+ builder (3.0.0)
34
+ capybara (1.1.2)
35
+ mime-types (>= 1.16)
36
+ nokogiri (>= 1.3.3)
37
+ rack (>= 1.0.0)
38
+ rack-test (>= 0.5.4)
39
+ selenium-webdriver (~> 2.0)
40
+ xpath (~> 0.1.4)
41
+ childprocess (0.3.1)
42
+ ffi (~> 1.0.6)
43
+ erubis (2.7.0)
44
+ ffi (1.0.11)
45
+ git (1.2.5)
46
+ hike (1.2.1)
47
+ i18n (0.6.0)
48
+ jeweler (1.6.4)
49
+ bundler (~> 1.0)
50
+ git (>= 1.2.5)
51
+ rake
52
+ journey (1.0.3)
53
+ json (1.6.6)
54
+ launchy (2.1.0)
55
+ addressable (~> 2.2.6)
56
+ mail (2.4.4)
57
+ i18n (>= 0.4.0)
58
+ mime-types (~> 1.16)
59
+ treetop (~> 1.4.8)
60
+ mime-types (1.18)
61
+ multi_json (1.2.0)
62
+ nokogiri (1.5.2)
63
+ polyglot (0.3.3)
64
+ rack (1.4.1)
65
+ rack-cache (1.2)
66
+ rack (>= 0.4)
67
+ rack-ssl (1.3.2)
68
+ rack
69
+ rack-test (0.6.1)
70
+ rack (>= 1.0)
71
+ rails (3.2.3)
72
+ actionmailer (= 3.2.3)
73
+ actionpack (= 3.2.3)
74
+ activerecord (= 3.2.3)
75
+ activeresource (= 3.2.3)
76
+ activesupport (= 3.2.3)
77
+ bundler (~> 1.0)
78
+ railties (= 3.2.3)
79
+ railties (3.2.3)
80
+ actionpack (= 3.2.3)
81
+ activesupport (= 3.2.3)
82
+ rack-ssl (~> 1.3.2)
83
+ rake (>= 0.8.7)
84
+ rdoc (~> 3.4)
85
+ thor (~> 0.14.6)
86
+ rake (0.9.2.2)
87
+ rcov (1.0.0)
88
+ rdoc (3.12)
89
+ json (~> 1.4)
90
+ rubyzip (0.9.7)
91
+ selenium-webdriver (2.20.0)
92
+ childprocess (>= 0.2.5)
93
+ ffi (~> 1.0)
94
+ multi_json (~> 1.0)
95
+ rubyzip
96
+ simplecov (0.6.1)
97
+ multi_json (~> 1.0)
98
+ simplecov-html (~> 0.5.3)
99
+ simplecov-html (0.5.3)
100
+ sprockets (2.1.2)
101
+ hike (~> 1.2)
102
+ rack (~> 1.0)
103
+ tilt (~> 1.1, != 1.3.0)
104
+ sqlite3 (1.3.5)
105
+ thor (0.14.6)
106
+ tilt (1.3.3)
107
+ treetop (1.4.10)
108
+ polyglot
109
+ polyglot (>= 0.3.1)
110
+ tzinfo (0.3.33)
111
+ xpath (0.1.4)
112
+ nokogiri (~> 1.3)
113
+
114
+ PLATFORMS
115
+ ruby
116
+
117
+ DEPENDENCIES
118
+ activesupport (>= 3.1)
119
+ capybara (>= 0.4.0)
120
+ jeweler (~> 1.6.4)
121
+ launchy (~> 2.1.0)
122
+ rails (>= 3.1)
123
+ rake
124
+ rcov
125
+ simplecov
126
+ sqlite3
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2012 Schneems
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # Sextant
2
+
3
+ Helps you find your routes on a long Journey on Rails
4
+
5
+ ## What
6
+
7
+ Show routes in your Rails app. Visit `http://localhost:3000/rails/routes` and you'll see an output similar to `rake routes`
8
+
9
+ ![Sextant Gem](http://media.tumblr.com/tumblr_m42lwz86aB1qevexf.png)
10
+
11
+
12
+ ## Why?
13
+
14
+ Running `rake routes` is slow and painful, mostly due to the time to initialize rails. Since you likely have your rails server booted, you can save this time by rendering the routes in a web request. You can only develop as quick as your tools will allow, so speeding up your tools speeds your development. Sextant allows you to quickly see your routes.
15
+
16
+
17
+ ## Install
18
+
19
+ Add this to your Gemfile
20
+
21
+ ```ruby
22
+ gem 'sextant'
23
+ ```
24
+
25
+ Then run `bundle install` and you're ready to start
26
+
27
+
28
+ ## Use
29
+
30
+ Visit `/rails/routes` in your app and you'll see your routes. It's that simple.
31
+
32
+ ![Screenshot]()
33
+
34
+ Don't worry you can only see this info in development
35
+
36
+ ## About
37
+
38
+ If you have a question file an issue or find me on the Twitters [@schneems](http://twitter.com/schneems).
39
+
40
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,50 @@
1
+ # encoding: UTF-8
2
+ require 'rubygems'
3
+ require 'bundler'
4
+
5
+ begin
6
+ Bundler.setup(:default, :development, :test)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+
13
+ require 'rake'
14
+ require 'rdoc/task'
15
+
16
+ require 'rake/testtask'
17
+
18
+ Rake::TestTask.new(:test) do |t|
19
+ t.libs << 'lib'
20
+ t.libs << 'test'
21
+ t.pattern = 'test/**/*_test.rb'
22
+ t.verbose = false
23
+ end
24
+
25
+ task :default => :test
26
+
27
+ Rake::RDocTask.new(:rdoc) do |rdoc|
28
+ rdoc.rdoc_dir = 'rdoc'
29
+ rdoc.title = 'Sextant'
30
+ rdoc.options << '--line-numbers' << '--inline-source'
31
+ rdoc.rdoc_files.include('README.rdoc')
32
+ rdoc.rdoc_files.include('lib/**/*.rb')
33
+ end
34
+
35
+
36
+ require 'jeweler'
37
+ Jeweler::Tasks.new do |gem|
38
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
39
+ gem.name = "sextant"
40
+ gem.homepage = "http://github.com/schneems/sextant"
41
+ gem.license = "MIT"
42
+ gem.summary = %Q{Use Sextant to show you the route}
43
+ gem.description = %Q{Sextant is a Rails engine that quickly shows the routes available}
44
+ gem.email = "richard.schneeman@gmail.com"
45
+ gem.authors = ["schneems"]
46
+ # dependencies defined in Gemfile
47
+ end
48
+ Jeweler::RubygemsDotOrgTasks.new
49
+
50
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,15 @@
1
+ class Rails::RoutesController < ApplicationController
2
+ layout 'rails/routes'
3
+
4
+ before_filter :ensure_local
5
+
6
+ def index
7
+ @routes = Sextant.format_routes
8
+ end
9
+
10
+ private
11
+ def ensure_local
12
+ return false if ActionView::Resolver.caching
13
+ end
14
+
15
+ end
@@ -0,0 +1,32 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>Routes</title>
6
+ <style>
7
+ body { background-color: #fff; color: #333; }
8
+
9
+ body, p, ol, ul, td {
10
+ font-family: helvetica, verdana, arial, sans-serif;
11
+ font-size: 13px;
12
+ line-height: 18px;
13
+ }
14
+
15
+ pre {
16
+ background-color: #eee;
17
+ padding: 10px;
18
+ font-size: 11px;
19
+ white-space: pre-wrap;
20
+ }
21
+
22
+ a { color: #000; }
23
+ a:visited { color: #666; }
24
+ a:hover { color: #fff; background-color:#000; }
25
+ </style>
26
+ </head>
27
+ <body>
28
+
29
+ <%= yield %>
30
+
31
+ </body>
32
+ </html>
@@ -0,0 +1,9 @@
1
+ <h2>
2
+ Routes
3
+ </h2>
4
+
5
+ <p>
6
+ Routes match in priority from top to bottom
7
+ </p>
8
+
9
+ <p><pre><%= @routes %></pre></p>
data/config/routes.rb ADDED
@@ -0,0 +1,9 @@
1
+ Rails.application.routes.draw do
2
+ namespace :rails do
3
+ resources :routes, :only => [:index, :show]
4
+ end
5
+ end
6
+
7
+ # RouteInspector::Engine.routes.draw do
8
+ #
9
+ # end
data/lib/sextant.rb ADDED
@@ -0,0 +1,15 @@
1
+ require 'rails/application/route_inspector'
2
+ require 'sextant/engine'
3
+
4
+ module Sextant
5
+ def self.format_routes(routes = all_routes)
6
+ inspector = Rails::Application::RouteInspector.new
7
+ inspector.format(routes, ENV['CONTROLLER']).join "\n"
8
+ end
9
+
10
+ def self.all_routes
11
+ Rails.application.reload_routes!
12
+ Rails.application.routes.routes
13
+ end
14
+ end
15
+
@@ -0,0 +1,5 @@
1
+ module Sextant
2
+ class Engine < Rails::Engine
3
+ isolate_namespace Sextant
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+ require 'rake'
6
+
7
+ Dummy::Application.load_tasks
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag :all %>
6
+ <%= javascript_include_tag :defaults %>
7
+ <%= csrf_meta_tag %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
@@ -0,0 +1,46 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require "active_model/railtie"
4
+ require "active_record/railtie"
5
+ require "action_controller/railtie"
6
+ require "action_view/railtie"
7
+ require "action_mailer/railtie"
8
+
9
+ Bundler.require
10
+
11
+ require "sextant"
12
+
13
+ module Dummy
14
+ class Application < Rails::Application
15
+ # Settings in config/environments/* take precedence over those specified here.
16
+ # Application configuration should go into files in config/initializers
17
+ # -- all .rb files in that directory are automatically loaded.
18
+
19
+ # Custom directories with classes and modules you want to be autoloadable.
20
+ # config.autoload_paths += %W(#{config.root}/extras)
21
+
22
+ # Only load the plugins named here, in the order given (default is alphabetical).
23
+ # :all can be used as a placeholder for all plugins not explicitly named.
24
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
25
+
26
+ # Activate observers that should always be running.
27
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
28
+
29
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
30
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
31
+ # config.time_zone = 'Central Time (US & Canada)'
32
+
33
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
34
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
35
+ # config.i18n.default_locale = :de
36
+
37
+ # JavaScript files you want as :defaults (application.js is always included).
38
+ # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
39
+
40
+ # Configure the default encoding used in templates for Ruby 1.9.
41
+ config.encoding = "utf-8"
42
+
43
+ # Configure sensitive parameters which will be filtered from the log file.
44
+ config.filter_parameters += [:password]
45
+ end
46
+ end