Sha256: 242abf0848bc49b483bd78b7c86af99bd56de024054a9d378b488981e289263e

Contents?: true

Size: 1.44 KB

Versions: 8

Compression:

Stored size: 1.44 KB

Contents

module ActiveadminSettings
  module Generators
    class InstallGenerator < Rails::Generators::Base
      desc << "Description:\n    Copies source files to your application's app directory and required gems."

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

      def copy_files
        # admin
        puts "Installing admin:"
        copy_file "admin/settings.rb",    "app/admin/settings.rb"

        # config
        puts "Installing config:"
        copy_file "config/activeadmin_settings.yml", "config/activeadmin_settings.yml"
      end

      def mount_engine
        route "mount_activeadmin_settings()"
      end

      def add_assets
        if File.exist?('app/assets/javascripts/active_admin.js')
          insert_into_file  "app/assets/javascripts/active_admin.js",
                            "//= require activeadmin_settings\n", :after => "base\n"
        else
          puts "It doesn't look like you've installed activeadmin: active_admin.js is missing.\nPlease install it and try again."
        end

        if File.exist?('app/assets/stylesheets/active_admin.css.scss')
          insert_into_file  "app/assets/stylesheets/active_admin.css.scss",
                            "//= require activeadmin_settings\n", :before => "// Active Admin CSS Styles\n"
        else
          puts "It doesn't look like you've installed activeadmin: active_admin.scss is missing.\nPlease install it and try again."
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
activeadmin-settings-0.4.4 lib/generators/activeadmin_settings/install_generator.rb
activeadmin-settings-0.4.3 lib/generators/activeadmin_settings/install_generator.rb
activeadmin-settings-0.4.2 lib/generators/activeadmin_settings/install_generator.rb
activeadmin-settings-0.4.1 lib/generators/activeadmin_settings/install_generator.rb
activeadmin-settings-0.4.0 lib/generators/activeadmin_settings/install_generator.rb
activeadmin-settings-0.3.5 lib/generators/activeadmin_settings/install_generator.rb
activeadmin-settings-0.3.4 lib/generators/activeadmin_settings/install_generator.rb
activeadmin-settings-0.3.3 lib/generators/activeadmin_settings/install_generator.rb