reflexive 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. data/Rakefile +3 -1
  2. data/reflexive.gemspec +3 -1
  3. data/views/dashboard.erb +6 -6
  4. metadata +2 -125
  5. data/spec/test_apps/rails2_test_app/README +0 -243
  6. data/spec/test_apps/rails2_test_app/Rakefile +0 -10
  7. data/spec/test_apps/rails2_test_app/app/controllers/application_controller.rb +0 -10
  8. data/spec/test_apps/rails2_test_app/app/controllers/posts_controller.rb +0 -85
  9. data/spec/test_apps/rails2_test_app/app/helpers/application_helper.rb +0 -3
  10. data/spec/test_apps/rails2_test_app/app/helpers/posts_helper.rb +0 -2
  11. data/spec/test_apps/rails2_test_app/app/models/post.rb +0 -5
  12. data/spec/test_apps/rails2_test_app/app/views/layouts/posts.html.erb +0 -17
  13. data/spec/test_apps/rails2_test_app/app/views/posts/edit.html.erb +0 -12
  14. data/spec/test_apps/rails2_test_app/app/views/posts/index.html.erb +0 -18
  15. data/spec/test_apps/rails2_test_app/app/views/posts/new.html.erb +0 -11
  16. data/spec/test_apps/rails2_test_app/app/views/posts/show.html.erb +0 -3
  17. data/spec/test_apps/rails2_test_app/config/boot.rb +0 -110
  18. data/spec/test_apps/rails2_test_app/config/database.yml +0 -22
  19. data/spec/test_apps/rails2_test_app/config/environment.rb +0 -43
  20. data/spec/test_apps/rails2_test_app/config/environments/development.rb +0 -17
  21. data/spec/test_apps/rails2_test_app/config/environments/production.rb +0 -28
  22. data/spec/test_apps/rails2_test_app/config/environments/test.rb +0 -28
  23. data/spec/test_apps/rails2_test_app/config/initializers/backtrace_silencers.rb +0 -7
  24. data/spec/test_apps/rails2_test_app/config/initializers/inflections.rb +0 -10
  25. data/spec/test_apps/rails2_test_app/config/initializers/mime_types.rb +0 -5
  26. data/spec/test_apps/rails2_test_app/config/initializers/new_rails_defaults.rb +0 -21
  27. data/spec/test_apps/rails2_test_app/config/initializers/session_store.rb +0 -15
  28. data/spec/test_apps/rails2_test_app/config/locales/en.yml +0 -5
  29. data/spec/test_apps/rails2_test_app/config/routes.rb +0 -45
  30. data/spec/test_apps/rails2_test_app/db/development.sqlite3 +0 -0
  31. data/spec/test_apps/rails2_test_app/db/migrate/20100512073155_create_posts.rb +0 -12
  32. data/spec/test_apps/rails2_test_app/db/schema.rb +0 -19
  33. data/spec/test_apps/rails2_test_app/db/seeds.rb +0 -7
  34. data/spec/test_apps/rails2_test_app/doc/README_FOR_APP +0 -2
  35. data/spec/test_apps/rails2_test_app/log/development.log +0 -251
  36. data/spec/test_apps/rails2_test_app/log/production.log +0 -0
  37. data/spec/test_apps/rails2_test_app/log/server.log +0 -0
  38. data/spec/test_apps/rails2_test_app/log/test.log +0 -0
  39. data/spec/test_apps/rails2_test_app/public/404.html +0 -30
  40. data/spec/test_apps/rails2_test_app/public/422.html +0 -30
  41. data/spec/test_apps/rails2_test_app/public/500.html +0 -30
  42. data/spec/test_apps/rails2_test_app/public/favicon.ico +0 -0
  43. data/spec/test_apps/rails2_test_app/public/images/rails.png +0 -0
  44. data/spec/test_apps/rails2_test_app/public/index.html +0 -275
  45. data/spec/test_apps/rails2_test_app/public/javascripts/application.js +0 -2
  46. data/spec/test_apps/rails2_test_app/public/javascripts/controls.js +0 -963
  47. data/spec/test_apps/rails2_test_app/public/javascripts/dragdrop.js +0 -973
  48. data/spec/test_apps/rails2_test_app/public/javascripts/effects.js +0 -1128
  49. data/spec/test_apps/rails2_test_app/public/javascripts/prototype.js +0 -4320
  50. data/spec/test_apps/rails2_test_app/public/robots.txt +0 -5
  51. data/spec/test_apps/rails2_test_app/public/stylesheets/1.css +0 -0
  52. data/spec/test_apps/rails2_test_app/public/stylesheets/scaffold.css +0 -54
  53. data/spec/test_apps/rails2_test_app/script/about +0 -4
  54. data/spec/test_apps/rails2_test_app/script/console +0 -3
  55. data/spec/test_apps/rails2_test_app/script/dbconsole +0 -3
  56. data/spec/test_apps/rails2_test_app/script/destroy +0 -3
  57. data/spec/test_apps/rails2_test_app/script/generate +0 -3
  58. data/spec/test_apps/rails2_test_app/script/performance/benchmarker +0 -3
  59. data/spec/test_apps/rails2_test_app/script/performance/profiler +0 -3
  60. data/spec/test_apps/rails2_test_app/script/plugin +0 -3
  61. data/spec/test_apps/rails2_test_app/script/runner +0 -3
  62. data/spec/test_apps/rails2_test_app/script/server +0 -3
  63. data/spec/test_apps/rails2_test_app/test/fixtures/posts.yml +0 -7
  64. data/spec/test_apps/rails2_test_app/test/functional/posts_controller_test.rb +0 -45
  65. data/spec/test_apps/rails2_test_app/test/performance/browsing_test.rb +0 -9
  66. data/spec/test_apps/rails2_test_app/test/test_helper.rb +0 -38
  67. data/spec/test_apps/rails2_test_app/test/unit/helpers/posts_helper_test.rb +0 -4
  68. data/spec/test_apps/rails2_test_app/test/unit/post_test.rb +0 -8
  69. data/spec/test_apps/rails3_test_app/Gemfile +0 -28
  70. data/spec/test_apps/rails3_test_app/README +0 -244
  71. data/spec/test_apps/rails3_test_app/Rakefile +0 -10
  72. data/spec/test_apps/rails3_test_app/app/controllers/application_controller.rb +0 -4
  73. data/spec/test_apps/rails3_test_app/app/controllers/posts_controller.rb +0 -83
  74. data/spec/test_apps/rails3_test_app/app/helpers/application_helper.rb +0 -2
  75. data/spec/test_apps/rails3_test_app/app/helpers/posts_helper.rb +0 -2
  76. data/spec/test_apps/rails3_test_app/app/models/post.rb +0 -2
  77. data/spec/test_apps/rails3_test_app/app/views/layouts/application.html.erb +0 -14
  78. data/spec/test_apps/rails3_test_app/app/views/posts/_form.html.erb +0 -16
  79. data/spec/test_apps/rails3_test_app/app/views/posts/edit.html.erb +0 -6
  80. data/spec/test_apps/rails3_test_app/app/views/posts/index.html.erb +0 -21
  81. data/spec/test_apps/rails3_test_app/app/views/posts/new.html.erb +0 -5
  82. data/spec/test_apps/rails3_test_app/app/views/posts/show.html.erb +0 -5
  83. data/spec/test_apps/rails3_test_app/config/application.rb +0 -49
  84. data/spec/test_apps/rails3_test_app/config/boot.rb +0 -6
  85. data/spec/test_apps/rails3_test_app/config/database.yml +0 -22
  86. data/spec/test_apps/rails3_test_app/config/environment.rb +0 -5
  87. data/spec/test_apps/rails3_test_app/config/environments/development.rb +0 -19
  88. data/spec/test_apps/rails3_test_app/config/environments/production.rb +0 -42
  89. data/spec/test_apps/rails3_test_app/config/environments/test.rb +0 -32
  90. data/spec/test_apps/rails3_test_app/config/initializers/backtrace_silencers.rb +0 -7
  91. data/spec/test_apps/rails3_test_app/config/initializers/inflections.rb +0 -10
  92. data/spec/test_apps/rails3_test_app/config/initializers/mime_types.rb +0 -5
  93. data/spec/test_apps/rails3_test_app/config/initializers/secret_token.rb +0 -7
  94. data/spec/test_apps/rails3_test_app/config/initializers/session_store.rb +0 -8
  95. data/spec/test_apps/rails3_test_app/config/locales/en.yml +0 -5
  96. data/spec/test_apps/rails3_test_app/config/routes.rb +0 -60
  97. data/spec/test_apps/rails3_test_app/config.ru +0 -4
  98. data/spec/test_apps/rails3_test_app/db/development.sqlite3 +0 -0
  99. data/spec/test_apps/rails3_test_app/db/migrate/20100512075428_create_posts.rb +0 -12
  100. data/spec/test_apps/rails3_test_app/db/schema.rb +0 -19
  101. data/spec/test_apps/rails3_test_app/db/seeds.rb +0 -7
  102. data/spec/test_apps/rails3_test_app/doc/README_FOR_APP +0 -2
  103. data/spec/test_apps/rails3_test_app/log/development.log +0 -349
  104. data/spec/test_apps/rails3_test_app/log/production.log +0 -0
  105. data/spec/test_apps/rails3_test_app/log/server.log +0 -0
  106. data/spec/test_apps/rails3_test_app/log/test.log +0 -0
  107. data/spec/test_apps/rails3_test_app/public/404.html +0 -26
  108. data/spec/test_apps/rails3_test_app/public/422.html +0 -26
  109. data/spec/test_apps/rails3_test_app/public/500.html +0 -26
  110. data/spec/test_apps/rails3_test_app/public/favicon.ico +0 -0
  111. data/spec/test_apps/rails3_test_app/public/images/rails.png +0 -0
  112. data/spec/test_apps/rails3_test_app/public/index.html +0 -279
  113. data/spec/test_apps/rails3_test_app/public/javascripts/application.js +0 -2
  114. data/spec/test_apps/rails3_test_app/public/javascripts/controls.js +0 -965
  115. data/spec/test_apps/rails3_test_app/public/javascripts/dragdrop.js +0 -974
  116. data/spec/test_apps/rails3_test_app/public/javascripts/effects.js +0 -1123
  117. data/spec/test_apps/rails3_test_app/public/javascripts/prototype.js +0 -4874
  118. data/spec/test_apps/rails3_test_app/public/javascripts/rails.js +0 -118
  119. data/spec/test_apps/rails3_test_app/public/robots.txt +0 -5
  120. data/spec/test_apps/rails3_test_app/public/stylesheets/scaffold.css +0 -60
  121. data/spec/test_apps/rails3_test_app/script/rails +0 -9
  122. data/spec/test_apps/rails3_test_app/test/fixtures/posts.yml +0 -11
  123. data/spec/test_apps/rails3_test_app/test/functional/posts_controller_test.rb +0 -49
  124. data/spec/test_apps/rails3_test_app/test/performance/browsing_test.rb +0 -9
  125. data/spec/test_apps/rails3_test_app/test/test_helper.rb +0 -13
  126. data/spec/test_apps/rails3_test_app/test/unit/helpers/posts_helper_test.rb +0 -4
  127. data/spec/test_apps/rails3_test_app/test/unit/post_test.rb +0 -8
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ end
7
7
 
