如何将我自己的扩展添加到 spree 应用程序并将其部署到 heroku?

How to add my own extensions to a spree application and deploy it to heroku?

我关注了https://guides.spreecommerce.com/developer/extensions_tutorial.html并完成了扩展spree_simple_sales。一切都在开发中运行良好。但我不知道如何部署它。

当我运行

rails g spree_simple_seals:install

它给了我

append  vendor/assets/javascripts/spree/frontend/all.js
append  vendor/assets/javascripts/spree/backend/all.js
insert  vendor/assets/stylesheets/spree/frontend/all.css
insert  vendor/assets/stylesheets/spree/backend/all.css
run  bundle exec rake railties:install:migrations   FROM=spree_simple_sales from "."
Would you like to run the migrations now? [Y/n] y
run  bundle exec rake db:migrate from "."

None 其他添加的代码似乎被复制了进来。但不知何故应用程序是 运行ning 正确。这是如何工作的?

然后我尝试将它部署到heroku。但是,不出所料,出现了这个错误:

The path `/tmp/spree_extensions/spree_simple_sales` does not exist.

正确的做法是什么?

这是 Gemfile。最后是 spree_simple_sales 扩展,带有本地目录的路径,如教程所述:

source 'https://rubygems.org'

ruby '2.2.0'
gem 'rails', '4.2.1'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'

gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc

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

group :production do
    gem 'pg'
    gem 'rails_12factor'
    gem 'puma'
end

gem 'spree', '3.0.0'
gem 'spree_gateway', github: 'spree/spree_gateway', branch: '3-0-stable'
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '3-0-stable'
gem 'spree_simple_sales', path: '../spree_extensions/spree_simple_sales'

想通了。只需将扩展目录放在 /vendor 下并从 Gemfile 中引用它,它就会在 heroku 上工作。

我遇到了完全相同的问题。通过查询狂欢社区,我发现添加自定义扩展的正确方法是为其提供自己的 git 存储库,然后在 gem 文件中引用该 git 存储库。

gem 'spree_simple_sales', git中心: 'username/spree_simple_sales'