Permalink
Browse files

initial commit

  • Loading branch information...
0 parents commit 67f8332de66e3b62dcc8d9a7e00cb42a1d176265 @schneems committed May 14, 2012
Showing with 10,095 additions and 0 deletions.
  1. +8 −0 .gitignore
  2. +3 −0 .travis.yml
  3. +3 −0 CHANGELOG.md
  4. +30 −0 Gemfile
  5. +126 −0 Gemfile.lock
  6. +20 −0 MIT-LICENSE
  7. +37 −0 README.md
  8. +50 −0 Rakefile
  9. +1 −0 VERSION
  10. +15 −0 app/controllers/rails/routes_controller.rb
  11. +32 −0 app/views/layouts/rails/routes.html.erb
  12. +9 −0 app/views/rails/routes/index.html.erb
  13. +9 −0 config/routes.rb
  14. +15 −0 lib/sextant.rb
  15. +5 −0 lib/sextant/engine.rb
  16. +7 −0 test/dummy/Rakefile
  17. +3 −0 test/dummy/app/controllers/application_controller.rb
  18. +2 −0 test/dummy/app/helpers/application_helper.rb
  19. +14 −0 test/dummy/app/views/layouts/application.html.erb
  20. +4 −0 test/dummy/config.ru
  21. +46 −0 test/dummy/config/application.rb
  22. +10 −0 test/dummy/config/boot.rb
  23. +22 −0 test/dummy/config/database.yml
  24. +5 −0 test/dummy/config/environment.rb
  25. +25 −0 test/dummy/config/environments/development.rb
  26. +49 −0 test/dummy/config/environments/production.rb
  27. +35 −0 test/dummy/config/environments/test.rb
  28. +7 −0 test/dummy/config/initializers/backtrace_silencers.rb
  29. +10 −0 test/dummy/config/initializers/inflections.rb
  30. +5 −0 test/dummy/config/initializers/mime_types.rb
  31. +7 −0 test/dummy/config/initializers/secret_token.rb
  32. +8 −0 test/dummy/config/initializers/session_store.rb
  33. +5 −0 test/dummy/config/locales/en.yml
  34. +61 −0 test/dummy/config/routes.rb
  35. +26 −0 test/dummy/public/404.html
  36. +26 −0 test/dummy/public/422.html
  37. +26 −0 test/dummy/public/500.html
  38. 0 test/dummy/public/favicon.ico
  39. +1 −0 test/dummy/public/index.html
  40. +2 −0 test/dummy/public/javascripts/application.js
  41. +965 −0 test/dummy/public/javascripts/controls.js
  42. +974 −0 test/dummy/public/javascripts/dragdrop.js
  43. +1,123 −0 test/dummy/public/javascripts/effects.js
  44. +6,001 −0 test/dummy/public/javascripts/prototype.js
  45. +202 −0 test/dummy/public/javascripts/rails.js
  46. 0 test/dummy/public/stylesheets/.gitkeep
  47. +6 −0 test/dummy/script/rails
  48. +13 −0 test/integration/sextant_test.rb
  49. +7 −0 test/route_inspector_test.rb
  50. +5 −0 test/support/integration_case.rb
  51. +30 −0 test/test_helper.rb
