Class: Omniauth::MultipleProviders::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Omniauth::MultipleProviders::Generators::InstallGenerator
- Defined in:
- lib/generators/omniauth/multiple_providers/install/install_generator.rb
Instance Method Summary collapse
- #add_multiple_providers_routes ⇒ Object
- #add_provider_user ⇒ Object
- #create_provider_user ⇒ Object
- #insert_to_user ⇒ Object
Instance Method Details
#add_multiple_providers_routes ⇒ Object
25 26 27 28 29 |
# File 'lib/generators/omniauth/multiple_providers/install/install_generator.rb', line 25 def add_multiple_providers_routes route "get '/auth/:provider/callback' => 'omniauth/multiple_providers#create'" route "get '/auth/failure' => 'omniauth/multiple_providers#failure'" route "resources :omniauth, only: [:new, :create, :failure, :destroy], controller: 'omniauth/multiple_providers'" end |
#add_provider_user ⇒ Object
9 10 11 |
# File 'lib/generators/omniauth/multiple_providers/install/install_generator.rb', line 9 def add_provider_user copy_file 'provider_user.rb', 'app/models/provider_user.rb' end |
#create_provider_user ⇒ Object
13 14 15 16 |
# File 'lib/generators/omniauth/multiple_providers/install/install_generator.rb', line 13 def create_provider_user # FIXME add datetime require copy_file 'create_provider_users.rb', "db/migrate/#{DateTime.now.strftime('%Y%m%d%H%M%S')}_create_provider_users.rb" end |
#insert_to_user ⇒ Object
18 19 20 21 22 23 |
# File 'lib/generators/omniauth/multiple_providers/install/install_generator.rb', line 18 def insert_to_user #insert_into_file 'app/models/user.rb', ' include Omniauth::MultipleProviders::Omniauthable', after: 'class User < ActiveRecord::Base' inject_into_class 'app/models/user.rb', User do " include Omniauth::MultipleProviders::Omniauthable\n" end end |