RoR: App Structure and Running the App

Pretty simple and straight forward to create a new app

chetans-mbp-2:~ cgiridhar$ rails new blog

      create 

      create  README.rdoc

      create  Rakefile

      create  config.ru

      create  .gitignore

      create  Gemfile

      create  app     

      create  app/assets/javascripts/application.js

      create  app/assets/stylesheets/application.css

      create  app/controllers/application_controller.rb

      create  app/helpers/application_helper.rb

      create  app/views/layouts/application.html.erb

      create  app/assets/images/.keep

      create  app/mailers/.keep

      create  app/models/.keep

      create  app/controllers/concerns/.keep

      create  app/models/concerns/.keep

      create  bin

      create  bin/bundle

      create  bin/rails

      create  bin/rake

      create  bin/setup

      create  config     

      create  config/routes.rb

      create  config/application.rb

      create  config/environment.rb

      create  config/secrets.yml

      create  config/environments

      create  config/environments/development.rb

      create  config/environments/production.rb

      create  config/environments/test.rb

      create  config/initializers

      create  config/initializers/assets.rb

      create  config/initializers/backtrace_silencers.rb

      create  config/initializers/cookies_serializer.rb

      create  config/initializers/filter_parameter_logging.rb

      create  config/initializers/inflections.rb

      create  config/initializers/mime_types.rb

      create  config/initializers/session_store.rb

      create  config/initializers/wrap_parameters.rb

      create  config/locales

      create  config/locales/en.yml

      create  config/boot.rb

      create  config/database.yml

      create  db      

      create  db/seeds.rb

      create  lib

      create  lib/tasks

      create  lib/tasks/.keep

      create  lib/assets

      create  lib/assets/.keep

      create  log     

      create  log/.keep

      create  public     

      create  public/404.html

      create  public/422.html

      create  public/500.html

      create  public/favicon.ico

      create  public/robots.txt

      create  test/fixtures     

      create  test/fixtures/.keep

      create  test/controllers

      create  test/controllers/.keep

      create  test/mailers

      create  test/mailers/.keep

      create  test/models

      create  test/models/.keep

      create  test/helpers

      create  test/helpers/.keep

      create  test/integration

      create  test/integration/.keep

      create  test/test_helper.rb

      create  tmp/cache

      create  tmp/cache/assets

      create  vendor/assets/javascripts

      create  vendor/assets/javascripts/.keep

      create  vendor/assets/stylesheets

      create  vendor/assets/stylesheets/.keep

         run  bundle install     

.

.

.

Bundle complete! 12 Gemfile dependencies, 54 gems now installed.

chetans-mbp-2:blog cgiridhar$ rails server

