-
Notifications
You must be signed in to change notification settings - Fork 1
/
rornotes.txt
202 lines (159 loc) · 7.03 KB
/
rornotes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
$ ============================rails:============================505
$ rails new
$ rails new sample_app -T #without testing code
$ rails server #rails s
$ rails server --environment production
$ rails generate scaffold User name:string email:string
$ rails console # rails c ,quit,ctrl+c,ctrl+d
$ rails console --sandbox #no changes
$ rails console test
$ bundle install #set HTTP_PROXY=http://172.30.4.63:3128 #set proxy=http://172.30.4.63:3128
$ gem install rails # -p --http-proxy http://172.30.4.63:3128
$ gem install rails --version 3.0.6
$ gem install win32console
$ gem install annotate-model #add comments for models
$ rails generate controller Pages home contact
$ [sudo] gem install autotest -v 4.3.2
$ [sudo] gem install autotest-rails-pure -v 4.1.0
$ sudo gem install autotest-standalone
$ sudo gem install autotest-growl -p --http-proxy http://172.30.4.63:3128
$ sudo gem install webrat #need nokogiri
$ sudo apt-get install libxslt-dev libxml2-dev #nokogiri install error on 'libxml2 is missing'
$ tail -f log/development.log #show database log
$ gem install factory_girl_rails
$ gem install gravatar_image_tag
$ gem install faker -v 0.9.5
$ gem install will_paginate -v 3.0.pre2
$ ============================rake: ruby make============================
$ rake db:migrate
$ rake db:migrate RAILS_ENV=production
$ rake db:test:prepare
$ rake db:reset #clear database
$ rake db:populate # lib/tasks/sample_data.rake task :populate =>:environment
$ ============================git:============================
$ git config --global user.name "name"
$ git config --global user.email "mail"
$ git config --global http.proxy http://*.*.*.*:3128
$ git config --global alias.co checkout
$ git config --global co.editor "vim -f"
$ git config --global core.autocrlf false
$ git config --global github.user username #connected with https
$ git config --global github.token tokencode #https security code
$ git init #init repository for a new folder
$ git checkout -b modify-readme #new branch
$ git status
$ git branch
$ git branch -d some-branch / git branch -D modify-readme #delte branch,-d needs merged all changes ,-D not care about changes.
$ git merge modify-readme
$ git commit -m "message" #commit modified one file
$ git commit -a -m "message" #commit all changes ,not include new files ,with message
$ git commit -am "message" #short write
$ git add . #add all include new file
$ git mv README README.markdown #rename file
$ git log
$ git rm public/index.html #tell git that a file should be removed
$ git add . / git commit -am "massage" / git checkout master / git merge other-branch / git push # merge a branch
$ git checkout master / git checkout -b new-branch #make a new branch, and leave on new-branch
$ ============================github:============================
$ git remote add origin git@github.com:brookzhang/first_app.git
$ git push origin master
$ git push origin master:master
$ git push
$ git clone git@github.com:brookzhang/first_app.git #will create a new folder as /first_app
$ git clone https://brookzhang@github.com/brookzhang/first_app.git
$ git pull
$ git fetch
$ git push heroku master
$ git remote rm heroku
$ git remote add heroku git@heroku.com:brook.git
$ ============================rspec:============================
$ rails generate rspec:install
$ rails generate integration_test layout_links
$ rspec spec/
$ bundle exec rspec spec/
$ time rspec spec/
$ rspec spec/models/user_spec.rb -e "should have an encrypted password attribute"
$ ============================heroku:============================
$ sudo gem install heroku
$ heroku keys:add
$ heroku create
$ heroku rake db:migrate
$ [sudo] gem install taps
$ heroku db:push #push data to heroku
$ heroku console #same as rails console on heroku
$ ============================vim:============================
$ :w #write = save
$ :q #quit
$ d #delete
$ ============================ubuntu:============================
$ cd #change directory
$ ls #list
$ mv #move
$ cp #copy
$ rm #remove file or directory
$ rm rf #remove recursive force
$ rm -rf spec/views
$ ps -e | grep apt #show apt* process
$ sudo killall apt #kill process
$ sudo killall apt-get
$ ============================windows:============================
$ cmd color : http://adoxa.110mb.com/ansicon/ansi140.zip , copy to c:/windows/system32/ ,exec ansicon.exe -i
$ ============================words:============================
the tail wagging the dog
There are 10 kinds of people in the world...
$ ===============================================================
@user=User.find(1)
@user.toggle!(:admin) #set admin
Chapter 1 From Zero to Deploy 1
1.1 Introduction 3
1.2 Up and Running 9
1.3 Version Control with Git 24
1.4 Deploying 35
Chapter 2 A Demo App 41
2.1 Planning the Application 41
2.2 The Users Resource 44
2.3 The Microposts Resource 58
Chapter 3 Mostly Static Pages 71
3.1 Static Pages 74
3.2 Our First Tests 84
3.3 Slightly Dynamic Pages 103
Chapter 4 Rails-Flavored Ruby 119
4.1 Motivation 119
4.2 Strings and Methods 125
4.3 Other Data Structures 134
4.4 Ruby Classes 144
Chapter 5 Filling in the Layout 157
5.1 Adding Some Structure 157
5.2 Layout Links 177
5.3 User Signup: A First Step 186
Chapter 6 Modeling and Viewing Users, Part I 193
6.1 User Model 194
6.2 User Validations 210
6.3 Viewing Users 227
Chapter 7 Modeling and Viewing Users, Part II 239
7.1 Insecure Passwords 239
7.2 Secure Passwords 250
7.3 Better User Views 262
Chapter 8 Sign Up 283
8.1 Signup Form 283
8.2 Signup Failure 292
8.3 Signup Success 305
8.4 RSpec Integration Tests 313
Chapter 9 Sign In, Sign Out 325
9.1 Sessions 325
9.2 Signin Failure 332
9.3 Signin Success 338
9.4 Signing Out 354
Chapter 10 Updating, Showing, and Deleting Users 365
10.1 Updating Users 365
10.2 Protecting Pages 376
10.3 Showing Users 384
10.4 Destroying Users 399
Chapter 11 User Microposts 411
11.1 A Micropost Model 411
11.2 Showing Microposts 425
11.3 Manipulating Microposts 434
Chapter 12 Following Users 461
12.1 The Relationship Model 463
12.2 A Web Interface for Following and Followers 482
12.3 The Status Feed 507