Skip to content

Commit

Permalink
Add solidus_admin to newly generated stores
Browse files Browse the repository at this point in the history
  • Loading branch information
elia committed May 5, 2023
1 parent 9cf54d1 commit 02a9836
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions admin/config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

SolidusAdmin::Engine.routes.draw do
get '/', to: ->(env) { [200, {}, ['Hello from the new admin!']] }
end
11 changes: 11 additions & 0 deletions admin/lib/generators/solidus_admin/install/install_generator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

module SolidusAdmin
module Generators
class InstallGenerator < Rails::Generators::Base
def install_solidus_core_support
route "mount SolidusAdmin::Engine, at: '/solidus_admin'"
end
end
end
end
1 change: 1 addition & 0 deletions bin/sandbox
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ cd ./sandbox
cat <<RUBY >> Gemfile
gem 'solidus', path: '..'
gem 'solidus_admin', path: '../admin'
gem 'rails-i18n'
gem 'solidus_i18n'
Expand Down
5 changes: 5 additions & 0 deletions core/lib/generators/solidus/install/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ def create_database
rake 'db:create'
end

def install_solidus_admin
bundle_command 'add solidus_admin' unless has_gem?('solidus_admin')
generate 'solidus_admin:install'
end

def install_routes
if Pathname(app_path).join('config', 'routes.rb').read.include? CORE_MOUNT_ROUTE
say_status :route_exist, CORE_MOUNT_ROUTE, :blue
Expand Down

0 comments on commit 02a9836

Please sign in to comment.