-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmd.txt
250 lines (210 loc) · 6.95 KB
/
cmd.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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
ridk install
ridk
ruby
irb
ruby file.rb
rufo file.rb
ri
rdoc
==========================================
===========
C:\Ruby25-x64\bin
C:\Ruby30-x64\bin
===========
/c/Ruby25-x64/bin/ruby
/c/Ruby25-x64/bin/gem
===========
gem install solargraph
gem install rufo
===========
=====================================================================================================
gem list
===========
gem list bundler
gem update bundler
gem cleanup bundler
===========
gem install sqlite3
gem install webpacker
gem install rails
gem install rails -v 5.2.6
gem install rails -v 6.1.4.4
gem install rails -v 5.2.2.1
===========
rails -v
gem list rails
===========
rails new name_of_app
rails new test_app
rails new first_app
===========
rails _5.2.6_ new name_of_app
rails _5.2.6_ new test_app
rails _5.2.6_ new second_app
===========
rails server
rails s
rails server -b 0.0.0.0 -p 80
rails s -b 0.0.0.0
===========
gem uninstall rails -v 5.2.6
gem cleanup rails -v 5.2.6
===========
bundle info [gemname]
=====================================================================================================
(alt + p) => RACK_MINI_PROFILER
?pp=disable
?pp=enable
==========================================
rails generate controller pages
rails g controller pages
rails generate migration create_articles
rails g migration create_articles
rails g migration add_timestamps_to_articles
===================
bundle install --without production # DEPRECATED
bundle config set --local without 'production' # not working
bundle config without production
===================
# Scaffold generator command to create an article model (with two attributes),
articles controller, views for articles and migration file to create articles table:
rails generate scaffold Article title:string description:text
rails g scaffold Article title:string description:text
rails g scaffold User username:string email:string password:string
rails db:migrate
rails db:rollback
===================
rails routes --expanded
rails routes -c articles
rails routes -c articles | grep edit
===================
bundle exec rake schedular:clear_log
rake --tasks
rake log:clear
rake tmp:clear
===================
rails console
rails c
===========
Article.all # class name in models file
Article.create(title: "first article", description: "Description of first article") # make sure Article is capitalized if using this method
article = Article.new
article.title = "second article"
article.description = "description of second article"
article.save
article = Article.new(title: "third article", description: "description of third article")
article.save
Article.all
=====================================================================================================
reload! => use this when change in models files
===================
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
byebug
continue # again work server
# you can use on rails s
$ params
$ continue
===================
heroku login
heroku git:remote -a alpha-blog-rails-eg
git push heroku master
heroku run rails db:migrate
heroku open
heroku run rails console
=====================================================================================================
https://www.mashrurhossain.com/blog/rails6bootstrap4
yarn add [email protected] jquery popper.js
yarn add jquery
yarn add [email protected]
yarn add @popperjs/[email protected]
yarn add popper.js
yarn add [email protected]
===================
=====================================================================================================
rails g scaffold User username:string email:string password:string
rails db:migrate
rails g migration add_user_id_to_articles
rails db:migrate
===================
rails g migration create_users
rails db:migrate
rails g migration add_user_id_to_articles
rails db:migrate
===================
rails generate migration add_password_digest_to_users
rails db:migrate
===================
rails generate migration add_admin_to_users
rails db:migrate
===================
=====================================================================================================
rails test
rails generate test_unit:scaffold category
rails test test/controllers
rails test test/system
rails test test/controllers/categories_controller_test.rb
rails generate integration_test create_category
rails test
rails test test/integration/create_category_test.rb
rails generate integration_test list_categories
rails test test/integration/list_categories.rb
===================
rails generate migration create_article_categories
rails db:migrate
===================
=====================================================================================================
bundle config without production
bundle install
cd 1-complete_ruby__mashrur_hossain/2-intro_ruby_on_rails/alpha_blog/
rails s -b 0.0.0.0
rails c
rails routes --expanded | grep edit
rails routes -E
rails routes -c articles
rails routes -c articles --expanded
rails routes -c users
dokku run production rails routes --expanded
=====================================================================================================
=====================================================================================================
=====================================================================================================
=====================================================================================================
=====================================================================================================
sudo apt install postgresql
sudo service postgresql start
sudo -u postgres psql
sudo -u postgres createuser <username>
sudo -u postgres createdb <dbname>
sudo -u postgres psql
pgrep -u postgres -fa -- -D
=============================================
git clone
cd repo
# install rvm (rvm --version)
rvm install "ruby-2.5.3"
gem install bundler -v 1.17.3
bundle install
rake db:create
rake db:migrate
rails s # webserver
rails c # debug development
sudo apt-get install libpq-dev
=============================================
ls /etc/postgresql/12/main
cat /etc/postgresql/12/main/
service postgresql
service postgresql status
sudo -i -u postgres
sudo su postgres
sudo -u postgres createuser <username>
sudo -u postgres createuser --interactive
sudo -u postgres createdb spider_nest_development
sudo -u postgres createdb spider_nest_development
sudo -u postgres psql
sudo -u ahmed psql
\conninfo
\l
\du
=====================================================================================================
wsl --list --verbose
wsl --shutdown
=====================================================================================================