LoginSignup
1
0

More than 3 years have passed since last update.

【Mac】RefineryCMS導入〜 初期画面の表示まで

Last updated at Posted at 2019-09-12

この記事でできること

  • RefineryCMSのrailsアプリケーションを生成して、初期画面表示まで
  • ただし、途中不要な手順があるかも

参考サイト

関連アプリケーションののバージョン等

Ruby 2.6.3

  • Rubyはversion 2.2.2以上
  • rbenvでのインストール推奨なので、rbenvでインストールしましょう
  • すでにrbenvでインストールされているので、インストール方法は省略
  • 自分の環境のバージョンは下記の通り
$ ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]

Rubygems

  • rbenvでRubyをインストールしていれば不要 なので省略

Database Postgresql 11.5

  • postgresqlをインストール済みなので、省略
  • 自分の環境のバージョンは下記の通り
$ psql --version
psql (PostgreSQL) 11.5

ImageMagick

  • Homebrewでインストールした(インストーラーもあるみたい)
$ brew install imagemagick

Refineryのインストール

  • 普通にgemのインストール
$ gem install refinerycms
Fetching xxxxxxxxxxxxxxx
 :
xx gems installed
  • バージョンを確認すると、4.0.3でした
$ gem list refinerycms

*** LOCAL GEMS ***

refinerycms (4.0.3)
refinerycms-core (4.0.3)
refinerycms-dragonfly (1.0.1)
refinerycms-i18n (4.0.2)
refinerycms-images (4.0.3)
refinerycms-pages (4.0.3)
refinerycms-resources (4.0.3)

Rails 6.0.0→5.1.6.1→5.1.7

  • 現時点での最新 ってことで6.0.0
  • と思って作業進めてたけど、
    6.0.0だとgemの依存関係でエラーになるので、
    5.1.6.1 をダウンロードし、rails newする際に5.1.6.1を指定した
  • と思ったけど、railsプロジェクト生成コマンドをrails new ・・・じゃなくて、
    refinerycms ・・・で実行したら、勝手に最適なrailsバージョン(5.1.7)で生成されたっぽい

bundler 1.17.3

  • 現時点の最新は2.0.2だったが、2.0.2だと問題有りだったので、
    1.17.3にした

Rails Refinery アプリケーション生成

【不要】Rails New実行 →gemのバージョンの依存関係でエラー

  • データベースはpostgresqlを指定
  • エラーになった。
    rails6.0.0ではactionmailer6.0.0を使え
    refinerycms-authentication-devise2.0ではactionmailer5.0.0〜5.2.0を使え
    って言ってるのかな?
$ rails new lcms -m https://www.refinerycms.com/t/4.0.3 -d postgresql

      create  
      create  README.md

  :

Bundler could not find compatible versions for gem "actionmailer":
  In Gemfile:
    rails (~> 6.0.0) was resolved to 6.0.0, which depends on
      actionmailer (= 6.0.0)

    refinerycms-authentication-devise (~> 2.0) was resolved to 2.0.0, which depends on
      actionmailer (>= 5.0.0, < 5.2)
         run  bundle binstubs bundler
Could not find gem 'refinerycms-acts-as-indexed (>= 3.0.0, ~> 3.0)' in any of the gem sources listed in your Gemfile.
         run  bundle exec spring binstub --all
Could not find gem 'refinerycms-acts-as-indexed (>= 3.0.0, ~> 3.0)' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems.
       rails  webpacker:install
Could not find gem 'refinerycms-acts-as-indexed (>= 3.0.0, ~> 3.0)' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems.

【不要かも】参考サイトに合わせて、rails5.1.6.1をインストール

  • gemインストール実行と、railsバージョンの一覧確認
$ gem i -v 5.1.6.1 rails
Fetching activesupport-5.1.6.1.gem
Fetching actionview-5.1.6.1.gem
  :
activerecord, rails after 9 seconds
11 gems installed

$ gem list rails        

*** LOCAL GEMS ***

