Sha256: 27c0bec87ef3e044b372ece2c27b2def46e93c2fce6f7f65208a5792ed0b5480
Contents?: true
Size: 1.71 KB
Versions: 2
Compression:
Stored size: 1.71 KB
Contents
# frozen_string_literal: true module Solidus class InstallGenerator < Rails::Generators::Base class InstallFrontend attr_reader :bundler_context, :generator_context def initialize(bundler_context:, generator_context:) @bundler_context = bundler_context @generator_context = generator_context end def call(frontend, installer_adds_auth:) case frontend when 'solidus_frontend' install_solidus_frontend when 'solidus_starter_frontend' install_solidus_starter_frontend(installer_adds_auth) end end private def install_solidus_frontend unless @bundler_context.component_in_gemfile?(:frontend) BundlerContext.bundle_cleanly do `bundle add solidus_frontend` `bundle install` end end @generator_context.generate('solidus_frontend:install') end def install_solidus_starter_frontend(installer_adds_auth) @bundler_context.remove(['solidus_frontend']) if @bundler_context.component_in_gemfile?(:frontend) # TODO: Move installation of solidus_auth_devise to the # solidus_starter_frontend template unless auth_present?(installer_adds_auth) BundlerContext.bundle_cleanly { `bundle add solidus_auth_devise` } @generator_context.generate('solidus:auth:install --auto-run-migrations') end `LOCATION="https://raw.githubusercontent.com/solidusio/solidus_starter_frontend/main/template.rb" bin/rails app:template` end def auth_present?(installer_adds_auth) installer_adds_auth || @bundler_context.component_in_gemfile?(:auth_devise) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
solidus_core-3.2.1 | lib/generators/solidus/install/install_generator/install_frontend.rb |
solidus_core-3.2.0 | lib/generators/solidus/install/install_generator/install_frontend.rb |