Sha256: b5b91e7172933ff4f8627481dca3cd53b85169ca7580de8a35bfb27938f9239b
Contents?: true
Size: 1.5 KB
Versions: 8
Compression:
Stored size: 1.5 KB
Contents
require 'rails/generators/active_record' module InfinumId module Generators class InstallGenerator < ::Rails::Generators::Base include Rails::Generators::Migration source_root File.expand_path('../templates', __dir__) def inject_secrets insert_into_file 'config/secrets.yml', secrets_template, after: "bugsnag_api_key: <%= Figaro.env.bugsnag_api_key! %>\n" end def copy_migration migration_template 'migration.rb', 'db/migrate/create_users.rb' end def copy_model template 'user.rb', 'app/models/user.rb' end def inject_routes insert_into_file 'config/routes.rb', routes_template, after: "Rails.application.routes.draw do\n" end def self.next_migration_number(dirname) ActiveRecord::Generators::Base.next_migration_number(dirname) end def migration_version "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" end private def routes_template <<RUBY devise_for :users, controllers: { omniauth_callbacks: 'infinum_id/users/omniauth_callbacks' } RUBY end def secrets_template <<RUBY redis_server_url: <%= Figaro.env.redis_server_url %> redis_client_url: <%= Figaro.env.redis_client_url %> infinum_id: client_id: <%= Figaro.env.infinum_id_client_id %> client_secret: <%= Figaro.env.infinum_id_client_secret %> url: <%= Figaro.env.infinum_id_client_url %> RUBY end end end end
Version data entries
8 entries across 8 versions & 1 rubygems