coffee-rails (4.2.2)
haml-rails (2.0.1)
jquery-rails (4.3.5)
jquery-ui-rails (5.0.5)
rails (6.0.0, 5.1.6.1)
rails-dom-testing (2.0.3)
rails-html-sanitizer (1.2.0)
rails-i18n (5.0.4)
sass-rails (5.1.0, 5.0.7)
speakingurl-rails (8.0.2)
sprockets-rails (3.2.1)

【不要】rails 5.1.6.1を指定して、rails new 実行

  • dbはpostgresql
  • 別のエラーが出た
ails _5.1.6.1_ new lcms -m https://www.refinerycms.com/t/4.0.3 -d postgresql
      create  
      create  README.md

  :

Bundle complete! 20 Gemfile dependencies, 116 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
        rake    db:create
You must use Bundler 2 or greater with this lockfile.
    generate    refinery:cms --fresh-installation new lcms -m https://www.refinerycms.com/t/4.0.3 -d postgresql
You must use Bundler 2 or greater with this lockfile.
    ============================================================================
    Your new Refinery CMS application is now installed and mounts at '/'
  ============================================================================
         run  bundle install
You must use Bundler 2 or greater with this lockfile.
         run  bundle exec spring binstub --all
You must use Bundler 2 or greater with this lockfile.

エラー「You must use Bundler 2 or greater with this lockfile.」

bundler -v
Bundler version 2.0.2

bundler のバージョンダウン

  • インストール可能なバージョンの確認 →1.17.3にバージョンダウンしよう
$ gem search ^bundler$ --all            

*** REMOTE GEMS ***

bundler (2.0.2, 2.0.1, 2.0.0, 1.17.3, 1.17.2, 1.17.1, 1.17.0, 
 :
  • 以降の処理はrailsプロジェクトフォルダの一つ上の階層で実施する
  • Gemfile.lock ファイルを削除(わたくしの環境では/Users/ユーザー名/Gemfile.lock)
  • bundler 1.17.3をインストール
$ gem install bundler -v 1.17.3
Fetching bundler-1.17.3.gem
Successfully installed bundler-1.17.3
Parsing documentation for bundler-1.17.3
Installing ri documentation for bundler-1.17.3
Done installing documentation for bundler after 2 seconds
1 gem installed
$ bundler _1.17.3_ install  
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies.....
Using rake 12.3.3
 :

Bundle complete! 20 Gemfile dependencies, 116 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
  • Gemfile.lockファイルが新たに生成されていることを確認
    ファイルの一番下の行に BUNDLED WITH 1.17.3 と記載されているはず

railsプロジェクト生成のやり直し

  • さっき実行した際はbundlerのバージョンのエラーで、何個かコマンド実行でエラーが発生してたので、
    新たにやり直す
  • 必要があれば、さっき作成したRailsプロジェクトフォルダを削除しておく
  • さっきは参考サイトの通りrails new ・・・を実行したけど、
    公式サイトに載ってるやり方でやってみた → 最後までエラー無く、正常に実行された
$ refinerycms lcms  → "lcms"は任意のrailsプロジェクト名
      create  
      create  README.md
      create  Rakefile

  :

Bundle complete! 20 Gemfile dependencies, 117 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
         run  bundle exec spring binstub --all
* bin/rake: Spring inserted
* bin/rails: Spring inserted
  • railsのバージョンを確認すると、5.1.7だった
    勝手に最適なバージョンにしてくれるっぽいな
$ rails -v
Rails 5.1.7

refinery初期画面起動まで

railsサーバー起動

$ rails s
=> Booting Puma
  :

http://localhost:3000/ にアクセス

  • よくわらないけど、こんな画面が表示された とりあえず放っておこう image.png

http://localhost:3000/refinery にアクセス

  • http://localhost:3000/refinery/ にアクセスすると、
    初期ユーザーの登録画面が表示される
  • 名前やメールアドレス等を入力後、sign up をクリックしてアカウント作成する
  • アカウント作成後、管理画面に遷移する
  • 画面イメージは日本語化した後の画面 (日本語化は参考サイト参照)
    デフォルトでは英語で表示される image.png

管理画面

ひとまずここまで!

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0