Sha256: 92f2e592b8670f7b2879a7272e894be04c2fd956b8a213bc61206dd185e6f342

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

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

    desc <<-DESC.strip_heredoc
      Generates layout for the entire admin panel

      For example:
        rails g cm_admin:install

      It copies the respectively layout files and the necessary asset files.

    DESC

    def add_required_gems
      gem 'slim'
      gem 'simple_form'
      system("yarn add bootstrap")
      system("yarn add @fortawesome/fontawesome-free")
      system("yarn add select2")
    end

    def copy_layout_file
      copy_file "layouts/_side_navbar.html.slim", "app/views/layouts/_side_navbar.html.slim"
      copy_file "layouts/_navbar.html.slim", "app/views/layouts/_navbar.html.slim"
      remove_file "app/views/layouts/application.html.erb"
      copy_file "layouts/application.html.slim", "app/views/layouts/application.html.slim"
    end

    def copy_asset_file
      copy_file "assets/images/cm.png", "app/assets/images/cm.png"
      directory "assets/stylesheets/", "app/assets/stylesheets/"
      remove_file "app/assets/stylesheets/application.css"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cm-admin-0.2.0 lib/generators/cm_admin/install_generator.rb