8
8
  GEM_NAME = "reflexive"
9
9
 
10
- desc "Relese next version of reflexive gem"
10
+ desc "Relese next version of reflexive gem (do that just after `git commit')"
11
11
  task :release do
12
12
  require "rubygems"
13
13
  require "rubygems/version"
@@ -26,6 +26,8 @@ task :release do
26
26
  sh "gem install #{ GEM_NAME } --version=#{ new_version } --local --verbose"
27
27
 
28
28
  File.delete("#{ GEM_NAME }-#{ new_version }.gem")
29
+
30
+ sh "git push"
29
31
  end
30
32
 
31
33
  task :default => :spec
data/reflexive.gemspec CHANGED
@@ -6,7 +6,9 @@ Gem::Specification.new do |s|
6
6
  s.homepage = "http://github.com/dolzenko/reflexive"
7
7
  s.summary = "Reflexive"
8
8
 
9
- s.files = Dir.glob("{lib,public,views,spec}/**/*") + %w(reflexive.gemspec Rakefile Gemfile config.ru)
9
+ s.files = Dir.glob("{lib,public,views}/**/*") +
10
+ Dir.glob("spec/*.rb") +
11
+ %w(reflexive.gemspec Rakefile Gemfile config.ru)
10
12
 
11
13
  s.required_ruby_version = '>= 1.9.1'
12
14
 
data/views/dashboard.erb CHANGED
@@ -5,23 +5,23 @@
5
5
  <% if defined?(ActiveRecord::Base) || defined?(ApplicationController) %>
6
6
  <div class="row">
7
7
  <div class="column">
8
- <% if defined?(ActiveRecord::Base) %>
8
+ <% if defined?(::ActiveRecord::Base) %>
9
9
  <h2>Models</h2>
10
10
 
11
11
  <div style="clear: both;"></div>
12
12
  <div class="content">
13
13
  <%= content_tag(:pre,
14
- constants_list(ActiveRecord::Base,
15
- Reflexive.descendants(ActiveRecord::Base))) %>
14
+ constants_list(::ActiveRecord::Base,
15
+ Reflexive.descendants(::ActiveRecord::Base))) %>
16
16
  </div>
17
17
  <% end %>
18
18
  </div>
19
19
  <div class="column">
20
- <% if defined?(ApplicationController) %>
20
+ <% if defined?(::ApplicationController) %>
21
21
  <h2>Controllers</h2>
22
22
  <%= content_tag(:pre,
23
- constants_list(ApplicationController,
24
- Reflexive.descendants(ApplicationController))) %>
23
+ constants_list(::ApplicationController,
24
+ Reflexive.descendants(::ApplicationController))) %>
25
25
  <% end %>
26
26
  </div>
27
27
  </div>
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 4
9
- version: 0.0.4
8
+ - 5
9
+ version: 0.0.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Evgeniy Dolzhenko
@@ -180,129 +180,6 @@ files:
180
180
  - spec/sexp_builder_with_scanner_events.rb
181
181
  - spec/shell_out.rb
182
182
  - spec/spec_helper.rb
183
- - spec/test_apps/rails2_test_app/app/controllers/application_controller.rb
184
- - spec/test_apps/rails2_test_app/app/controllers/posts_controller.rb
185
- - spec/test_apps/rails2_test_app/app/helpers/application_helper.rb
186
- - spec/test_apps/rails2_test_app/app/helpers/posts_helper.rb
187
- - spec/test_apps/rails2_test_app/app/models/post.rb
188
- - spec/test_apps/rails2_test_app/app/views/layouts/posts.html.erb
189
- - spec/test_apps/rails2_test_app/app/views/posts/edit.html.erb
190
- - spec/test_apps/rails2_test_app/app/views/posts/index.html.erb
191
- - spec/test_apps/rails2_test_app/app/views/posts/new.html.erb
192
- - spec/test_apps/rails2_test_app/app/views/posts/show.html.erb
193
- - spec/test_apps/rails2_test_app/config/boot.rb
194
- - spec/test_apps/rails2_test_app/config/database.yml
195
- - spec/test_apps/rails2_test_app/config/environment.rb
196
- - spec/test_apps/rails2_test_app/config/environments/development.rb
197
- - spec/test_apps/rails2_test_app/config/environments/production.rb
198
- - spec/test_apps/rails2_test_app/config/environments/test.rb
199
- - spec/test_apps/rails2_test_app/config/initializers/backtrace_silencers.rb
200
- - spec/test_apps/rails2_test_app/config/initializers/inflections.rb
201
- - spec/test_apps/rails2_test_app/config/initializers/mime_types.rb
202
- - spec/test_apps/rails2_test_app/config/initializers/new_rails_defaults.rb
203
- - spec/test_apps/rails2_test_app/config/initializers/session_store.rb
204
- - spec/test_apps/rails2_test_app/config/locales/en.yml
205
- - spec/test_apps/rails2_test_app/config/routes.rb
206
- - spec/test_apps/rails2_test_app/db/development.sqlite3
207
- - spec/test_apps/rails2_test_app/db/migrate/20100512073155_create_posts.rb
208
- - spec/test_apps/rails2_test_app/db/schema.rb
209
- - spec/test_apps/rails2_test_app/db/seeds.rb
210
- - spec/test_apps/rails2_test_app/doc/README_FOR_APP
211
- - spec/test_apps/rails2_test_app/log/development.log
212
- - spec/test_apps/rails2_test_app/log/production.log
213
- - spec/test_apps/rails2_test_app/log/server.log
214
- - spec/test_apps/rails2_test_app/log/test.log
215
- - spec/test_apps/rails2_test_app/public/404.html
216
- - spec/test_apps/rails2_test_app/public/422.html
217
- - spec/test_apps/rails2_test_app/public/500.html
218
- - spec/test_apps/rails2_test_app/public/favicon.ico
219
- - spec/test_apps/rails2_test_app/public/images/rails.png
220
- - spec/test_apps/rails2_test_app/public/index.html
221
- - spec/test_apps/rails2_test_app/public/javascripts/application.js
222
- - spec/test_apps/rails2_test_app/public/javascripts/controls.js
223
- - spec/test_apps/rails2_test_app/public/javascripts/dragdrop.js
224
- - spec/test_apps/rails2_test_app/public/javascripts/effects.js
225
- - spec/test_apps/rails2_test_app/public/javascripts/prototype.js
226
- - spec/test_apps/rails2_test_app/public/robots.txt
227
- - spec/test_apps/rails2_test_app/public/stylesheets/1.css
228
- - spec/test_apps/rails2_test_app/public/stylesheets/scaffold.css
229
- - spec/test_apps/rails2_test_app/Rakefile
230
- - spec/test_apps/rails2_test_app/README
231
- - spec/test_apps/rails2_test_app/script/about
232
- - spec/test_apps/rails2_test_app/script/console
233
- - spec/test_apps/rails2_test_app/script/dbconsole
234
- - spec/test_apps/rails2_test_app/script/destroy
235
- - spec/test_apps/rails2_test_app/script/generate
236
- - spec/test_apps/rails2_test_app/script/performance/benchmarker
237
- - spec/test_apps/rails2_test_app/script/performance/profiler
238
- - spec/test_apps/rails2_test_app/script/plugin
239
- - spec/test_apps/rails2_test_app/script/runner
240
- - spec/test_apps/rails2_test_app/script/server
241
- - spec/test_apps/rails2_test_app/test/fixtures/posts.yml
242
- - spec/test_apps/rails2_test_app/test/functional/posts_controller_test.rb
243
- - spec/test_apps/rails2_test_app/test/performance/browsing_test.rb
244
- - spec/test_apps/rails2_test_app/test/test_helper.rb
245
- - spec/test_apps/rails2_test_app/test/unit/helpers/posts_helper_test.rb
246
- - spec/test_apps/rails2_test_app/test/unit/post_test.rb
247
- - spec/test_apps/rails3_test_app/app/controllers/application_controller.rb
248
- - spec/test_apps/rails3_test_app/app/controllers/posts_controller.rb
249
- - spec/test_apps/rails3_test_app/app/helpers/application_helper.rb
250
- - spec/test_apps/rails3_test_app/app/helpers/posts_helper.rb
251
- - spec/test_apps/rails3_test_app/app/models/post.rb
252
- - spec/test_apps/rails3_test_app/app/views/layouts/application.html.erb
253
- - spec/test_apps/rails3_test_app/app/views/posts/edit.html.erb
254
- - spec/test_apps/rails3_test_app/app/views/posts/index.html.erb
255
- - spec/test_apps/rails3_test_app/app/views/posts/new.html.erb
256
- - spec/test_apps/rails3_test_app/app/views/posts/show.html.erb
257
- - spec/test_apps/rails3_test_app/app/views/posts/_form.html.erb
258
- - spec/test_apps/rails3_test_app/config/application.rb
259
- - spec/test_apps/rails3_test_app/config/boot.rb
260
- - spec/test_apps/rails3_test_app/config/database.yml
261
- - spec/test_apps/rails3_test_app/config/environment.rb
262
- - spec/test_apps/rails3_test_app/config/environments/development.rb
263
- - spec/test_apps/rails3_test_app/config/environments/production.rb
264
- - spec/test_apps/rails3_test_app/config/environments/test.rb
265
- - spec/test_apps/rails3_test_app/config/initializers/backtrace_silencers.rb
266
- - spec/test_apps/rails3_test_app/config/initializers/inflections.rb
267
- - spec/test_apps/rails3_test_app/config/initializers/mime_types.rb
268
- - spec/test_apps/rails3_test_app/config/initializers/secret_token.rb
269
- - spec/test_apps/rails3_test_app/config/initializers/session_store.rb
270
- - spec/test_apps/rails3_test_app/config/locales/en.yml
271
- - spec/test_apps/rails3_test_app/config/routes.rb
272
- - spec/test_apps/rails3_test_app/config.ru
273
- - spec/test_apps/rails3_test_app/db/development.sqlite3
274
- - spec/test_apps/rails3_test_app/db/migrate/20100512075428_create_posts.rb
275
- - spec/test_apps/rails3_test_app/db/schema.rb
276
- - spec/test_apps/rails3_test_app/db/seeds.rb
277
- - spec/test_apps/rails3_test_app/doc/README_FOR_APP
278
- - spec/test_apps/rails3_test_app/Gemfile
279
- - spec/test_apps/rails3_test_app/log/development.log
280
- - spec/test_apps/rails3_test_app/log/production.log
281
- - spec/test_apps/rails3_test_app/log/server.log
282
- - spec/test_apps/rails3_test_app/log/test.log
283
- - spec/test_apps/rails3_test_app/public/404.html
284
- - spec/test_apps/rails3_test_app/public/422.html
285
- - spec/test_apps/rails3_test_app/public/500.html
286
- - spec/test_apps/rails3_test_app/public/favicon.ico
287
- - spec/test_apps/rails3_test_app/public/images/rails.png
288
- - spec/test_apps/rails3_test_app/public/index.html
289
- - spec/test_apps/rails3_test_app/public/javascripts/application.js
290
- - spec/test_apps/rails3_test_app/public/javascripts/controls.js
291
- - spec/test_apps/rails3_test_app/public/javascripts/dragdrop.js
292
- - spec/test_apps/rails3_test_app/public/javascripts/effects.js
293
- - spec/test_apps/rails3_test_app/public/javascripts/prototype.js
294
- - spec/test_apps/rails3_test_app/public/javascripts/rails.js
295
- - spec/test_apps/rails3_test_app/public/robots.txt
296
- - spec/test_apps/rails3_test_app/public/stylesheets/scaffold.css
297
- - spec/test_apps/rails3_test_app/Rakefile
298
- - spec/test_apps/rails3_test_app/README
299
- - spec/test_apps/rails3_test_app/script/rails
300
- - spec/test_apps/rails3_test_app/test/fixtures/posts.yml
301
- - spec/test_apps/rails3_test_app/test/functional/posts_controller_test.rb
302
- - spec/test_apps/rails3_test_app/test/performance/browsing_test.rb
303
- - spec/test_apps/rails3_test_app/test/test_helper.rb
304
- - spec/test_apps/rails3_test_app/test/unit/helpers/posts_helper_test.rb
305
- - spec/test_apps/rails3_test_app/test/unit/post_test.rb
306
183
  - reflexive.gemspec
307
184
  - Rakefile
308
185
  - Gemfile
@@ -1,243 +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" templates
7
- that are primarily responsible for inserting pre-built data in between HTML tags.
8
- The model contains the "smart" domain objects (such as Account, Product, Person,
9
- Post) that holds all the business logic and knows how to persist themselves to
10
- a database. The controller handles the incoming requests (such as Save New Account,
11
- Update Product, Show Post) by manipulating the model and directing data to the view.
12
-
13
- In Rails, the model is handled by what's called an object-relational mapping
14
- layer entitled Active Record. This layer allows you to present the data from
15
- database rows as objects and embellish these data objects with business logic
16
- methods. You can read more about Active Record in
17
- link:files/vendor/rails/activerecord/README.html.
18
-
19
- The controller and view are handled by the Action Pack, which handles both
20
- layers by its two parts: Action View and Action Controller. These two layers
21
- are bundled in a single package due to their heavy interdependence. This is
22
- unlike the relationship between the Active Record and Action Pack that is much
23
- more separate. Each of these packages can be used independently outside of
24
- Rails. You can read more about Action Pack in
25
- link:files/vendor/rails/actionpack/README.html.
26
-
27
-
28
- == Getting Started
29
-
30
- 1. At the command prompt, start a new Rails application using the <tt>rails</tt> command
31
- and your application name. Ex: rails myapp
32
- 2. Change directory into myapp and start the web server: <tt>script/server</tt> (run with --help for options)
33
- 3. Go to http://localhost:3000/ and get "Welcome aboard: You're riding the Rails!"
34
- 4. Follow the guidelines to start developing your application
35
-
36
-
37
- == Web Servers
38
-
39
- By default, Rails will try to use Mongrel if it's are installed when started with script/server, otherwise Rails will use WEBrick, the webserver that ships with Ruby. But you can also use Rails
40
- with a variety of other web servers.
41
-
42
- Mongrel is a Ruby-based webserver with a C component (which requires compilation) that is
43
- suitable for development and deployment of Rails applications. If you have Ruby Gems installed,
44
- getting up and running with mongrel is as easy as: <tt>gem install mongrel</tt>.
45
- More info at: http://mongrel.rubyforge.org
46
-
47
- Say other Ruby web servers like Thin and Ebb or regular web servers like Apache or LiteSpeed or
48
- Lighttpd or IIS. The Ruby web servers are run through Rack and the latter can either be setup to use
49
- FCGI or proxy to a pack of Mongrels/Thin/Ebb servers.
50
-
51
- == Apache .htaccess example for FCGI/CGI
52
-
53
- # General Apache options
54
- AddHandler fastcgi-script .fcgi
55
- AddHandler cgi-script .cgi
56
- Options +FollowSymLinks +ExecCGI
57
-
58
- # If you don't want Rails to look in certain directories,
59
- # use the following rewrite rules so that Apache won't rewrite certain requests
60
- #
61
- # Example:
62
- # RewriteCond %{REQUEST_URI} ^/notrails.*
63
- # RewriteRule .* - [L]
64
-
65
- # Redirect all requests not available on the filesystem to Rails
66
- # By default the cgi dispatcher is used which is very slow
67
- #
68
- # For better performance replace the dispatcher with the fastcgi one
69
- #
70
- # Example:
71
- # RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
72
- RewriteEngine On
73
-
74
- # If your Rails application is accessed via an Alias directive,
75
- # then you MUST also set the RewriteBase in this htaccess file.
76
- #
77
- # Example:
78
- # Alias /myrailsapp /path/to/myrailsapp/public
79
- # RewriteBase /myrailsapp
80
-
81
- RewriteRule ^$ index.html [QSA]
82
- RewriteRule ^([^.]+)$ $1.html [QSA]
83
- RewriteCond %{REQUEST_FILENAME} !-f
84
- RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
85
-
86
- # In case Rails experiences terminal errors
87
- # Instead of displaying this message you can supply a file here which will be rendered instead
88
- #
89
- # Example:
90
- # ErrorDocument 500 /500.html
91
-
92
- ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
93
-
94
-
95
- == Debugging Rails
96
-
97
- Sometimes your application goes wrong. Fortunately there are a lot of tools that
98
- will help you debug it and get it back on the rails.
99
-
100
- First area to check is the application log files. Have "tail -f" commands running
101
- on the server.log and development.log. Rails will automatically display debugging
102
- and runtime information to these files. Debugging info will also be shown in the
103
- browser on requests from 127.0.0.1.
104
-
105
- You can also log your own messages directly into the log file from your code using
106
- the Ruby logger class from inside your controllers. Example:
107
-
108
- class WeblogController < ActionController::Base
109
- def destroy
110
- @weblog = Weblog.find(params[:id])
111
- @weblog.destroy
112
- logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
113
- end
114
- end
115
-
116
- The result will be a message in your log file along the lines of:
117
-
118
- Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1
119
-
120
- More information on how to use the logger is at http://www.ruby-doc.org/core/
121
-
122
- Also, Ruby documentation can be found at http://www.ruby-lang.org/ including:
123
-
124
- * The Learning Ruby (Pickaxe) Book: http://www.ruby-doc.org/docs/ProgrammingRuby/
125
- * Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
126
-
127
- These two online (and free) books will bring you up to speed on the Ruby language
128
- and also on programming in general.
129
-
130
-
131
- == Debugger
132
-
133
- Debugger support is available through the debugger command when you start your Mongrel or
134
- Webrick server with --debugger. This means that you can break out of execution at any point
135
- in the code, investigate and change the model, AND then resume execution!
136
- You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
137
- Example:
138
-
139
- class WeblogController < ActionController::Base
140
- def index
141
- @posts = Post.find(:all)
142
- debugger
143
- end
144
- end
145
-
146
- So the controller will accept the action, run the first line, then present you
147
- with a IRB prompt in the server window. Here you can do things like:
148
-
149
- >> @posts.inspect
150
- => "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
151
- #<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
152
- >> @posts.first.title = "hello from a debugger"
153
- => "hello from a debugger"
154
-
155
- ...and even better is that you can examine how your runtime objects actually work:
156
-
157
- >> f = @posts.first
158
- => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
159
- >> f.
160
- Display all 152 possibilities? (y or n)
161
-
162
- Finally, when you're ready to resume execution, you enter "cont"
163
-
164
-
165
- == Console
166
-
167
- You can interact with the domain model by starting the console through <tt>script/console</tt>.
168
- Here you'll have all parts of the application configured, just like it is when the
169
- application is running. You can inspect domain models, change values, and save to the
170
- database. Starting the script without arguments will launch it in the development environment.
171
- Passing an argument will specify a different environment, like <tt>script/console production</tt>.
172
-
173
- To reload your controllers and models after launching the console run <tt>reload!</tt>
174
-
175
- == dbconsole
176
-
177
- You can go to the command line of your database directly through <tt>script/dbconsole</tt>.
178
- You would be connected to the database with the credentials defined in database.yml.
179
- Starting the script without arguments will connect you to the development database. Passing an
180
- argument will connect you to a different database, like <tt>script/dbconsole production</tt>.
181
- Currently works for mysql, postgresql and sqlite.
182
-
183
- == Description of Contents
184
-
185
- app
186
- Holds all the code that's specific to this particular application.
187
-
188
- app/controllers
189
- Holds controllers that should be named like weblogs_controller.rb for
190
- automated URL mapping. All controllers should descend from ApplicationController
191
- which itself descends from ActionController::Base.
192
-
193
- app/models
194
- Holds models that should be named like post.rb.
195
- Most models will descend from ActiveRecord::Base.
196
-
197
- app/views
198
- Holds the template files for the view that should be named like
199
- weblogs/index.html.erb for the WeblogsController#index action. All views use eRuby
200
- syntax.
201
-
202
- app/views/layouts
203
- Holds the template files for layouts to be used with views. This models the common
204
- header/footer method of wrapping views. In your views, define a layout using the
205
- <tt>layout :default</tt> and create a file named default.html.erb. Inside default.html.erb,
206
- call <% yield %> to render the view using this layout.
207
-
208
- app/helpers
209
- Holds view helpers that should be named like weblogs_helper.rb. These are generated
210
- for you automatically when using script/generate for controllers. Helpers can be used to
211
- wrap functionality for your views into methods.
212
-
213
- config
214
- Configuration files for the Rails environment, the routing map, the database, and other dependencies.
215
-
216
- db
217
- Contains the database schema in schema.rb. db/migrate contains all
218
- the sequence of Migrations for your schema.
219
-
220
- doc
221
- This directory is where your application documentation will be stored when generated
222
- using <tt>rake doc:app</tt>
223
-
224
- lib
225
- Application specific libraries. Basically, any kind of custom code that doesn't
226
- belong under controllers, models, or helpers. This directory is in the load path.
227
-
228
- public
229
- The directory available for the web server. Contains subdirectories for images, stylesheets,
230
- and javascripts. Also contains the dispatchers and the default HTML files. This should be
231
- set as the DOCUMENT_ROOT of your web server.
232
-
233
- script
234
- Helper scripts for automation and generation.
235
-
236
- test
237
- Unit and functional tests along with fixtures. When using the script/generate scripts, template
238
- test files will be generated for you and placed in this directory.
239
-
240
- vendor
241
- External libraries that the application depends on. Also includes the plugins subdirectory.
242
- If the app has frozen rails, those gems also go here, under vendor/rails/.
243
- This directory is in the load path.
@@ -1,10 +0,0 @@
1
- # Add your own tasks in files placed in lib/tasks ending in .rake,
2
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
-
4
- require(File.join(File.dirname(__FILE__), 'config', 'boot'))
5
-
6
- require 'rake'
7
- require 'rake/testtask'
8
- require 'rake/rdoctask'
9
-
10
- require 'tasks/rails'
@@ -1,10 +0,0 @@
1
- # Filters added to this controller apply to all controllers in the application.
2
- # Likewise, all the methods added will be available for all controllers.
3
-
4
- class ApplicationController < ActionController::Base
5
- helper :all # include all helpers, all the time
6
- protect_from_forgery # See ActionController::RequestForgeryProtection for details
7
-
8
- # Scrub sensitive parameters from your log
9
- # filter_parameter_logging :password
10
- end
@@ -1,85 +0,0 @@
1
- class PostsController < ApplicationController
2
- # GET /posts
3
- # GET /posts.xml
4
- def index
5
- @posts = Post.all
6
-
7
- respond_to do |format|
8
- format.html # index.html.erb
9
- format.xml { render :xml => @posts }
10
- end
11
- end
12
-
13
- # GET /posts/1
14
- # GET /posts/1.xml
15
- def show
16
- @post = Post.find(params[:id])
17
-
18
- respond_to do |format|
19
- format.html # show.html.erb
20
- format.xml { render :xml => @post }
21
- end
22
- end
23
-
24
- # GET /posts/new
25
- # GET /posts/new.xml
26
- def new
27
- @post = Post.new
28
-
29
- respond_to do |format|
30
- format.html # new.html.erb
31
- format.xml { render :xml => @post }
32
- end
33
- end
34
-
35
- # GET /posts/1/edit
36
- def edit
37
- @post = Post.find(params[:id])
38
- end
39
-
40
- # POST /posts
41
- # POST /posts.xml
42
- def create
43
- @post = Post.new(params[:post])
44
-
45
- respond_to do |format|
46
- if @post.save
47
- flash[:notice] = 'Post was successfully created.'
48
- format.html { redirect_to(@post) }
49
- format.xml { render :xml => @post, :status => :created, :location => @post }
50
- else
51
- format.html { render :action => "new" }
52
- format.xml { render :xml => @post.errors, :status => :unprocessable_entity }
53
- end
54
- end
55
- end
56
-
57
- # PUT /posts/1
58
- # PUT /posts/1.xml
59
- def update
60
- @post = Post.find(params[:id])
61
-
62
- respond_to do |format|
63
- if @post.update_attributes(params[:post])
64
- flash[:notice] = 'Post was successfully updated.'
65
- format.html { redirect_to(@post) }
66
- format.xml { head :ok }
67
- else
68
- format.html { render :action => "edit" }
69
- format.xml { render :xml => @post.errors, :status => :unprocessable_entity }
70
- end
71
- end
72
- end
73
-
74
- # DELETE /posts/1
75
- # DELETE /posts/1.xml
76
- def destroy
77
- @post = Post.find(params[:id])
78
- @post.destroy
79
-
80
- respond_to do |format|
81
- format.html { redirect_to(posts_url) }
82
- format.xml { head :ok }
83
- end
84
- end
85
- end
@@ -1,3 +0,0 @@
1
- # Methods added to this helper will be available to all templates in the application.
2
- module ApplicationHelper
3
- end
@@ -1,2 +0,0 @@
1
- module PostsHelper
2
- end
@@ -1,5 +0,0 @@
1
- class Post < ActiveRecord::Base
2
- def test
3
- 42
4
- end
5
- end
@@ -1,17 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
-
4
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
- <head>
6
- <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
7
- <title>Posts: <%= controller.action_name %></title>
8
- <%= stylesheet_link_tag 'scaffold' %>
9
- </head>
10
- <body>
11
-
12
- <p style="color: green"><%= flash[:notice] %></p>
13
-
14
- <%= yield %>
15
-
16
- </body>
17
- </html>
@@ -1,12 +0,0 @@
1
- <h1>Editing post</h1>
2
-
3
- <% form_for(@post) do |f| %>
4
- <%= f.error_messages %>
5
-
6
- <p>
7
- <%= f.submit 'Update' %>
8
- </p>
9
- <% end %>
10
-
11
- <%= link_to 'Show', @post %> |
12
- <%= link_to 'Back', posts_path %>
@@ -1,18 +0,0 @@
1
- <h1>Listing posts</h1>
2
-
3
- <table>
4
- <tr>
5
- </tr>
6
-
7
- <% @posts.each do |post| %>
8
- <tr>
9
- <td><%= link_to 'Show', post %></td>
10
- <td><%= link_to 'Edit', edit_post_path(post) %></td>
11
- <td><%= link_to 'Destroy', post, :confirm => 'Are you sure?', :method => :delete %></td>
12
- </tr>
13
- <% end %>
14
- </table>
15
-
16
- <br />
17
-
18
- <%= link_to 'New post', new_post_path %>
@@ -1,11 +0,0 @@
1
- <h1>New post</h1>
2
-
3
- <% form_for(@post) do |f| %>
4
- <%= f.error_messages %>
5
-
6
- <p>
7
- <%= f.submit 'Create' %>
8
- </p>
9
- <% end %>
10
-
11
- <%= link_to 'Back', posts_path %>
@@ -1,3 +0,0 @@
1
-
2
- <%= link_to 'Edit', edit_post_path(@post) %> |
3
- <%= link_to 'Back', posts_path %>