Practical Web Programming

Wednesday, June 18, 2014

Better Way to Generate Rails Application

Generate project with RMV.

$ mkdir myapp                                                           # create the project folder
$ cd myapp
$ rvm use ruby-2.1.1@myapp --ruby-version --create     # create a new project-specific gemset
                                                                                 # option “—ruby-version” creates .ruby-version and .ruby-gemset files in the root directory
$ gem install rails --pre                                                # installs the most recent release of Rails 
$ rails new .                                                               # generate application in the current directory.

If you have no RVM in your system, follow command below.  

$ \curl -L | bash -s stable --ruby        # install rvm and ruby

$ rvm get stable --autolibs=enable                              # if you have rvm already, update it
$ rvm install ruby                                                      # install Ruby

$ rvm --default use ruby-2.1.1                                    # use and set it as default

$ gem update --system                                             # update gem

Backup/Restore MySQL Database

Backup mysql database to a sql file.

$ mysqldump -u root -p[root_password] [database_name] > filename.sql

Restore from sql file to database.

$ mysql -u root -p[root_password] [database_name] < filename.sql

Recent Post