Sha256: 7ff8f3fb0fb96039ca66edccc709adc1f90072589a175bfa9564d52822494045

Contents?: true

Size: 776 Bytes

Versions: 3

Compression:

Stored size: 776 Bytes

Contents

module ActiveadminAddons
  module Generators
    class InstallGenerator < Rails::Generators::Base
      source_root File.expand_path('templates', __dir__)

      def create_initializer
        template "initializer.rb", "config/initializers/activeadmin_addons.rb"
      end

      def setup_assets
        if use_webpacker?
          generate "activeadmin_addons:webpacker"
        else
          puts "ActiveAdmin Addons requires ActiveAdmin installed with webpacker. "\
          "Please run 'rails generate active_admin:install --webpacker' and then 'rails generate activeadmin_addons:install'"
        end
      end

      private

      def use_webpacker?
        ActiveAdmin.application.use_webpacker
      rescue NoMethodError
        false
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activeadmin_addons-2.0.0.beta.3 lib/generators/activeadmin_addons/install/install_generator.rb
activeadmin_addons-2.0.0.beta.2 lib/generators/activeadmin_addons/install/install_generator.rb
activeadmin_addons-2.0.0.beta.0 lib/generators/activeadmin_addons/install/install_generator.rb