@@ -0,0 +1,8 @@
+.bundle/
+log/*.log
+pkg/
+test/dummy/db/*.sqlite3
+test/dummy/log/*.log
+test/dummy/tmp/
+.DS_Store
+.rvmrc
@@ -0,0 +1,3 @@
+language: ruby
+rvm:
+ - 1.9.3
@@ -0,0 +1,3 @@
+## 0.0.1
+
+* First Release
30 Gemfile
@@ -0,0 +1,30 @@
+source "http://rubygems.org"
+
+gem "activesupport" , ">= 3.1"
+gem "rails" , ">= 3.1"
+
+
+
+group :development, :test do
+ gem 'rake'
+ gem 'jeweler', "~> 1.6.4"
+ gem "capybara", ">= 0.4.0"
+ gem "sqlite3"
+ gem "launchy", "~> 2.1.0"
+end
+
+platforms :mri_18 do
+ group :development, :test do
+ gem "rcov"
+ end
+end
+
+platforms :mri_19 do
+ group :development, :test do
+ gem "simplecov"
+ end
+end
+
+# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
+# gem 'ruby-debug'
+# gem 'ruby-debug19'
@@ -0,0 +1,126 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ actionmailer (3.2.3)
+ actionpack (= 3.2.3)
+ mail (~> 2.4.4)
+ actionpack (3.2.3)
+ activemodel (= 3.2.3)
+ activesupport (= 3.2.3)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ journey (~> 1.0.1)
+ rack (~> 1.4.0)
+ rack-cache (~> 1.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.1.2)
+ activemodel (3.2.3)
+ activesupport (= 3.2.3)
+ builder (~> 3.0.0)
+ activerecord (3.2.3)
+ activemodel (= 3.2.3)
+ activesupport (= 3.2.3)
+ arel (~> 3.0.2)
+ tzinfo (~> 0.3.29)
+ activeresource (3.2.3)
+ activemodel (= 3.2.3)
+ activesupport (= 3.2.3)
+ activesupport (3.2.3)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ addressable (2.2.7)
+ arel (3.0.2)
+ builder (3.0.0)
+ capybara (1.1.2)
+ mime-types (>= 1.16)
+ nokogiri (>= 1.3.3)
+ rack (>= 1.0.0)
+ rack-test (>= 0.5.4)
+ selenium-webdriver (~> 2.0)
+ xpath (~> 0.1.4)
+ childprocess (0.3.1)
+ ffi (~> 1.0.6)
+ erubis (2.7.0)
+ ffi (1.0.11)
+ git (1.2.5)
+ hike (1.2.1)
+ i18n (0.6.0)
+ jeweler (1.6.4)
+ bundler (~> 1.0)
+ git (>= 1.2.5)
+ rake
+ journey (1.0.3)
+ json (1.6.6)
+ launchy (2.1.0)
+ addressable (~> 2.2.6)
+ mail (2.4.4)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.18)
+ multi_json (1.2.0)
+ nokogiri (1.5.2)
+ polyglot (0.3.3)
+ rack (1.4.1)
+ rack-cache (1.2)
+ rack (>= 0.4)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.1)
+ rack (>= 1.0)
+ rails (3.2.3)
+ actionmailer (= 3.2.3)
+ actionpack (= 3.2.3)
+ activerecord (= 3.2.3)
+ activeresource (= 3.2.3)
+ activesupport (= 3.2.3)
+ bundler (~> 1.0)
+ railties (= 3.2.3)
+ railties (3.2.3)
+ actionpack (= 3.2.3)
+ activesupport (= 3.2.3)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.6)
+ rake (0.9.2.2)
+ rcov (1.0.0)
+ rdoc (3.12)
+ json (~> 1.4)
+ rubyzip (0.9.7)
+ selenium-webdriver (2.20.0)
+ childprocess (>= 0.2.5)
+ ffi (~> 1.0)
+ multi_json (~> 1.0)
+ rubyzip
+ simplecov (0.6.1)
+ multi_json (~> 1.0)
+ simplecov-html (~> 0.5.3)
+ simplecov-html (0.5.3)
+ sprockets (2.1.2)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ sqlite3 (1.3.5)
+ thor (0.14.6)
+ tilt (1.3.3)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.33)
+ xpath (0.1.4)
+ nokogiri (~> 1.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ activesupport (>= 3.1)
+ capybara (>= 0.4.0)
+ jeweler (~> 1.6.4)
+ launchy (~> 2.1.0)
+ rails (>= 3.1)
+ rake
+ rcov
+ simplecov
+ sqlite3
@@ -0,0 +1,20 @@
+Copyright 2012 Schneems
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,37 @@
+# Sextant
+
+Helps you find your route
+
+## What
+
+Show routes in your app. Visit `http://localhost:3000/rails/routes` and you'll see an output similar to `rake routes`
+
+## Why?
+
+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.
+
+
+## Install
+
+Add this to your Gemfile
+
+```ruby
+ gem 'sextant'
+```
+
+Then run `bundle install` and you're ready to start
+
+
+## Use
+
+Visit `/rails/routes` in your app and you'll see your routes. It's that simple.
+
+![Screenshot]()
+
+Don't worry you can only see this info in development
+
+## About
+
+If you have a question file an issue or find me on the Twitters [@schneems](http://twitter.com/schneems).
+
+This project rocks and uses MIT-LICENSE.
@@ -0,0 +1,50 @@
+# encoding: UTF-8
+require 'rubygems'
+require 'bundler'
+
+begin
+ Bundler.setup(:default, :development, :test)
+rescue Bundler::BundlerError => e
+ $stderr.puts e.message
+ $stderr.puts "Run `bundle install` to install missing gems"
+ exit e.status_code
+end
+
+require 'rake'
+require 'rdoc/task'
+
+require 'rake/testtask'
+
+Rake::TestTask.new(:test) do |t|
+ t.libs << 'lib'
+ t.libs << 'test'
+ t.pattern = 'test/**/*_test.rb'
+ t.verbose = false
+end
+
+task :default => :test
+
+Rake::RDocTask.new(:rdoc) do |rdoc|
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = 'Sextant'
+ rdoc.options << '--line-numbers' << '--inline-source'
+ rdoc.rdoc_files.include('README.rdoc')w
+ rdoc.rdoc_files.include('lib/**/*.rb')
+end
+
+
+require 'jeweler'
+Jeweler::Tasks.new do |gem|
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
+ gem.name = "sextant"
+ gem.homepage = "http://github.com/schneems/sextant"
+ gem.license = "MIT"
+ gem.summary = %Q{Use Sextant to show you the route}
+ gem.description = %Q{Sextant is a Rails engine that quickly shows the routes available}
+ gem.email = "richard.schneeman@gmail.com"
+ gem.authors = ["schneems"]
+ # dependencies defined in Gemfile
+end
+Jeweler::RubygemsDotOrgTasks.new
+
+
@@ -0,0 +1 @@
+0.1.6.pre
@@ -0,0 +1,15 @@
+class Rails::RoutesController < ApplicationController
+ layout 'rails/routes'
+
+ before_filter :ensure_local
+
+ def index
+ @routes = Sextant.format_routes
+ end
+
+ private
+ def ensure_local
+ return false if ActionView::Resolver.caching
+ end
+
+end
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8" />
+ <title>Routes</title>
+ <style>
+ body { background-color: #fff; color: #333; }
+
+ body, p, ol, ul, td {
+ font-family: helvetica, verdana, arial, sans-serif;
+ font-size: 13px;
+ line-height: 18px;
+ }
+
+ pre {
+ background-color: #eee;
+ padding: 10px;
+ font-size: 11px;
+ white-space: pre-wrap;
+ }
+
+ a { color: #000; }
+ a:visited { color: #666; }
+ a:hover { color: #fff; background-color:#000; }
+ </style>
+</head>
+<body>
+
+<%= yield %>
+
+</body>
+</html>
@@ -0,0 +1,9 @@
+<h2>
+ Routes
+</h2>
+
+<p>
+ Routes match in priority from top to bottom
+</p>
+
+<p><pre><%= @routes %></pre></p>
@@ -0,0 +1,9 @@
+Rails.application.routes.draw do
+ namespace :rails do
+ resources :routes, :only => [:index, :show]
@kielkowicz

kielkowicz May 31, 2012

Why do we might need show? You have defined show route, but controller as well as view files are missing.

+ end
+end
+
+# RouteInspector::Engine.routes.draw do
+#
+# end
@@ -0,0 +1,15 @@
+require 'rails/application/route_inspector'
+require 'sextant/engine'
+
+module Sextant
+ def self.format_routes(routes = all_routes)
+ inspector = Rails::Application::RouteInspector.new
+ inspector.format(routes, ENV['CONTROLLER']).join "\n"
+ end
+
+ def self.all_routes
+ Rails.application.reload_routes!
+ Rails.application.routes.routes
+ end
+end
+
@@ -0,0 +1,5 @@
+module Sextant
+ class Engine < Rails::Engine
+ isolate_namespace Sextant
+ end
+end
@@ -0,0 +1,7 @@
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require File.expand_path('../config/application', __FILE__)
+require 'rake'
+
+Dummy::Application.load_tasks
@@ -0,0 +1,3 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+end
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
Oops, something went wrong.

0 comments on commit 67f8332

Please sign in to comment.