Ruby - JackieWSC/Onepiece GitHub Wiki

Ruby

Installation on mac

  • Install xCode on App Store
  • Open the terminal and do the license agreement
    • sudo xcodebuild -license
  • Install the Homebrew (https://brew.sh/)
    • copy the follow command to terminal
    • /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Install Ruby
    • Install RVM first
      • \curl -L https://get.rvm.io | bash -s stable
    • Start using RVM
    • source /Users/Scity/.rvm/scripts/rvm
    • Verify the RVM is installed
      • rvm | head -n 1
    • Install ruby
      • rvm use ruby --install --default
    • Install rails
      • gem install rails --no-ri --no-rdoc
    • Check the rails version
      • rails --version

Installation on Raspberry Pi 3

  • update the package index
    • sudo apt-get update
  • retrieve the SSL package, SQL database package```
    • sudo apt-get install -y git curl zlib1g-dev subversion
    • sudo apt-get install -y openssl libreadline6-dev git-core zlib1g libssl-dev
    • sudo apt-get install -y libyaml-dev libsqlite3-dev sqlite3
    • sudo apt-get install -y libxml2-dev libxslt-dev
    • sudo apt-get install -y autoconf automake libtool bison
  • Create gpg key first
  • Install RVM
    • curl -L get.rvm.io | bash -s stable --rails or
    • command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
  • Run RVM
    • source~/.rvm/scripts/rvm
  • Test the Installations
    • ruby -v
    • rails -v

Create New Rails application

  • rails new test_app or
  • rails new myapp --database=postgresql
  • cd test_app
  • bundle exec rails server

An error occurred while installing pg

  • Install postgresql first
  • brew install postgresql
  • gem install pg

Reference