<commit_before>module Uniform
  class Routes

    # In your application's config/routes.rb, draw Uniform routes:
    #
    # @example
    #   map.resources :posts
    #   Uniform::Routes.draw(map)
    #
    def self.draw(map)
      
      # Session
      map.login  'login',  :controller => 'uniform/sessions', :action => 'new'
      map.logout 'logout', :controller => 'uniform/sessions', :action => 'destroy', :method => :delete
      map.session 'session', :controller => 'uniform/sessions', :action => 'create', :method => :post   

      # User
      map.signup 'signup', :controller => 'uniform/users', :action => 'new'
      map.confirm 'confirm/:code', :controller => 'uniform/users', :action => 'activate'
      map.resource :user, :except => [:new ], :controller => 'uniform/users' 
      
      # Cart
      map.resource :cart, :except => [:edit] 
      map.add_to_cart '/cart/add/:id', :controller => "carts", :action => 'add'
      map.remove_from_cart '/cart/remove/:id', :controller => "carts", :action => 'remove'
      
      
      # Checkout (for cart)
      map.resource :checkout do |checkout|
        checkout.resources :steps, :only => [:index, :show ], :controller => "checkout_steps" 
      end
      

    end

  end
end
<commit_msg>Split the routes into smaller, groups. So that if you don't need all the routes, you can leave them out.<commit_after>module Uniform
  class Routes

    # In your application's config/routes.rb, draw Uniform routes:
    #
    # Because not applications need a cart or signup.
    # So if your application only requires sesssion_paths, you only need to include that
    # 
    # eg: Uniform::Routes.draw_session_paths(map)
    #
    def self.draw(map)
      
      draw_session_paths(map)
      draw_signup_paths(map)
      draw_cart_and_checkout_paths(map)
      
    end
    
    def self.draw_session_paths(map)

      # Session
      map.login  'login',  :controller => 'uniform/sessions', :action => 'new'
      map.logout 'logout', :controller => 'uniform/sessions', :action => 'destroy', :method => :delete
      map.session 'session', :controller => 'uniform/sessions', :action => 'create', :method => :post   
    end
    
    def self.draw_signup_paths(map)

      # User
      map.signup 'signup', :controller => 'uniform/users', :action => 'new'
      map.confirm 'confirm/:code', :controller => 'uniform/users', :action => 'activate'
      map.resource :user, :except => [:new ], :controller => 'uniform/users' 
    end
    
    def self.draw_cart_and_checkout_paths(map)
      
      # Cart
      map.resource :cart, :except => [:edit] 
      map.add_to_cart '/cart/add/:id', :controller => "carts", :action => 'add'
      map.remove_from_cart '/cart/remove/:id', :controller => "carts", :action => 'remove'
      
      # Checkout (for cart)
      map.resource :checkout do |checkout|
        checkout.resources :steps, :only => [:index, :show ], :controller => "checkout_steps" 
      end
      
    end

  end
end

{'fraction_non_alphanumeric': 0.14553362328537972, 'fraction_numerical': 0.0, 'mean_word_length': 2.751568381430364, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '881055', 'n_tokens_mistral': 945, 'n_tokens_neox': 927, 'n_words': 238}