Sha256: c58d5efa4560d42186f22571005d0170338f9c9c82cc9894fc7c4250145c8b93

Contents?: true

Size: 1.02 KB

Versions: 18

Compression:

Stored size: 1.02 KB

Contents

require 'generators/spree/install/install_generator'

Spree::InstallGenerator.class_eval do
  CORE_MOUNT_ROUTE = "mount Spree::Core::Engine"

  def install_routes
    routes_file_path = File.join('config', 'routes.rb')
    unless File.read(routes_file_path).include? CORE_MOUNT_ROUTE
      insert_into_file routes_file_path, after: "Rails.application.routes.draw do\n" do
        <<-ROUTES
  # This line mounts Solidus's routes at the root of your application.
  # This means, any requests to URLs such as /products, will go to Spree::ProductsController.
  # If you would like to change where this engine is mounted, simply change the :at option to something different.
  #
  # We ask that you don't use the :as option here, as Solidus relies on it being the default of "spree"
  #{CORE_MOUNT_ROUTE}, at: '/'

ROUTES
      end
    end

    unless options[:quiet]
      puts "*" * 50
      puts "We added the following line to your application's config/routes.rb file:"
      puts " "
      puts "    #{CORE_MOUNT_ROUTE}, at: '/'"
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
alchemy-solidus-4.0.0.pre.b2 lib/alchemy/solidus/spree_install_generator_fix.rb
alchemy-solidus-4.0.0.pre.b1 lib/alchemy/solidus/spree_install_generator_fix.rb
alchemy-solidus-3.3.0 lib/alchemy/solidus/spree_install_generator_fix.rb
alchemy-solidus-3.2.2 lib/alchemy/solidus/spree_install_generator_fix.rb
alchemy-solidus-3.2.1 lib/alchemy/solidus/spree_install_generator_fix.rb
alchemy-solidus-3.2.0 lib/alchemy/solidus/spree_install_generator_fix.rb
alchemy-solidus-3.1.1 lib/alchemy/solidus/spree_install_generator_fix.rb
alchemy-solidus-3.1.0 lib/alchemy/solidus/spree_install_generator_fix.rb
alchemy-solidus-3.0.2 lib/alchemy/solidus/spree_install_generator_fix.rb
alchemy-solidus-3.0.1 lib/alchemy/solidus/spree_install_generator_fix.rb
alchemy-solidus-3.0.0 lib/alchemy/solidus/spree_install_generator_fix.rb
alchemy-solidus-2.5.1 lib/alchemy/solidus/spree_install_generator_fix.rb
alchemy-solidus-2.5.0 lib/alchemy/solidus/spree_install_generator_fix.rb
alchemy-solidus-2.4.0 lib/alchemy/solidus/spree_install_generator_fix.rb
alchemy-solidus-2.3.2 lib/alchemy/solidus/spree_install_generator_fix.rb
alchemy-solidus-2.3.1 lib/alchemy/solidus/spree_install_generator_fix.rb
alchemy-solidus-2.3.0 lib/alchemy/solidus/spree_install_generator_fix.rb
alchemy-solidus-2.2.0 lib/alchemy/solidus/spree_install_generator_fix.rb