简体   繁体   English

如何使用Rails 4安装Refinery CMS

[英]How to install Refinery CMS using Rails 4

I previously never had a problem with Refinery. 我之前从未遇到过炼油厂的问题。 I was refreshing my knowledge by following along to the tutorial http://railscasts.com/episodes/332-refinery-cms-basics .Then when I created a new app with Refinery CMS, I got this error 我按照教程http://railscasts.com/episodes/332-refinery-cms-basics来了解我的知识。然后当我使用Refinery CMS创建一个新的应用程序时,我收到此错误

Bundler could not find compatible versions for gem "actionmailer":
  In Gemfile:
    refinerycms (~> 2.1.0) ruby depends on
      actionmailer (< 3.3, >= 3.1.3) ruby

    rails (= 4.0.0) ruby depends on
      actionmailer (4.0.0)

But should not these things be there by default with the CMS? 但是CMS不应该默认这些东西吗? why would there be errors only now? 为什么现在只会出现错误?

The latest code supports Rails 4; 最新的代码支持Rails 4; the gem must be sourced from the master branch, until a release is made. gem必须来自master分支,直到发布。

Git Issue #2428 - Rails 4 support Git问题#2428 - Rails 4支持

Add to your Gemfile: 添加到您的Gemfile:

gem 'refinerycms-i18n', github: 'refinery/refinerycms-i18n', branch: 'master'
gem 'refinerycms', github: 'refinery/refinerycms', branch: "master"
# Strong parameters is a new feature not used by Refinery
gem 'protected_attributes'

Do a: 做一个:

$ bundle install 

Create a new Refinery app, the command will be different depending on what you want to do. 创建一个新的Refinery应用程序,该命令将根据您的要求而有所不同。 For that there are a few guides that you can follow. 为此,您可以遵循一些指南 In my case, I added it to an existing app with: 就我而言,我将其添加到现有的应用程序中:

$ rails generate refinery:cms --fresh-installation

Start your server and go to: http://localhost:3000/refinery 启动服务器并转到: http://localhost:3000/refinery

Well, my five cents are that Refinery is not yet available for Rails 4: 好吧,我的五美分是炼油厂还没有用于Rails 4:

Best, Ben. 最好,本。

Simply initialize the application using: 只需初始化应用程序:

rails new my_new_application -m http://refinerycms.com/t/edge

Behind the scenes: This command makes your application use the master branch of refinery, which supports Rails 4. 幕后操作:此命令使您的应用程序使用炼油厂的主分支,它支持Rails 4。

Update Although the above is the easiest and official way, it didn't totally work for me. 更新虽然以上是最简单和官方的方式,但它对我来说并不完全有效。 I had to manually run the following command after the above one: 我不得不在上面的命令之后手动运行以下命令:

 rails generate refinery:cms --fresh-installation

Looks like the rails4 branch has been getting a bit of love over the past few days: 看起来rails4分支在过去的几天里得到了一些爱:

https://github.com/refinery/refinerycms/tree/rails4 https://github.com/refinery/refinerycms/tree/rails4

I will try it out and update with how I get on. 我会尝试一下并更新我的方式。

OK, let's try and answer this one. 好的,我们试着回答这个问题吧。 This is the route I went down. 这是我走的路。

First, I installed the refinerycms gem. 首先,我安装了refinerycms gem。

gem install refinerycms

I then did a: 然后我做了一个:

rbenv rehash

Then I followed the guide: 然后我按照指南:

refinerycms rickrockstar

Bundler complained: Bundler抱怨道:

Bundler could not find compatible versions for gem "refinerycms-core":
  In Gemfile:
    refinerycms (~> 3.0) ruby depends on
      refinerycms-images (= 3.0.0) ruby depends on
        refinerycms-core (= 3.0.0) ruby

refinerycms (~> 3.0) ruby depends on
  refinerycms-images (= 3.0.0) ruby depends on
    refinerycms-core (= 3.0.0) ruby

refinerycms (~> 3.0) ruby depends on
  refinerycms-images (= 3.0.0) ruby depends on
    refinerycms-core (= 3.0.0) ruby

refinerycms (~> 3.0) ruby depends on
  refinerycms-images (= 3.0.0) ruby depends on
    refinerycms-core (= 3.0.0) ruby

refinerycms-wymeditor (>= 1.0.6, ~> 1.0) ruby depends on
  refinerycms-core (>= 3.0.0, ~> 3.0) ruby

refinerycms-acts-as-indexed (>= 1.0.0, ~> 1.0) ruby depends on
  refinerycms-core (~> 2.1.0) ruby

In my gemfile, I changed the following lines: gem 'rails', '4.2.4' 在我的gemfile中,我更改了以下行:gem'trail','4.2.4'

gem 'refinerycms'
gem 'refinerycms-acts-as-indexed'
gem 'refinerycms-wymeditor'

And this solved the issue. 这解决了这个问题。

I had to then do a: 我不得不做一个:

bundle install

Then a: 那么一个:

rails generate refinery:cms --fresh-installation

I posted an issue on github and got the following answer from the RefineryTeam: 我在github上发布了一个问题,并从RefineryTeam得到了以下答案:

 It looks like the culprit was refinerycms-acts-as-indexed version - it should be ~> 2.0.1 to work with Refinery 3.0.0

https://github.com/refinery/refinerycms/issues/3072 https://github.com/refinery/refinerycms/issues/3072

Please also see this page where things might be running more smoothly than following the guide on Refinery's website. 另请参阅此页面 ,其中的内容可能比遵循Refinery网站上的指南更顺利。 What is to be seen there is similar to Zuhaib Ali's answer above (in a bit more details). 可以看到的是类似于上面的Zuhaib Ali的回答(稍微详细一点)。

Hope this helps 希望这可以帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM