easymon 1.6.2 → 1.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +28 -12
  3. data/Rakefile +1 -1
  4. data/app/controllers/easymon/checks_controller.rb +6 -6
  5. data/config/routes.rb +2 -2
  6. data/lib/easymon/checklist.rb +7 -7
  7. data/lib/easymon/checks/active_record_check.rb +6 -5
  8. data/lib/easymon/checks/active_record_mysql_writeable_check.rb +1 -1
  9. data/lib/easymon/checks/http_check.rb +6 -6
  10. data/lib/easymon/checks/memcached_check.rb +6 -6
  11. data/lib/easymon/checks/multi_active_record_check.rb +52 -0
  12. data/lib/easymon/checks/redis_check.rb +3 -3
  13. data/lib/easymon/checks/redis_writeable_check.rb +1 -1
  14. data/lib/easymon/checks/semaphore_check.rb +6 -6
  15. data/lib/easymon/checks/split_active_record_check.rb +6 -16
  16. data/lib/easymon/checks/traffic_enabled_check.rb +2 -2
  17. data/lib/easymon/engine.rb +1 -1
  18. data/lib/easymon/repository.rb +5 -5
  19. data/lib/easymon/result.rb +2 -2
  20. data/lib/easymon/testing.rb +2 -2
  21. data/lib/easymon/version.rb +1 -1
  22. data/lib/easymon.rb +10 -9
  23. data/test/controllers/easymon/checks_controller_test.rb +10 -11
  24. data/test/dummy/Rakefile +2 -3
  25. data/test/dummy/app/assets/stylesheets/application.css +6 -4
  26. data/test/dummy/app/controllers/application_controller.rb +2 -1
  27. data/test/dummy/app/jobs/application_job.rb +7 -0
  28. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  29. data/test/dummy/app/models/application_record.rb +3 -0
  30. data/test/dummy/app/views/layouts/application.html.erb +22 -9
  31. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  32. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  33. data/test/dummy/app/views/pwa/manifest.json.erb +22 -0
  34. data/test/dummy/app/views/pwa/service-worker.js +26 -0
  35. data/test/dummy/bin/dev +2 -0
  36. data/test/dummy/bin/rails +4 -0
  37. data/test/dummy/bin/rake +4 -0
  38. data/test/dummy/bin/setup +34 -0
  39. data/test/dummy/config/application.rb +22 -50
  40. data/test/dummy/config/boot.rb +4 -9
  41. data/test/dummy/config/database.yml +25 -6
  42. data/test/dummy/config/environment.rb +4 -4
  43. data/test/dummy/config/environments/development.rb +55 -25
  44. data/test/dummy/config/environments/production.rb +64 -42
  45. data/test/dummy/config/environments/test.rb +35 -25
  46. data/test/dummy/config/initializers/assets.rb +7 -0
  47. data/test/dummy/config/initializers/content_security_policy.rb +25 -0
  48. data/test/dummy/config/initializers/easymon.rb +2 -2
  49. data/test/dummy/config/initializers/filter_parameter_logging.rb +8 -0
  50. data/test/dummy/config/initializers/inflections.rb +10 -9
  51. data/test/dummy/config/locales/en.yml +28 -2
  52. data/test/dummy/config/puma.rb +38 -0
  53. data/test/dummy/config/redis.yml +5 -6
  54. data/test/dummy/config/routes.rb +13 -0
  55. data/test/dummy/config/storage.yml +34 -0
  56. data/test/dummy/config.ru +4 -2
  57. data/test/dummy/log/test.log +0 -8916
  58. data/test/dummy/public/400.html +114 -0
  59. data/test/dummy/public/404.html +113 -25
  60. data/test/dummy/public/406-unsupported-browser.html +114 -0
  61. data/test/dummy/public/422.html +113 -25
  62. data/test/dummy/public/500.html +113 -24
  63. data/test/dummy/public/icon.png +0 -0
  64. data/test/dummy/public/icon.svg +3 -0
  65. data/test/dummy/tmp/local_secret.txt +1 -0
  66. data/test/helpers/easymon/checks_helper_test.rb +1 -1
  67. data/test/integration/navigation_test.rb +1 -2
  68. data/test/test_helper.rb +3 -3
  69. data/test/unit/checklist_test.rb +5 -5
  70. data/test/unit/checks/active_record_check_on_postgresql_test.rb +1 -2
  71. data/test/unit/checks/active_record_check_test.rb +1 -2
  72. data/test/unit/checks/active_record_mysql_writeable_check_test.rb +2 -3
  73. data/test/unit/checks/http_check_test.rb +3 -3
  74. data/test/unit/checks/memcached_check_test.rb +6 -8
  75. data/test/unit/checks/multi_active_record_check_test.rb +73 -0
  76. data/test/unit/checks/redis_check_test.rb +8 -9
  77. data/test/unit/checks/redis_writeable_check_test.rb +2 -3
  78. data/test/unit/checks/semaphore_check_test.rb +2 -3
  79. data/test/unit/checks/split_active_record_check_test.rb +9 -24
  80. data/test/unit/checks/traffic_enabled_check_test.rb +2 -3
  81. data/test/unit/repository_test.rb +2 -3
  82. metadata +98 -80
  83. data/test/dummy/README.rdoc +0 -261
  84. data/test/dummy/app/assets/config/manifest.js +0 -0
  85. data/test/dummy/app/assets/javascripts/application.js +0 -15
  86. data/test/dummy/app/assets/javascripts/easymon.js +0 -2
  87. data/test/dummy/app/assets/stylesheets/easymon.css +0 -4
  88. data/test/dummy/app/controllers/easymon_controller.rb +0 -7
  89. data/test/dummy/app/helpers/easymon_helper.rb +0 -2
  90. data/test/dummy/app/views/easymon/index.html.erb +0 -2
  91. data/test/dummy/app/views/easymon/show.html.erb +0 -2
  92. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  93. data/test/dummy/config/initializers/mime_types.rb +0 -5
  94. data/test/dummy/config/initializers/secret_token.rb +0 -7
  95. data/test/dummy/config/initializers/session_store.rb +0 -8
  96. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  97. data/test/dummy/log/development.log +0 -24
  98. data/test/dummy/public/favicon.ico +0 -0
  99. data/test/dummy/script/rails +0 -6
  100. data/test/dummy/tmp/cache/4D4/7A0/health_check +0 -1
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easymon
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
4
+ version: 1.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Anderson
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2022-06-17 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: redis
@@ -24,6 +23,20 @@ dependencies:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
25
  version: '0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: benchmark
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
27
40
  - !ruby/object:Gem::Dependency