Warning: You’re using Rubygems 2.0.14 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine –all` for better startup performance.

=> Booting WEBrick

=> Rails 4.2.0 application starting in development on http://localhost:3000

=> Run `rails server -h` for more startup options

=> Ctrl-C to shutdown server

[2015-04-25 17:16:52] INFO  WEBrick 1.3.1

[2015-04-25 17:16:52] INFO  ruby 2.0.0 (2014-05-08) [universal.x86_64-darwin13]

[2015-04-25 17:16:52] WARN  TCPServer Error: Can’t assign requested address – bind(2)

[2015-04-25 17:16:52] INFO  WEBrick::HTTPServer#start: pid=87317 port=3000

Advertisements

RoR: Installation

Component Required to be Installed

  1. Ruby
  2. Rails Gem
  3. Database Server (Default installed SQLite)

Installation Instructions on Mac

Make sure you have appropriate Xcode version  and Xcode command Line Tools  and brew  installed

Chetans-MacBook-Pro-2:~ cgiridhar$ brew install ruby

==> Installing dependencies for ruby: readline, libyaml

==> Installing ruby dependency: readline

==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/readline-6.3.6.mavericks.bottle.tar.gz

######################################################################## 100.0%

==> Pouring readline-6.3.6.mavericks.bottle.tar.gz

==> Caveats

This formula is keg-only, which means it was not symlinked into /usr/local.

Mac OS X provides similar software, and installing this software in

parallel can cause all kinds of trouble.

OS X provides the BSD libedit library, which shadows libreadline.

er to prevent conflicts when programs look for libreadline we are

ting this GNU Readline installation to keg-only.

Generally there are no consequences of this for you. If you build your

own software and it requires this formula, you’ll need to add to your

build variables:

    LDFLAGS:  -L/usr/local/opt/readline/lib

    CPPFLAGS: -I/usr/local/opt/readline/include

==> Summary

🍺  /usr/local/Cellar/readline/6.3.6: 40 files, 2.1M

==> Installing ruby dependency: libyaml

==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/libyaml-0.1.6.mavericks.bottle.tar.gz

######################################################################## 100.0%

==> Pouring libyaml-0.1.6.mavericks.bottle.tar.gz

🍺  /usr/local/Cellar/libyaml/0.1.6: 7 files, 348K

==> Installing ruby

==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/ruby-2.1.2_3.mavericks.bottle.2.tar.gz

######################################################################## 100.0%

==> Pouring ruby-2.1.2_3.mavericks.bottle.2.tar.gz

🍺  /usr/local/Cellar/ruby/2.1.2_3: 942 files, 20M

Chetans-MacBook-Pro-2:~ cgiridhar$ brew install rbenv ruby-build

==> Downloading https://github.com/sstephenson/rbenv/archive/v0.4.0.tar.gz

######################################################################## 100.0%

==> Caveats

To use Homebrew’s directories rather than ~/.rbenv add to your profile:

  export RBENV_ROOT=/usr/local/var/rbenv

To enable shims and autocompletion add to your profile:

  if which rbenv > /dev/null; then eval “$(rbenv init -)”; fi

==> Summary

🍺  /usr/local/Cellar/rbenv/0.4.0: 31 files, 152K, built in 7 seconds

==> Installing ruby-build dependency: openssl

==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2a-1.mavericks.bottle.tar.gz

######################################################################## 100.0%

==> Pouring openssl-1.0.2a-1.mavericks.bottle.tar.gz

==> Caveats

A CA file has been bootstrapped using certificates from the system

keychain. To add additional certificates, place .pem files in

  /usr/local/etc/openssl/certs

and run

  /usr/local/opt/openssl/bin/c_rehash

This formula is keg-only, which means it was not symlinked into /usr/local.

Mac OS X already provides this software and installing another version in

parallel can cause all kinds of trouble.

Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries

Generally there are no consequences of this for you. If you build your

own software and it requires this formula, you’ll need to add to your

build variables:

    LDFLAGS:  -L/usr/local/opt/openssl/lib

    CPPFLAGS: -I/usr/local/opt/openssl/include

==> Summary

🍺  /usr/local/Cellar/openssl/1.0.2a-1: 463 files, 18M

==> Installing ruby-build

==> Downloading https://github.com/sstephenson/ruby-build/archive/v20150413.tar.gz

######################################################################## 100.0%

==> ./install.sh

🍺  /usr/local/Cellar/ruby-build/20150413: 157 files, 668K, built in 6 seconds

chetans-mbp-2:~ cgiridhar$ sudo gem install rails -v 4.2.0

Building native extensions.  This could take a while…

Successfully installed nokogiri-1.6.6.2

Fetching: loofah-2.0.1.gem (100%)

Successfully installed loofah-2.0.1

Fetching: rails-html-sanitizer-1.0.2.gem (100%)

Successfully installed rails-html-sanitizer-1.0.2

Fetching: rails-deprecated_sanitizer-1.0.3.gem (100%)

Successfully installed rails-deprecated_sanitizer-1.0.3

Fetching: rails-dom-testing-1.0.6.gem (100%)

Successfully installed rails-dom-testing-1.0.6

Fetching: erubis-2.7.0.gem (100%)

Successfully installed erubis-2.7.0

Fetching: actionview-4.2.0.gem (100%)

Successfully installed actionview-4.2.0

Fetching: actionpack-4.2.0.gem (100%)

Successfully installed actionpack-4.2.0

Fetching: activemodel-4.2.0.gem (100%)

Successfully installed activemodel-4.2.0

Fetching: arel-6.0.0.gem (100%)

Successfully installed arel-6.0.0

Fetching: activerecord-4.2.0.gem (100%)

Successfully installed activerecord-4.2.0

Fetching: globalid-0.3.5.gem (100%)

Successfully installed globalid-0.3.5

Fetching: activejob-4.2.0.gem (100%)

Successfully installed activejob-4.2.0

Fetching: mime-types-2.5.gem (100%)

Successfully installed mime-types-2.5

Fetching: mail-2.6.3.gem (100%)

Successfully installed mail-2.6.3

Fetching: actionmailer-4.2.0.gem (100%)

Successfully installed actionmailer-4.2.0

Fetching: thor-0.19.1.gem (100%)Fetching: thor-0.19.1.gem

Successfully installed thor-0.19.1

Fetching: railties-4.2.0.gem (100%)

railties’s executable “rails” conflicts with /usr/bin/rails

Overwrite the executable? [yN]  y

Successfully installed railties-4.2.0

Fetching: bundler-1.9.4.gem (100%)

Successfully installed bundler-1.9.4

Fetching: sprockets-3.0.2.gem (100%)

Successfully installed sprockets-3.0.2

Fetching: sprockets-rails-2.2.4.gem (100%)

Successfully installed sprockets-rails-2.2.4

Fetching: rails-4.2.0.gem (100%)

Successfully installed rails-4.2.0

Parsing documentation for nokogiri-1.6.6.2

unable to convert “\xCA” from ASCII-8BIT to UTF-8 for lib/nokogiri/nokogiri.bundle, skipping

Installing ri documentation for nokogiri-1.6.6.2

Parsing documentation for loofah-2.0.1

Installing ri documentation for loofah-2.0.1

Parsing documentation for rails-html-sanitizer-1.0.2

Installing ri documentation for rails-html-sanitizer-1.0.2

Parsing documentation for rails-deprecated_sanitizer-1.0.3

Installing ri documentation for rails-deprecated_sanitizer-1.0.3

Parsing documentation for rails-dom-testing-1.0.6

Installing ri documentation for rails-dom-testing-1.0.6

Parsing documentation for erubis-2.7.0

Installing ri documentation for erubis-2.7.0

Parsing documentation for actionview-4.2.0

Installing ri documentation for actionview-4.2.0

Parsing documentation for actionpack-4.2.0

Installing ri documentation for actionpack-4.2.0

Parsing documentation for activemodel-4.2.0

Installing ri documentation for activemodel-4.2.0

Parsing documentation for arel-6.0.0

Installing ri documentation for arel-6.0.0

Parsing documentation for activerecord-4.2.0

Installing ri documentation for activerecord-4.2.0

Parsing documentation for globalid-0.3.5

Installing ri documentation for globalid-0.3.5

Parsing documentation for activejob-4.2.0

Installing ri documentation for activejob-4.2.0

Parsing documentation for mime-types-2.5

Installing ri documentation for mime-types-2.5

Parsing documentation for mail-2.6.3

Installing ri documentation for mail-2.6.3

Parsing documentation for actionmailer-4.2.0

Installing ri documentation for actionmailer-4.2.0

Parsing documentation for thor-0.19.1

Installing ri documentation for thor-0.19.1

Parsing documentation for railties-4.2.0

Installing ri documentation for railties-4.2.0

Parsing documentation for bundler-1.9.4

Installing ri documentation for bundler-1.9.4

Parsing documentation for sprockets-3.0.2

Installing ri documentation for sprockets-3.0.2

Parsing documentation for sprockets-rails-2.2.4

Installing ri documentation for sprockets-rails-2.2.4

Parsing documentation for rails-4.2.0

Installing ri documentation for rails-4.2.0

22 gems installed