LoginSignup
0
0

More than 5 years have passed since last update.

Railsプロジェクトの作成の仕方とコマンド

Last updated at Posted at 2019-01-11

Gemfileを生成してvendor/bundle以下にRailsをインストールする
 システムのgemはできるだけクリーンに保ちたい為、gemはvendor/bundleに入れてbundle execで呼び出すようにする。

自分用のメモ

手順

1. ディレクトリを作成する

コマンド

$ mkdir ディレクトリ名
$ cd ディレクトリ名
$ bundle init
Writing new Gemfile to /path/to/project_name/Gemfil

2.生成されたGemfileを編集する

最後の欄に#gem "rails"と書かれているが、この「#」を消して、gem "rails"にする
編集する時はテキストエディターでする

編集後のGemfile内

# frozen_string_literal: true
source "https://rubygems.org"

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

gem "rails"  

3.Railsをインストールする

コマンド

$ bundle install --path vendor/bundle

4.Railsプロジェクトを生成する

コマンド

$ bundle exec rails new .

※railsコマンドの実行は頭に bundle exec をつける

 

0
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
0
0