28
41
  name: rails
29
42
  requirement: !ruby/object:Gem::Requirement
@@ -56,56 +69,56 @@ dependencies:
56
69
  requirements:
57
70
  - - "~>"
58
71
  - !ruby/object:Gem::Version
59
- version: 0.5.0
72
+ version: '0.5'
60
73
  type: :development
61
74
  prerelease: false
62
75
  version_requirements: !ruby/object:Gem::Requirement
63
76
  requirements:
64
77
  - - "~>"
65
78
  - !ruby/object:Gem::Version
66
- version: 0.5.0
79
+ version: '0.5'
67
80
  - !ruby/object:Gem::Dependency
68
81
  name: pg
69
82
  requirement: !ruby/object:Gem::Requirement
70
83
  requirements:
71
84
  - - "~>"
72
85
  - !ruby/object:Gem::Version
73
- version: '1.2'
86
+ version: '1.6'
74
87
  type: :development
75
88
  prerelease: false
76
89
  version_requirements: !ruby/object:Gem::Requirement
77
90
  requirements:
78
91
  - - "~>"
79
92
  - !ruby/object:Gem::Version
80
- version: '1.2'
93
+ version: '1.6'
81
94
  - !ruby/object:Gem::Dependency
82
95
  name: mocha
83
96
  requirement: !ruby/object:Gem::Requirement
84
97
  requirements:
85
98
  - - "~>"
86
99
  - !ruby/object:Gem::Version
87
- version: '1.11'
100
+ version: '2.7'
88
101
  type: :development
89
102
  prerelease: false
90
103
  version_requirements: !ruby/object:Gem::Requirement
91
104
  requirements:
92
105
  - - "~>"
93
106
  - !ruby/object:Gem::Version
94
- version: '1.11'
107
+ version: '2.7'
95
108
  - !ruby/object:Gem::Dependency
96
109
  name: dalli
97
110
  requirement: !ruby/object:Gem::Requirement
98
111
  requirements:
99
112
  - - "~>"
100
113
  - !ruby/object:Gem::Version
101
- version: '2.7'
114
+ version: '3.2'
102
115
  type: :development
103
116
  prerelease: false
104
117
  version_requirements: !ruby/object:Gem::Requirement
105
118
  requirements:
106
119
  - - "~>"
107
120
  - !ruby/object:Gem::Version
108
- version: '2.7'
121
+ version: '3.2'
109
122
  description: |-
110
123
  Enables your monitoring infrastructure to easily query the
111
124
  status of your app server's health. Provides routes under
@@ -128,6 +141,7 @@ files:
128
141
  - lib/easymon/checks/active_record_mysql_writeable_check.rb
129
142
  - lib/easymon/checks/http_check.rb
130
143
  - lib/easymon/checks/memcached_check.rb
144
+ - lib/easymon/checks/multi_active_record_check.rb
131
145
  - lib/easymon/checks/redis_check.rb
132
146
  - lib/easymon/checks/redis_writeable_check.rb
133
147
  - lib/easymon/checks/semaphore_check.rb
@@ -140,20 +154,22 @@ files:
140
154
  - lib/easymon/version.rb
141
155
  - lib/tasks/easymon_tasks.rake
142
156
  - test/controllers/easymon/checks_controller_test.rb
143
- - test/dummy/README.rdoc
144
157
  - test/dummy/Rakefile
145
- - test/dummy/app/assets/config/manifest.js
146
- - test/dummy/app/assets/javascripts/application.js
147
- - test/dummy/app/assets/javascripts/easymon.js
148
158
  - test/dummy/app/assets/stylesheets/application.css
149
- - test/dummy/app/assets/stylesheets/easymon.css
150
159
  - test/dummy/app/controllers/application_controller.rb
151
- - test/dummy/app/controllers/easymon_controller.rb
152
160
  - test/dummy/app/helpers/application_helper.rb
153
- - test/dummy/app/helpers/easymon_helper.rb
154
- - test/dummy/app/views/easymon/index.html.erb
155
- - test/dummy/app/views/easymon/show.html.erb
161
+ - test/dummy/app/jobs/application_job.rb
162
+ - test/dummy/app/mailers/application_mailer.rb
163
+ - test/dummy/app/models/application_record.rb
156
164
  - test/dummy/app/views/layouts/application.html.erb
165
+ - test/dummy/app/views/layouts/mailer.html.erb
166
+ - test/dummy/app/views/layouts/mailer.text.erb
167
+ - test/dummy/app/views/pwa/manifest.json.erb
168
+ - test/dummy/app/views/pwa/service-worker.js
169
+ - test/dummy/bin/dev
170
+ - test/dummy/bin/rails
171
+ - test/dummy/bin/rake
172
+ - test/dummy/bin/setup
157
173
  - test/dummy/config.ru
158
174
  - test/dummy/config/application.rb
159
175
  - test/dummy/config/boot.rb
@@ -163,26 +179,26 @@ files:
163
179
  - test/dummy/config/environments/development.rb
164
180
  - test/dummy/config/environments/production.rb
165
181
  - test/dummy/config/environments/test.rb
166
- - test/dummy/config/initializers/backtrace_silencers.rb
182
+ - test/dummy/config/initializers/assets.rb
183
+ - test/dummy/config/initializers/content_security_policy.rb
167
184
  - test/dummy/config/initializers/easymon.rb
185
+ - test/dummy/config/initializers/filter_parameter_logging.rb
168
186
  - test/dummy/config/initializers/inflections.rb
169
- - test/dummy/config/initializers/mime_types.rb
170
- - test/dummy/config/initializers/secret_token.rb
171
- - test/dummy/config/initializers/session_store.rb
172
- - test/dummy/config/initializers/wrap_parameters.rb
173
187
  - test/dummy/config/locales/en.yml
174
188
  - test/dummy/config/memcached.yml
189
+ - test/dummy/config/puma.rb
175
190
  - test/dummy/config/redis.yml
176
191
  - test/dummy/config/routes.rb
177
192
  - test/dummy/config/storage.yml
178
- - test/dummy/log/development.log
179
193
  - test/dummy/log/test.log
194
+ - test/dummy/public/400.html
180
195
  - test/dummy/public/404.html
196
+ - test/dummy/public/406-unsupported-browser.html
181
197
  - test/dummy/public/422.html
182
198
  - test/dummy/public/500.html
183
- - test/dummy/public/favicon.ico
184
- - test/dummy/script/rails
185
- - test/dummy/tmp/cache/4D4/7A0/health_check
199
+ - test/dummy/public/icon.png
200
+ - test/dummy/public/icon.svg
201
+ - test/dummy/tmp/local_secret.txt
186
202
  - test/helpers/easymon/checks_helper_test.rb
187
203
  - test/integration/navigation_test.rb
188
204
  - test/test_helper.rb
@@ -192,6 +208,7 @@ files:
192
208
  - test/unit/checks/active_record_mysql_writeable_check_test.rb
193
209
  - test/unit/checks/http_check_test.rb
194
210
  - test/unit/checks/memcached_check_test.rb
211
+ - test/unit/checks/multi_active_record_check_test.rb
195
212
  - test/unit/checks/redis_check_test.rb
196
213
  - test/unit/checks/redis_writeable_check_test.rb
197
214
  - test/unit/checks/semaphore_check_test.rb
@@ -202,7 +219,6 @@ homepage: https://github.com/basecamp/easymon
202
219
  licenses:
203
220
  - MIT
204
221
  metadata: {}
205
- post_install_message:
206
222
  rdoc_options: []
207
223
  require_paths:
208
224
  - lib
@@ -217,67 +233,69 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
233
  - !ruby/object:Gem::Version
218
234
  version: '0'
219
235
  requirements: []
220
- rubygems_version: 3.1.6
221
- signing_key:
236
+ rubygems_version: 3.6.9
222
237
  specification_version: 4
223
238
  summary: Simple availability checks for your rails app
224
239
  test_files:
225
- - test/unit/checks/memcached_check_test.rb
226
- - test/unit/checks/http_check_test.rb
227
- - test/unit/checks/active_record_mysql_writeable_check_test.rb
228
- - test/unit/checks/redis_writeable_check_test.rb
229
- - test/unit/checks/semaphore_check_test.rb
230
- - test/unit/checks/active_record_check_test.rb
231
- - test/unit/checks/active_record_check_on_postgresql_test.rb
232
- - test/unit/checks/split_active_record_check_test.rb
233
- - test/unit/checks/redis_check_test.rb
234
- - test/unit/checks/traffic_enabled_check_test.rb
235
- - test/unit/repository_test.rb
236
- - test/unit/checklist_test.rb
237
- - test/dummy/app/controllers/application_controller.rb
238
- - test/dummy/app/controllers/easymon_controller.rb
239
- - test/dummy/app/views/easymon/index.html.erb
240
- - test/dummy/app/views/easymon/show.html.erb
241
- - test/dummy/app/views/layouts/application.html.erb
242
- - test/dummy/app/assets/config/manifest.js
243
- - test/dummy/app/assets/javascripts/easymon.js
244
- - test/dummy/app/assets/javascripts/application.js
240
+ - test/controllers/easymon/checks_controller_test.rb
241
+ - test/dummy/Rakefile
245
242
  - test/dummy/app/assets/stylesheets/application.css
246
- - test/dummy/app/assets/stylesheets/easymon.css
247
- - test/dummy/app/helpers/easymon_helper.rb
243
+ - test/dummy/app/controllers/application_controller.rb
248
244
  - test/dummy/app/helpers/application_helper.rb
249
- - test/dummy/config/routes.rb
250
- - test/dummy/config/locales/en.yml
251
- - test/dummy/config/environments/production.rb
252
- - test/dummy/config/environments/development.rb
253
- - test/dummy/config/environments/test.rb
254
- - test/dummy/config/environment.rb
255
- - test/dummy/config/redis.yml
256
- - test/dummy/config/storage.yml
245
+ - test/dummy/app/jobs/application_job.rb
246
+ - test/dummy/app/mailers/application_mailer.rb
247
+ - test/dummy/app/models/application_record.rb
248
+ - test/dummy/app/views/layouts/application.html.erb
249
+ - test/dummy/app/views/layouts/mailer.html.erb
250
+ - test/dummy/app/views/layouts/mailer.text.erb
251
+ - test/dummy/app/views/pwa/manifest.json.erb
252
+ - test/dummy/app/views/pwa/service-worker.js
253
+ - test/dummy/bin/dev
254
+ - test/dummy/bin/rails
255
+ - test/dummy/bin/rake
256
+ - test/dummy/bin/setup
257
+ - test/dummy/config.ru
257
258
  - test/dummy/config/application.rb
258
- - test/dummy/config/memcached.yml
259
- - test/dummy/config/database.yml
260
259
  - test/dummy/config/boot.rb
260
+ - test/dummy/config/database.yml
261
261
  - test/dummy/config/elasticsearch.yml
262
- - test/dummy/config/initializers/backtrace_silencers.rb
263
- - test/dummy/config/initializers/mime_types.rb
264
- - test/dummy/config/initializers/session_store.rb
265
- - test/dummy/config/initializers/wrap_parameters.rb
262
+ - test/dummy/config/environment.rb
263
+ - test/dummy/config/environments/development.rb
264
+ - test/dummy/config/environments/production.rb
265
+ - test/dummy/config/environments/test.rb
266
+ - test/dummy/config/initializers/assets.rb
267
+ - test/dummy/config/initializers/content_security_policy.rb
266
268
  - test/dummy/config/initializers/easymon.rb
267
- - test/dummy/config/initializers/secret_token.rb
269
+ - test/dummy/config/initializers/filter_parameter_logging.rb
268
270
  - test/dummy/config/initializers/inflections.rb
269
- - test/dummy/config.ru
270
- - test/dummy/script/rails
271
- - test/dummy/Rakefile
272
- - test/dummy/public/favicon.ico
271
+ - test/dummy/config/locales/en.yml
272
+ - test/dummy/config/memcached.yml
273
+ - test/dummy/config/puma.rb
274
+ - test/dummy/config/redis.yml
275
+ - test/dummy/config/routes.rb
276
+ - test/dummy/config/storage.yml
277
+ - test/dummy/log/test.log
278
+ - test/dummy/public/400.html
279
+ - test/dummy/public/404.html
280
+ - test/dummy/public/406-unsupported-browser.html
273
281
  - test/dummy/public/422.html
274
282
  - test/dummy/public/500.html
275
- - test/dummy/public/404.html
276
- - test/dummy/log/test.log
277
- - test/dummy/log/development.log
278
- - test/dummy/tmp/cache/4D4/7A0/health_check
279
- - test/dummy/README.rdoc
283
+ - test/dummy/public/icon.png
284
+ - test/dummy/public/icon.svg
285
+ - test/dummy/tmp/local_secret.txt
286
+ - test/helpers/easymon/checks_helper_test.rb
280
287
  - test/integration/navigation_test.rb
281
288
  - test/test_helper.rb
282
- - test/controllers/easymon/checks_controller_test.rb
283
- - test/helpers/easymon/checks_helper_test.rb
289
+ - test/unit/checklist_test.rb
290
+ - test/unit/checks/active_record_check_on_postgresql_test.rb
291
+ - test/unit/checks/active_record_check_test.rb
292
+ - test/unit/checks/active_record_mysql_writeable_check_test.rb
293
+ - test/unit/checks/http_check_test.rb
294
+ - test/unit/checks/memcached_check_test.rb
295
+ - test/unit/checks/multi_active_record_check_test.rb
296
+ - test/unit/checks/redis_check_test.rb
297
+ - test/unit/checks/redis_writeable_check_test.rb
298
+ - test/unit/checks/semaphore_check_test.rb
299
+ - test/unit/checks/split_active_record_check_test.rb
300
+ - test/unit/checks/traffic_enabled_check_test.rb
301
+ - test/unit/repository_test.rb
@@ -1,261 +0,0 @@
1
- == Welcome to Rails
2
-
3
- Rails is a web-application framework that includes everything needed to create
4
- database-backed web applications according to the Model-View-Control pattern.
5
-
6
- This pattern splits the view (also called the presentation) into "dumb"
7
- templates that are primarily responsible for inserting pre-built data in between
8
- HTML tags. The model contains the "smart" domain objects (such as Account,
9
- Product, Person, Post) that holds all the business logic and knows how to
10
- persist themselves to a database. The controller handles the incoming requests
11
- (such as Save New Account, Update Product, Show Post) by manipulating the model
12
- and directing data to the view.
13
-
14
- In Rails, the model is handled by what's called an object-relational mapping
15
- layer entitled Active Record. This layer allows you to present the data from
16
- database rows as objects and embellish these data objects with business logic
17
- methods. You can read more about Active Record in
18
- link:files/vendor/rails/activerecord/README.html.
19
-
20
- The controller and view are handled by the Action Pack, which handles both
21
- layers by its two parts: Action View and Action Controller. These two layers
22
- are bundled in a single package due to their heavy interdependence. This is
23
- unlike the relationship between the Active Record and Action Pack that is much
24
- more separate. Each of these packages can be used independently outside of
25
- Rails. You can read more about Action Pack in
26
- link:files/vendor/rails/actionpack/README.html.
27
-
28
-
29
- == Getting Started
30
-
31
- 1. At the command prompt, create a new Rails application:
32
- <tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
33
-
34
- 2. Change directory to <tt>myapp</tt> and start the web server:
35
- <tt>cd myapp; rails server</tt> (run with --help for options)
36
-
37
- 3. Go to http://localhost:3000/ and you'll see:
38
- "Welcome aboard: You're riding Ruby on Rails!"
39
-
40
- 4. Follow the guidelines to start developing your application. You can find
41
- the following resources handy:
42
-
43
- * The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
44
- * Ruby on Rails Tutorial Book: http://www.railstutorial.org/
45
-
46
-
47
- == Debugging Rails
48
-
49
- Sometimes your application goes wrong. Fortunately there are a lot of tools that
50
- will help you debug it and get it back on the rails.
51
-
52
- First area to check is the application log files. Have "tail -f" commands
53
- running on the server.log and development.log. Rails will automatically display
54
- debugging and runtime information to these files. Debugging info will also be
55
- shown in the browser on requests from 127.0.0.1.
56
-
57
- You can also log your own messages directly into the log file from your code
58
- using the Ruby logger class from inside your controllers. Example:
59
-
60
- class WeblogController < ActionController::Base
61
- def destroy
62
- @weblog = Weblog.find(params[:id])
63
- @weblog.destroy
64
- logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
65
- end
66
- end
67
-
68
- The result will be a message in your log file along the lines of:
69
-
70
- Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
71
-
72
- More information on how to use the logger is at http://www.ruby-doc.org/core/
73
-
74
- Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
75
- several books available online as well:
76
-
77
- * Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
78
- * Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
79
-
80
- These two books will bring you up to speed on the Ruby language and also on
81
- programming in general.
82
-
83
-
84
- == Debugger
85
-
86
- Debugger support is available through the debugger command when you start your
87
- Mongrel or WEBrick server with --debugger. This means that you can break out of
88
- execution at any point in the code, investigate and change the model, and then,
89
- resume execution! You need to install ruby-debug to run the server in debugging
90
- mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
91
-
92
- class WeblogController < ActionController::Base
93
- def index
94
- @posts = Post.all
95
- debugger
96
- end
97
- end
98
-
99
- So the controller will accept the action, run the first line, then present you
100
- with a IRB prompt in the server window. Here you can do things like:
101
-
102
- >> @posts.inspect
103
- => "[#<Post:0x14a6be8
104
- @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
105
- #<Post:0x14a6620
106
- @attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
107
- >> @posts.first.title = "hello from a debugger"
108
- => "hello from a debugger"
109
-
110
- ...and even better, you can examine how your runtime objects actually work:
111
-
112
- >> f = @posts.first
113
- => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
114
- >> f.
115
- Display all 152 possibilities? (y or n)
116
-
117
- Finally, when you're ready to resume execution, you can enter "cont".
118
-
119
-
120
- == Console
121
-
122
- The console is a Ruby shell, which allows you to interact with your
123
- application's domain model. Here you'll have all parts of the application
124
- configured, just like it is when the application is running. You can inspect
125
- domain models, change values, and save to the database. Starting the script
126
- without arguments will launch it in the development environment.
127
-
128
- To start the console, run <tt>rails console</tt> from the application
129
- directory.
130
-
131
- Options:
132
-
133
- * Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
134
- made to the database.
135
- * Passing an environment name as an argument will load the corresponding
136
- environment. Example: <tt>rails console production</tt>.
137
-
138
- To reload your controllers and models after launching the console run
139
- <tt>reload!</tt>
140
-
141
- More information about irb can be found at:
142
- link:http://www.rubycentral.org/pickaxe/irb.html
143
-
144
-
145
- == dbconsole
146
-
147
- You can go to the command line of your database directly through <tt>rails
148
- dbconsole</tt>. You would be connected to the database with the credentials
149
- defined in database.yml. Starting the script without arguments will connect you
150
- to the development database. Passing an argument will connect you to a different
151
- database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
152
- PostgreSQL and SQLite 3.
153
-
154
- == Description of Contents
155
-
156
- The default directory structure of a generated Ruby on Rails application:
157
-
158
- |-- app
159
- | |-- assets
160
- | | |-- images
161
- | | |-- javascripts
162
- | | `-- stylesheets
163
- | |-- controllers
164
- | |-- helpers
165
- | |-- mailers
166
- | |-- models
167
- | `-- views
168
- | `-- layouts
169
- |-- config
170
- | |-- environments
171
- | |-- initializers
172
- | `-- locales
173
- |-- db
174
- |-- doc
175
- |-- lib
176
- | |-- assets
177
- | `-- tasks
178
- |-- log
179
- |-- public
180
- |-- script
181
- |-- test
182
- | |-- fixtures
183
- | |-- functional
184
- | |-- integration
185
- | |-- performance
186
- | `-- unit
187
- |-- tmp
188
- | `-- cache
189
- | `-- assets
190
- `-- vendor
191
- |-- assets
192
- | |-- javascripts
193
- | `-- stylesheets
194
- `-- plugins
195
-
196
- app
197
- Holds all the code that's specific to this particular application.
198
-
199
- app/assets
200
- Contains subdirectories for images, stylesheets, and JavaScript files.
201
-
202
- app/controllers
203
- Holds controllers that should be named like weblogs_controller.rb for
204
- automated URL mapping. All controllers should descend from
205
- ApplicationController which itself descends from ActionController::Base.
206
-
207
- app/models
208
- Holds models that should be named like post.rb. Models descend from
209
- ActiveRecord::Base by default.
210
-
211
- app/views
212
- Holds the template files for the view that should be named like
213
- weblogs/index.html.erb for the WeblogsController#index action. All views use
214
- eRuby syntax by default.
215
-
216
- app/views/layouts
217
- Holds the template files for layouts to be used with views. This models the
218
- common header/footer method of wrapping views. In your views, define a layout
219
- using the <tt>layout :default</tt> and create a file named default.html.erb.
220
- Inside default.html.erb, call <% yield %> to render the view using this
221
- layout.
222
-
223
- app/helpers
224
- Holds view helpers that should be named like weblogs_helper.rb. These are
225
- generated for you automatically when using generators for controllers.
226
- Helpers can be used to wrap functionality for your views into methods.
227
-
228
- config
229
- Configuration files for the Rails environment, the routing map, the database,
230
- and other dependencies.
231
-
232
- db
233
- Contains the database schema in schema.rb. db/migrate contains all the
234
- sequence of Migrations for your schema.
235
-
236
- doc
237
- This directory is where your application documentation will be stored when
238
- generated using <tt>rake doc:app</tt>
239
-
240
- lib
241
- Application specific libraries. Basically, any kind of custom code that
242
- doesn't belong under controllers, models, or helpers. This directory is in
243
- the load path.
244
-
245
- public
246
- The directory available for the web server. Also contains the dispatchers and the
247
- default HTML files. This should be set as the DOCUMENT_ROOT of your web
248
- server.
249
-
250
- script
251
- Helper scripts for automation and generation.
252
-
253
- test
254
- Unit and functional tests along with fixtures. When using the rails generate
255
- command, template test files will be generated for you and placed in this
256
- directory.
257
-
258
- vendor
259
- External libraries that the application depends on. Also includes the plugins
260
- subdirectory. If the app has frozen rails, those gems also go here, under
261
- vendor/rails/. This directory is in the load path.
File without changes
@@ -1,15 +0,0 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // the compiled file.
9
- //
10
- // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
- // GO AFTER THE REQUIRES BELOW.
12
- //
13
- //= require jquery
14
- //= require jquery_ujs
15
- //= require_tree .
@@ -1,2 +0,0 @@
1
- // Place all the behaviors and hooks related to the matching controller here.
2
- // All this logic will automatically be available in application.js.
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,7 +0,0 @@
1
- class EasymonController < ApplicationController
2
- def index
3
- end
4
-
5
- def show
6
- end
7
- end
@@ -1,2 +0,0 @@
1
- module EasymonHelper
2
- end
@@ -1,2 +0,0 @@
1
- <h1>Easymon#index</h1>
2
- <p>Find me in app/views/easymon/index.html.erb</p>
@@ -1,2 +0,0 @@
1
- <h1>Easymon#show</h1>
2
- <p>Find me in app/views/easymon/show.html.erb</p>
@@ -1,7 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
- # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
-
6
- # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
- # Rails.backtrace_cleaner.remove_silencers!
@@ -1,5 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new mime types for use in respond_to blocks:
4
- # Mime::Type.register "text/richtext", :rtf
5
- # Mime::Type.register_alias "text/html", :iphone
@@ -1,7 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Your secret key for verifying the integrity of signed cookies.
4
- # If you change this key, all old signed cookies will become invalid!
5
- # Make sure the secret is at least 30 characters and all random,
6
- # no regular words or you'll be exposed to dictionary attacks.
7
- Dummy::Application.config.secret_key_base = 'd651a940f48f2e8cfceff7d317f456a7e749d639a6ee74dc076c7003d4f360064bd1b8de5b31149d6b323ebc3e4e756ab5e1979594a95903f8c58f2d94ae5d0e'
@@ -1,8 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
4
-
5
- # Use the database for sessions instead of the cookie-based default,
6
- # which shouldn't be used to store highly confidential information
7
- # (create the session table with "rails generate session_migration")
8
- # Dummy::Application.config.session_store :active_record_store
@@ -1,14 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
- #
3
- # This file contains settings for ActionController::ParamsWrapper which
4
- # is enabled by default.
5
-
6
- # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
- ActiveSupport.on_load(:action_controller) do
8
- wrap_parameters format: [:json]
9
- end
10
-
11
- # Disable root element in JSON by default.
12
- ActiveSupport.on_load(:active_record) do
13
- self.include_root_in_json = false
14
- end