- 1. 概要
- 2. プロジェクト作成
- 3. 不足分のパッケージをインストール
- 4. root ユーザで作成
1. 概要
インストール後にはプロジェクトを作成するものらしい。
2. プロジェクト作成
参考サイトによれば、プロジェクトの作成は
rails new [project_name] -d mysql -B
で行うものらしい。
プロジェクト名は、省略できるらしい。
どうも、データベースが必要らしいのでインストールします。
「Ruby on RailsのデータベースをPostgreSQLに設定する。 - Qiita」を読むと postgreSQL でも可能なようなので、postgreSQL をインストールします。
「postgreSQL」のインストールに関しては、「FreeBSD」のいずれかのバージョンの「データベース postgreSQL」の章でどうぞ。
以前のバージョンもそれぞれのページにあります。
上記では、「postgreSQL 9.6」をインストールしています。
(「10.0」は、まだ対応できていないアプリケーションがあります)
てことでここでは
$ rails new project -d postgresql
create
create README.md
create Rakefile
create .ruby-version
・・・ 略 ・・・
run bundle 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.1
Using concurrent-ruby 1.0.5
・・・ 略 ・・・
Using activestorage 5.2.1
Fetching public_suffix 3.0.3
Errno::EACCES: Permission denied @ rb_file_s_rename - (/home/hogehoge/.gem/ruby/2.4/cache/public_suffix-3.0.3.gem,
/usr/local/lib/ruby/gems/2.4/cache/public_suffix-3.0.3.gem)
An error occurred while installing public_suffix (3.0.3), and Bundler cannot continue.
Make sure that `gem install public_suffix -v '3.0.3' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
capybara was resolved to 3.10.0, which depends on
addressable was resolved to 2.5.2, which depends on
public_suffix
run bundle exec spring binstub --all
bundler: command not found: spring
Install missing gem executables with `bundle install`
実際には標準出力にはもっとカラフルに表示されます。
「project」という名前にしたらカレントディレクトリに、こんな感じでディレクトリが作成されました
$ tree -d
.
`-- project
|-- app
| |-- assets
| | |-- config
| | |-- images
| | |-- javascripts
| | | `-- channels
| | `-- stylesheets
| |-- channels
| | `-- application_cable
| |-- controllers
| | `-- concerns
| |-- helpers
| |-- jobs
| |-- mailers
| |-- models
| | `-- concerns
| `-- views
| `-- layouts
|-- bin
|-- config
| |-- environments
| |-- initializers
| `-- locales
|-- db
|-- lib
| |-- assets
| `-- tasks
|-- log
|-- public
|-- storage
|-- test
| |-- controllers
| |-- fixtures
| | `-- files
| |-- helpers
| |-- integration
| |-- mailers
| |-- models
| `-- system
|-- tmp
| |-- cache
| | `-- assets
| `-- storage
`-- vendor
45 directories
3. 不足分のパッケージをインストール
前項は、大きなエラーが2つあって、不足しているパッケージがあることが分かりましたので、「project」以下を削除して、不足分のパッケージをインストールします。
一般ユーザでやったためにエラーになったのかどうか・・・。
しかし、コンテンツは一般ユーザで作りたいな・・・。
ともあれ、不足分のパッケージをインストール。
$ gem install public_suffix -v '3.0.3'
Fetching: public_suffix-3.0.3.gem (100%)
Successfully installed public_suffix-3.0.3
Parsing documentation for public_suffix-3.0.3
Installing ri documentation for public_suffix-3.0.3
Done installing documentation for public_suffix after 1 seconds
1 gem installed
> gem install bundler
Successfully installed bundler-1.17.1
Parsing documentation for bundler-1.17.1
Done installing documentation for bundler after 12 seconds
1 gem installed
では、再チャレンジ
$ rails new project -d postgresql
create
create README.md
create Rakefile
・・・ 略 ・・・
create tmp/storage
create tmp/storage/.keep
remove config/initializers/cors.rb
remove config/initializers/new_framework_defaults_5_2.rb
run bundle 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.1
Using concurrent-ruby 1.0.5
・・・ 略 ・・・
Using activestorage 5.2.1
Using public_suffix 3.0.3
Fetching addressable 2.5.2
Errno::EACCES: Permission denied @ rb_file_s_rename - (/home/hogehoge/.gem/ruby/2.4/cache/addressable-2.5.2.gem,
/usr/local/lib/ruby/gems/2.4/cache/addressable-2.5.2.gem)
An error occurred while installing addressable (2.5.2), and Bundler cannot continue.
Make sure that `gem install addressable -v '2.5.2' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
capybara was resolved to 3.10.0, which depends on
addressable
run bundle exec spring binstub --all
bundler: command not found: spring
Install missing gem executables with `bundle install`
とまぁ、またぞろエラーになる。
「Permission denied」言われるので、root ユーザ権限でやるしかないのかなぁ。
4. root ユーザで作成
しょうがないので root ユーザ権限でやってみます。
パーミッションは後でいじればいいか。
$ rails new project -d postgresql
create
create README.md
create Rakefile
・・・ 略 ・・・
create tmp/storage
create tmp/storage/.keep
remove config/initializers/cors.rb
remove config/initializers/new_framework_defaults_5_2.rb
run bundle install
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this
application for all non-root users on this machine.
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.1
Using concurrent-ruby 1.0.5
・・・ 略 ・・・
Installing uglifier 4.1.19
Fetching web-console 3.7.0
Installing web-console 3.7.0
Bundle complete! 16 Gemfile dependencies, 76 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Post-install message from sass:
Ruby Sass is deprecated and will be unmaintained as of 26 March 2019.
* If you use Sass as a command-line tool, we recommend using Dart Sass, the new
primary implementation: https://sass-lang.com/install
* If you use Sass as a plug-in for a Ruby web framework, we recommend using the
sassc gem: https://github.com/sass/sassc-ruby#readme
* For more details, please refer to the Sass blog:
http://sass.logdown.com/posts/7081811
run bundle exec spring binstub --all
* bin/rake: spring inserted
* bin/rails: spring inserted
なんだか途中の「Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine.」とか「run bundle exec spring binstub --all」とかっちゅうのが気になりますが。
Linux や Windows を想定しているからなんでしょうね。
とりあえず、プロジェクトの作成は、成功したように思えます。
|