LoginSignup
0
0

More than 5 years have passed since last update.

Rails新規PJ環境構築手順書

Last updated at Posted at 2016-11-08

今回やった手順の書き留め。

手順

  1. 住所きめる

    $ mkdir pj
    $ cd pj
    

    以降、毎回確認を怠らないこと!

  2. gitの設定

    $ git init
    $ git remote add origin https://pj_name〜〜〜.git
    
  3. Homebrew

    入ってなかったら入れる
    すごくすごくわかりやすい記事があるので参考に!
    パッケージ管理システム Homebrew

    入ってる場合もdoctorは必須。必要ならupdate(ただし要注意)。

    $ brew doctor
    $ brew update
    
  4. Rubyの設定

    rbenvを使います!
    詳しくはここで!

    $ ruby -v
    => 使いたいバージョンになったらOK!
    $ # 確認しましょう!
    
  5. Railsの設定

    $ bundle init
    $ gem install --no-ri --no-rdoc rails
    $ rails -v
    => 使いたいバージョンになったらOK!
    $ gem install bundler
    $ # ここでも確認を!
    
  6. ライブラリのインストール

    まずGemfileを修正

    source 'https://rubygems.org'
     
    gem 'rails', '4.1.6' #コメントアウトを外して、バージョンを指定する
    

    Gemfileにそってbundle install

    --pathを指定することで、install先を指定することが可能(vendor/bundleを設定する)
    一度実行すると、.bundle/configBUNDLE_PATHとして記録されるので次回以降設定不要!

    $ bundle install --path vendor/bundle
    => Fetching gem metadata from https://rubygems.org/...........
    ...(中略)...
    Installing rails 4.1.6
    Your bundle is complete!
    It was installed into ./vendor/bundle
    

    Railsはすでにインストールしてたので、Gemfileの設定はいらなかったかな・・・???

  7. Railsアプリケーション作成

    $ bundle exec rails new . -T -d mysql --skip--bundle
    

    オプションはお好みで

  8. いよいよpushします

    あげるまえに!

    • .git/config の設定は大丈夫??
    • .gitignore の設定は大丈夫?
      • /vendor/bundle の追加を忘れないように
    参考

    Gitをインストールしたら真っ先にやっておくべき初期設定
    .gitignoreの設定手本

    失敗すると戻せません(ToT;)・・・何度も失敗してるのでちゃんと確認すること!

    $ git commit
    $ git push origin master
    

参考

http://kozo002.blogspot.jp/2012/01/rubybundler.html
http://qiita.com/shinyashikis@github/items/3501c5f7f71a8e345c3d
http://qiita.com/emadurandal/items/a60886152a4c99ce1017

bundleやらgemやらはわかりやすい記事がたくさんありますね!勉強勉強!

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