Sha256: 7bd9347e9ba69eb25e8602c59981a8d38557ba5f121f59655f39bdca5b3ded48

Contents?: true

Size: 1.22 KB

Versions: 7

Compression:

Stored size: 1.22 KB

Contents

# frozen_string_literal: true

require_relative "../../lib/plutonium_generators"

module Pu
  module Core
    class InstallGenerator < Rails::Generators::Base
      include PlutoniumGenerators::Generator

      source_root File.expand_path("templates", __dir__)

      desc "Set up the base requirements for Plutonium"

      def start
        setup_packages
        setup_app
        eject_views
      rescue => e
        exception "#{self.class} failed:", e
      end

      private

      def setup_packages
        copy_file "config/packages.rb"
        create_file "packages/.keep"
        insert_into_file "config/application.rb", "\nrequire_relative \"packages\"\n", after: /Bundler\.require.*\n/
        # insert_into_file "config/application.rb", indent("Plutonium.configure_rails config\n\n", 4), after: /.*< Rails::Application\n/
      end

      def setup_app
        # directory "config"
        directory "app"

        environment "# config.plutonium.assets.favicon = \"favicon.ico\""
        environment "# config.plutonium.assets.logo = \"logo.png\""
      end

      def eject_views
        invoke "pu:eject:layout", [], dest: "main_app",
          force: options[:force],
          skip: options[:skip]
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
plutonium-0.12.9 lib/generators/pu/core/install/install_generator.rb
plutonium-0.12.8 lib/generators/pu/core/install/install_generator.rb
plutonium-0.12.7 lib/generators/pu/core/install/install_generator.rb
plutonium-0.12.3 lib/generators/pu/core/install/install_generator.rb
plutonium-0.12.2 lib/generators/pu/core/install/install_generator.rb
plutonium-0.12.1 lib/generators/pu/core/install/install_generator.rb
plutonium-0.12.0 lib/generators/pu/core/install/install_generator.rb