Chapter 1 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
lib/
library modules
26
lib/assets
library assets such as CSS, JavaScript files, and images
27
log/
app log files
28
public/
data accessible to the public (e.g., via web browsers), such as error pages
29
bin/rails
a program for generating code, opening console sessions, or starting a local server
30
test/
app tests
31
tmp/
temporary files
32
vendor/
third-party code such as plugins and gems
33
vendor/assets
third-party assets such as CSS, JavaScript files, and images
34
README.rdoc
a brief description of the application
35
rakefile
Utility tasks available via the rake command
36
Gemfile
Gem requirements for this app
37
Gemfile.lock
a list of gems used to ensure that all copies of the app use the same gem versions
38
config.ru
a configuration file for Rack middleware
39
.gitignore
patterns for files that should be ignored by Git
40
gem 'sqlite3'
install latest version of gem
41
gem 'uglifier', '>= 1.3.0'
ugligier(handles file compression for the asset pipeline) installs as long as its greater than or equal to version 1.3.0
42
gem 'coffee-rails', '~> 4.0.0'
installs gem as long as its newer than 4.0.0 and not newer than 4.1 (minor point releases)
43
bundle install
install and include the gems needed by the app
44
command for running rails on local system
rails server
45
rails follows what architectural pattern?
model-view-controller (MVC) pattern
46
MVC
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
basic interaction with rails app: (long answer)
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
what is version control?
allow us to track changes to our projects code, collaborate more easily, and roll back any errors such as deleting files
49
what is git?
distributed version control
50
you can have multiple controllers for an application(t/f)
true. we will create some in chapter 2 =)
51
explain: def hello render text: "hello" end
define a function which uses the render function to return the text
52
rails router?
sits in front of the controller and determines where to send requests that come in from the browser
53
root route?
determines the page that is served on the root URL
54
root 'application#hello'
setting the root route: application is the controller name and hello is the action within that controller
55
git system setup
$ git config --global user.name "Your Name" | $ git config --global user.email your.email@example.com
56
git initialize a repository
$ git init
57
add all project files to the repository
$ git add -A (adds all files in the current directory apart from .gitignore.
58
where are git added files in the repository placed?
staging area which contains pending changes to your project
59
git status
see files in staging area
60
$ git commit -m "Initialize repository"
tell git to keep the changes from the staging area. -m flag lets you add a message for the commit
61
where are git commits stored?
locally. you have to push the changes up to a remote repository.
62
see list of commit messages:
$ git log
63
rm -rf app/controllers
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
process to get back deleted files in git
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
git checkout -f
undo changed and -f force overwriting the current changes
66
github
social coding site optimized for hosting and sharing git repositories. ability to work on open source projects
67
why put repositories on github
its a full backup of your code (including full history of commits), and it makes any future collaboration much easier.
68
SSH keys
ways to identify trusted computers without involving passwords.
69
what is version control?
system that records changes a file or set of files over time so that you can recall specific versions later.
70
ls -al ~/.ssh
lists the files in your .ssh directory
71
git remote add origin https://github.com/saweel/rails_intro.git
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
git push -u origin master
push your repository up to github (dont worry about -u)
73
branch:
effectively copies of a repository where we can make changes without modifying the parent files.
74
git checkout -b modify-README
creates new branch and switches to it
75
git branch
lists all the local branches and * tells you which branch your on
76
git commit -a -m "Improve the README file"
-a flag as shortcut for committing all modifications to existing files. commit changes to staging area
77
git checkout master | git merge modify-README
switch to branch 'master' | and merge branch together (still in staging area)
78
git branch -d modify-README
delete branch
79
``` # 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 ```
major screw up and need to abandon topic branch. -D will delete branch even though we havent merged in the changes
80
git push
push changes to github. we could have said git push origin master, but since we already done one push, we can omit it
81
heroku
hosted platform for deploying rails and other web applications using a cloud platform
82
heroku login
login onto heroku
83
heroku keys:add
add ssh keys
84
heroku create
create a place on heroku servers for the sample app to live. creates new subdomain.
85
git push heroku master
put master branch up to heroku