Class: OauthProviderGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/oauth_provider/oauth_provider_generator.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) add_routes



27
28
29
30
31
32
33
34
35
36
# File 'lib/generators/oauth_provider/oauth_provider_generator.rb', line 27

def add_routes
  route "match '/oauth',               :to => 'oauth#index',         :as => :oauth"
  route "match '/oauth/authorize',     :to => 'oauth#authorize',     :as => :authorize"
  route "match '/oauth/request_token', :to => 'oauth#request_token', :as => :request_token"
  route "match '/oauth/access_token',  :to => 'oauth#access_token',  :as => :access_token"
  route "match '/oauth/token',         :to => 'oauth#token',         :as => :token"
  route "match '/oauth/test_request',  :to => 'oauth#test_request',  :as => :test_request"

  route "resources :#{file_name}_clients"
end

- (Object) check_class_collisions



12
13
14
15
16
17
18
# File 'lib/generators/oauth_provider/oauth_provider_generator.rb', line 12

def check_class_collisions
  # Check for class naming collisions.
  class_collisions class_path, "#{class_name}Controller", # Oauth Controller
                               "#{class_name}Helper",
                               "#{class_name}ClientsController",
                               "#{class_name}ClientsHelper"
end

- (Object) copy_controller_files



20
21
22
23
# File 'lib/generators/oauth_provider/oauth_provider_generator.rb', line 20

def copy_controller_files
  template 'controller.rb',         File.join('app/controllers', class_path, "#{file_name}_controller.rb")
  template 'clients_controller.rb', File.join('app/controllers', class_path, "#{file_name}_clients_controller.rb")
end