如何将炼金术添加到现有的狂欢项目

How to add alchemy to existing spree project

我已经配置了一个 Spree project that is functioning. I'm not try to include Alchemy CMS in the project. I followed the guide on the Github Repo. The only exception is that I skipped the auth step because I already have spree_auth_devise。尝试安装 Alchemy 时,bundle exec rake alchemy:install。我收到以下错误。

错误

rake aborted!
Bundler::GemRequireError: There was an error while trying to load the gem 'alchemy_spree'.
/Users/atbyrd/dev/distinct-existence/config/application.rb:7:in `<top (required)>'
/Users/atbyrd/dev/distinct-existence/Rakefile:4:in `require'
/Users/atbyrd/dev/distinct-existence/Rakefile:4:in `<top (required)>'
NameError: uninitialized constant Alchemy::AuthEngine
/Users/atbyrd/dev/distinct-existence/config/application.rb:7:in `<top (required)>'
/Users/atbyrd/dev/distinct-existence/Rakefile:4:in `require'
/Users/atbyrd/dev/distinct-existence/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)

宝石文件

ruby '2.2.4'
source 'https://rubygems.org'

gem 'rails', '4.2.5'
gem 'pg', '~> 0.15'
gem 'sass-rails'
gem 'uglifier'
gem 'coffee-rails'
gem 'jquery-rails'
gem 'turbolinks'
gem 'active_model_serializers'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'spree', github: 'spree/spree'
gem 'spree_auth_devise', github: 'spree/spree_auth_devise'
gem 'puma'
gem 'paperclip'
gem 'aws-sdk', '< 2.0'
gem 'delayed_job_active_record'

gem 'alchemy_spree'
gem 'alchemy_cms'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  gem 'byebug'
end

group :development do
  gem 'web-console', '~> 2.0'
  gem 'spring'
end

config/initializers/alchemy.rb

# Tell Alchemy to use the Spree::User class
Alchemy.user_class_name = 'Spree::User'
Alchemy.current_user_method = :spree_current_user

# Load the Spree.user_class decorator for Alchemy roles
require 'alchemy/spree/spree_user_decorator'

# Include the Spree controller helpers to render the
# alchemy pages within the default Spree layout
Alchemy::BaseHelper.send :include, Spree::BaseHelper
Alchemy::BaseController.send :include, Spree::Core::ControllerHelpers::Common
Alchemy::BaseController.send :include, Spree::Core::ControllerHelpers::Store

看起来像是过时的 gem 版本。您使用的是哪个版本的 Spree?请检查您的 Gemfile.lock。如果是 3.x 那么请尝试使用此 gem 的 GitHub 版本,方法是在 Gemfile 和 运行 [=13= 中使用 gem 'alchemy_spree', github: 'magiclabs/alchemy_spree', branch: 'master' ].

而且,关于 README,如果您使用 spree_auth_devise,您需要在您的应用程序中添加一个初始化程序。仅仅跳过这一步是行不通的。

我上面提到的所有内容都在项目的自述文件中进行了说明。你关注了吗?