Sha256: d4ac6e090fbd02fd46f8b86f33594d7f1f8c282a0f02c1af4a3c94418e2d29b7

Contents?: true

Size: 1.15 KB

Versions: 57

Compression:

Stored size: 1.15 KB

Contents

module Cmor
  module UserArea
    module Generators
      class InstallGenerator < Rails::Generators::Base
        desc 'Generates the initializer'

        source_root File.expand_path('../templates', __FILE__)

        attr_reader :base_controller_class_name

        def initialize(*args)
          super
          @base_controller_class_name = ENV.fetch('BASE_CONTROLLER_CLASS_NAME') { '::ApplicationController' }
        end

        def generate_initializer
          template 'initializer.rb', 'config/initializers/cmor_user_area.rb'
        end

        def generate_routes
          route File.read(File.join(File.expand_path('../templates', __FILE__), 'routes.source'))
        end

        def add_helpers_to_application_controller
          inject_into_file 'app/controllers/application_controller.rb', before: "\nend" do
            File.read(File.join(File.expand_path('../templates', __FILE__), 'application_controller.source'))
          end
        end

        # def add_default_user
        #   if yes? "Add default user (user@expample.com/password)?"
        #     CreateDefaultUserService.call
        #   end
        # end
      end
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
cmor_user_area-0.0.60.pre lib/generators/cmor/user_area/install/install_generator.rb
cmor_user_area-0.0.59.pre lib/generators/cmor/user_area/install/install_generator.rb
cmor_user_area-0.0.58.pre lib/generators/cmor/user_area/install/install_generator.rb
cmor_user_area-0.0.57.pre lib/generators/cmor/user_area/install/install_generator.rb
cmor_user_area-0.0.56.pre lib/generators/cmor/user_area/install/install_generator.rb
cmor_user_area-0.0.55.pre lib/generators/cmor/user_area/install/install_generator.rb
cmor_user_area-0.0.54.pre lib/generators/cmor/user_area/install/install_generator.rb
cmor_user_area-0.0.53.pre lib/generators/cmor/user_area/install/install_generator.rb
cmor_user_area-0.0.52.pre lib/generators/cmor/user_area/install/install_generator.rb
cmor_user_area-0.0.51.pre lib/generators/cmor/user_area/install/install_generator.rb
cmor_user_area-0.0.50.pre lib/generators/cmor/user_area/install/install_generator.rb
cmor_user_area-0.0.49.pre lib/generators/cmor/user_area/install/install_generator.rb
cmor_user_area-0.0.48.pre lib/generators/cmor/user_area/install/install_generator.rb
cmor_user_area-0.0.45.pre lib/generators/cmor/user_area/install/install_generator.rb
cmor_user_area-0.0.44.pre lib/generators/cmor/user_area/install/install_generator.rb
cmor_user_area-0.0.43.pre lib/generators/cmor/user_area/install/install_generator.rb
cmor_user_area-0.0.42.pre lib/generators/cmor/user_area/install/install_generator.rb
cmor_user_area-0.0.41.pre lib/generators/cmor/user_area/install/install_generator.rb
cmor_user_area-0.0.40.pre lib/generators/cmor/user_area/install/install_generator.rb
cmor_user_area-0.0.39.pre lib/generators/cmor/user_area/install/install_generator.rb