Sha256: 7430e12834d117510a4c5af3d954be01be86aabb4944107e502849d8ba1c1883

Contents?: true

Size: 1.58 KB

Versions: 74

Compression:

Stored size: 1.58 KB

Contents

# Application template recipe for the rails_apps_composer. Change the recipe here:
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/omniauth.rb

stage_two do
  say_wizard "recipe stage two"
  if prefer :authentication, 'omniauth'
    repo = 'https://raw.github.com/RailsApps/rails-omniauth/master/'
    copy_from_repo 'config/initializers/omniauth.rb', :repo => repo
    gsub_file 'config/initializers/omniauth.rb', /twitter/, prefs[:omniauth_provider] unless prefer :omniauth_provider, 'twitter'
    generate 'model User name:string provider:string uid:string'
    run 'bundle exec rake db:migrate'
    copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails-omniauth/master/'
    copy_from_repo 'app/controllers/application_controller.rb', :repo => repo
    filename = 'app/controllers/sessions_controller.rb'
    copy_from_repo filename, :repo => repo
    gsub_file filename, /twitter/, prefs[:omniauth_provider] unless prefer :omniauth_provider, 'twitter'
    routes = <<-TEXT
  get '/auth/:provider/callback' => 'sessions#create'
  get '/signin' => 'sessions#new', :as => :signin
  get '/signout' => 'sessions#destroy', :as => :signout
  get '/auth/failure' => 'sessions#failure'
TEXT
    inject_into_file 'config/routes.rb', routes + "\n", :after => "routes.draw do\n"
  end
  ### GIT ###
  git :add => '-A' if prefer :git, true
  git :commit => '-qm "rails_apps_composer: omniauth"' if prefer :git, true
end

__END__

name: omniauth
description: "Add OmniAuth for authentication"
author: RailsApps

requires: [setup, gems]
run_after: [setup, gems]
category: mvc

Version data entries

74 entries across 74 versions & 1 rubygems

Version Path
rails_apps_composer-3.1.14 recipes/omniauth.rb
rails_apps_composer-3.1.13 recipes/omniauth.rb
rails_apps_composer-3.1.12 recipes/omniauth.rb
rails_apps_composer-3.1.11 recipes/omniauth.rb
rails_apps_composer-3.1.10 recipes/omniauth.rb
rails_apps_composer-3.1.9 recipes/omniauth.rb
rails_apps_composer-3.1.8 recipes/omniauth.rb
rails_apps_composer-3.1.7 recipes/omniauth.rb
rails_apps_composer-3.1.6 recipes/omniauth.rb
rails_apps_composer-3.1.5 recipes/omniauth.rb
rails_apps_composer-3.1.4 recipes/omniauth.rb
rails_apps_composer-3.1.3 recipes/omniauth.rb
rails_apps_composer-3.1.2 recipes/omniauth.rb
rails_apps_composer-3.1.1 recipes/omniauth.rb
rails_apps_composer-3.1.0 recipes/omniauth.rb
rails_apps_composer-3.0.44 recipes/omniauth.rb
rails_apps_composer-3.0.43 recipes/omniauth.rb
rails_apps_composer-3.0.42 recipes/omniauth.rb
rails_apps_composer-3.0.41 recipes/omniauth.rb
rails_apps_composer-3.0.40 recipes/omniauth.rb