Chapter 1 Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is rails?

A

web development framework written in the ruby programming language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

installing rails with a specific version number

A

$ gem install rails -v 4.2.2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

-v flag

A

ensures the specified version gets installed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

shell command:
change to home directory
make a workspace directory
then change into it

A

$ cd # Change to the home directory.
$ mkdir workspace # Make a workspace directory.
$ cd workspace/ # Change into the workspace directory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what is bash

A

shell comman line interface

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

shell: list contents

A

ls: $ls -l

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

make directory shell

A

mkdir : $ mkdir workspace

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

shell:change directory

A

cd : $ cd workspace/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

shell cd one directory up

A

$ cd..

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

shell cd to home directory

A

$ cd ~ or just $ cd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

cd to path including home directory

A

$cd ~/workspace/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

move file(rename) shell

A

mv : $mv README.rdoc README.md

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

copy file in shell

A

cd : $ cp README.rdoc README.md

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

remove file

A

rm : $ rm README.rdoc

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

remove empty directory shell

A

rmdir : $ rmdir workspace/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

remove nonempty directory

A

rm -rf : $ rm -rf tmp/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

concatenate and display file contents

A

cat : $ cat ~/.ssh/id_rsa.pub

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

command to run rails at version 4.2.2

A

rails 4.2.2 new hello_app

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

app/

A

core application code, including models, views, controllers, and helpers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

app/assets

A

assets such as CSS, JavaScript files, and images

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

bin/

A

binary executable files

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

config

A

application configuration

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

db/

A

database files

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

doc/

A

documentation for the application

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

lib/

A

library modules

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

lib/assets

A

library assets such as CSS, JavaScript files, and images

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

log/

A

app log files

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

public/

A

data accessible to the public (e.g., via web browsers), such as error pages

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

bin/rails

A

a program for generating code, opening console sessions, or starting a local server

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

test/

A

app tests

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

tmp/

A

temporary files

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

vendor/

A

third-party code such as plugins and gems

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

vendor/assets

A

third-party assets such as CSS, JavaScript files, and images

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

README.rdoc

A

a brief description of the application

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

rakefile

A

Utility tasks available via the rake command

36
Q

Gemfile

A

Gem requirements for this app

37
Q

Gemfile.lock

A

a list of gems used to ensure that all copies of the app use the same gem versions

38
Q

config.ru

A

a configuration file for Rack middleware

39
Q

.gitignore

A

patterns for files that should be ignored by Git

40
Q

gem ‘sqlite3’

A

install latest version of gem

41
Q

gem ‘uglifier’, ‘>= 1.3.0’

A

ugligier(handles file compression for the asset pipeline) installs as long as its greater than or equal to version 1.3.0

42
Q

gem ‘coffee-rails’, ‘~> 4.0.0’

A

installs gem as long as its newer than 4.0.0 and not newer than 4.1 (minor point releases)

43
Q

bundle install

A

install and include the gems needed by the app

44
Q

command for running rails on local system

A

rails server

45
Q

rails follows what architectural pattern?

A

model-view-controller (MVC) pattern

46
Q

MVC

A

enforces a separaton between “domain” logic from the input and presentation logic associated with GUI.
Domain logic: data models like users, articles, and products.
GUI: web page in a web browser

47
Q

basic interaction with rails app: (long answer)

A

browser sends a request, received by a web server and passed on to a rails controller, which is in charge of what to do next. controller might render a view html. dynamic sites: the controller interacts with a model which is a ruby object that represents an element of the site(such as a user). and is in charge of communicating with the database. after invoking the model, the controller renders view and returns the web page to the browser as HTML

48
Q

what is version control?

A

allow us to track changes to our projects code, collaborate more easily, and roll back any errors such as deleting files

49
Q

what is git?

A

distributed version control

50
Q

you can have multiple controllers for an application(t/f)

A

true. we will create some in chapter 2 =)

51
Q

explain:
def hello
render text: “hello”
end

A

define a function which uses the render function to return the text

52
Q

rails router?

A

sits in front of the controller and determines where to send requests that come in from the browser

53
Q

root route?

A

determines the page that is served on the root URL

54
Q

root ‘application#hello’

A

setting the root route: application is the controller name and hello is the action within that controller

55
Q

git system setup

A

$ git config –global user.name “Your Name”

$ git config –global user.email your.email@example.com

56
Q

git initialize a repository

A

$ git init

57
Q

add all project files to the repository

A

$ git add -A (adds all files in the current directory apart from .gitignore.

58
Q

where are git added files in the repository placed?

A

staging area which contains pending changes to your project

59
Q

git status

A

see files in staging area

60
Q

$ git commit -m “Initialize repository”

A

tell git to keep the changes from the staging area. -m flag lets you add a message for the commit

61
Q

where are git commits stored?

A

locally. you have to push the changes up to a remote repository.

62
Q

see list of commit messages:

A

$ git log

63
Q

rm -rf app/controllers

A

rm to remove directory and rf flag means “recursive force” which recursively removes all files, diretories, subdirectories, and so on without asking explicit confirmation of each deletion

64
Q

process to get back deleted files in git

A

we deleted controller directory, but the changes are only on the ‘working tree’; they havent been commited yet (git status shows that). we can still undo the changes using checkout command with the -f flag to force overwriting the current changes

65
Q

git checkout -f

A

undo changed and -f force overwriting the current changes

66
Q

github

A

social coding site optimized for hosting and sharing git repositories. ability to work on open source projects

67
Q

why put repositories on github

A

its a full backup of your code (including full history of commits), and it makes any future collaboration much easier.

68
Q

SSH keys

A

ways to identify trusted computers without involving passwords.

69
Q

what is version control?

A

system that records changes a file or set of files over time so that you can recall specific versions later.

70
Q

ls -al ~/.ssh

A

lists the files in your .ssh directory

71
Q

git remote add origin https://github.com/saweel/rails_intro.git

A

tells git you want to add github as the origin for your master branch. rails_intro is the repository name on your github account

72
Q

git push -u origin master

A

push your repository up to github (dont worry about -u)

73
Q

branch:

A

effectively copies of a repository where we can make changes without modifying the parent files.

74
Q

git checkout -b modify-README

A

creates new branch and switches to it

75
Q

git branch

A

lists all the local branches and * tells you which branch your on

76
Q

git commit -a -m “Improve the README file”

A

-a flag as shortcut for committing all modifications to existing files. commit changes to staging area

77
Q

git checkout master

git merge modify-README

A

switch to branch ‘master’

and merge branch together (still in staging area)

78
Q

git branch -d modify-README

A

delete branch

79
Q
# For illustration only; don't do this unless you mess up a branch
$ git checkout -b topic-branch
$ 
$ git add -A
$ git commit -a -m "Major screw up"
$ git checkout master
$ git branch -D topic-branch
A

major screw up and need to abandon topic branch. -D will delete branch even though we havent merged in the changes

80
Q

git push

A

push changes to github. we could have said git push origin master, but since we already done one push, we can omit it

81
Q

heroku

A

hosted platform for deploying rails and other web applications using a cloud platform

82
Q

heroku login

A

login onto heroku

83
Q

heroku keys:add

A

add ssh keys

84
Q

heroku create

A

create a place on heroku servers for the sample app to live. creates new subdomain.

85
Q

git push heroku master

A

put master branch up to heroku