Sha256: a35e3624bfc5791392e1f7d3a48375599351ed96405a0f7d43b9bf1d90e72f6c

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

namespace :mack do
  
  namespace :dump do

    desc "Dumps out the configuration for the specified environment."
    task :config => :environment do
      pp Mack::Configuration.dump
    end # config
    
    desc "Show all the routes available"
    task :routes => :environment do
      include Mack::Routes::Urls
      puts ""
      puts "Routes:"
      
      routes = Mack::Routes::RouteMap.instance.routes_list
      routes.each do |r|
        # pp r.inspect
        pat = r.original_pattern.blank? ? '/' : r.original_pattern
        pat << "(.:format)"
        opts = r.options.dup
        meth = opts[:method]
        opts.delete(:method)
        puts "#{pat.rjust(50)}\t#{meth.to_s.upcase}\t#{opts.inspect.ljust(0)}"
      end
      puts ""
      puts "-" * 125
      puts "Route helper methods:"
      
      url_methods = Mack::Routes::Urls.protected_instance_methods.collect {|x| x if x.match(/_url$/)}.compact
      url_methods.sort.each do |meth|
        unless meth.match(/(full|droute)_url$/)
          puts "#{meth.rjust(50)}\t#{self.send(meth)}"
        end
      end
      puts ""
    end # routes

  end # dump

end # mack

alias_task :routes, "mack:dump:routes"  

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mack-0.7.0 lib/mack/tasks/mack_dump_tasks.rake
mack-0.7.0.1 lib/mack/tasks/mack_dump_tasks.rake
mack-0.7.1.1 lib/mack/tasks/mack_dump_tasks.rake
mack-0.7.1 lib/mack/tasks/mack_dump_tasks.rake