Sha256: f1324ac4cd37201b740bd172fda38efd58ca5be59bed52c3338bc3bd9b47a999
Contents?: true
Size: 899 Bytes
Versions: 1
Compression:
Stored size: 899 Bytes
Contents
# encoding: UTF-8 PryRails::Commands.create_command "recognize-path" do group "Rails" description "See which route matches a URL." def options(opt) opt.banner unindent <<-USAGE Usage: recognize-path <path> [-m|--method METHOD] Verifies that a given path is mapped to the right controller and action. recognize-path example.com recognize-path example.com -m post USAGE opt.on :m, :method, "Methods", :argument => true end def process method = (opts.m? ? opts[:m] : :get) routes = Rails.application.routes begin info = routes.recognize_path("http://#{args.first}", :method => method) rescue ActionController::UnknownHttpMethod output.puts "Unknown HTTP method: #{method}" rescue ActionController::RoutingError => e output.puts e end output.puts Pry::Helpers::BaseHelpers.colorize_code(info) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pry-rails-0.3.2 | lib/pry-rails/commands/recognize_path.rb |