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



我有一个正在运行的现有Spree项目。我没有尝试将Alchemy CMS纳入该项目。我遵循了Github Repo上的指南。唯一的例外是我跳过了身份验证步骤,因为我已经配置了spree_auth_device。当尝试安装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)

Gemfile

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/ininitializers/archemy.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,那么请在Gemfile中使用gem 'alchemy_spree', github: 'magiclabs/alchemy_spree', branch: 'master'并运行bundle update alchemy_spree,尝试使用此gem的GitHub版本。

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

我上面提到的每一件事都在项目的自述中说明了。你跟着它走了吗?

最新更新