nubis_rails_boilerplate 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. data/bin/new_real_estate_app +2 -1
  2. data/skeletons/real_estate_app/Capfile +6 -0
  3. data/skeletons/real_estate_app/Gemfile +61 -0
  4. data/skeletons/real_estate_app/Gemfile.lock +315 -0
  5. data/skeletons/real_estate_app/README.rdoc +261 -0
  6. data/skeletons/real_estate_app/Rakefile +7 -0
  7. data/skeletons/real_estate_app/app/admin/admin_user.rb +20 -0
  8. data/skeletons/real_estate_app/app/admin/dashboard.rb +33 -0
  9. data/skeletons/real_estate_app/app/admin/neighborhood.rb +22 -0
  10. data/skeletons/real_estate_app/app/admin/property.rb +49 -0
  11. data/skeletons/real_estate_app/app/assets/images/rails.png +0 -0
  12. data/skeletons/real_estate_app/app/assets/javascripts/active_admin.js +1 -0
  13. data/skeletons/real_estate_app/app/assets/javascripts/application.js +15 -0
  14. data/skeletons/real_estate_app/app/assets/stylesheets/active_admin.css.scss +4 -0
  15. data/skeletons/real_estate_app/app/assets/stylesheets/application.css.scss +4 -0
  16. data/skeletons/real_estate_app/app/assets/stylesheets/main.css.scss +3 -0
  17. data/skeletons/real_estate_app/app/controllers/application_controller.rb +3 -0
  18. data/skeletons/real_estate_app/app/controllers/neighborhoods_controller.rb +9 -0
  19. data/skeletons/real_estate_app/app/controllers/pages_controller.rb +16 -0
  20. data/skeletons/real_estate_app/app/controllers/properties_controller.rb +9 -0
  21. data/skeletons/real_estate_app/app/helpers/application_helper.rb +2 -0
  22. data/skeletons/real_estate_app/app/models/admin_user.rb +11 -0
  23. data/skeletons/real_estate_app/app/models/image.rb +7 -0
  24. data/skeletons/real_estate_app/app/models/neighborhood.rb +6 -0
  25. data/skeletons/real_estate_app/app/models/property.rb +7 -0
  26. data/skeletons/real_estate_app/app/models/settings.rb +3 -0
  27. data/skeletons/real_estate_app/app/views/layouts/_navigation.html.haml +9 -0
  28. data/skeletons/real_estate_app/app/views/layouts/application.html.haml +38 -0
  29. data/skeletons/real_estate_app/app/views/neighborhoods/index.html.haml +12 -0
  30. data/skeletons/real_estate_app/app/views/neighborhoods/show.html.haml +12 -0
  31. data/skeletons/real_estate_app/app/views/pages/about_us.html.haml +5 -0
  32. data/skeletons/real_estate_app/app/views/pages/contact_us.html.haml +5 -0
  33. data/skeletons/real_estate_app/app/views/pages/home.html.haml +5 -0
  34. data/skeletons/real_estate_app/app/views/pages/privacy_policy.html.haml +5 -0
  35. data/skeletons/real_estate_app/app/views/pages/terms_of_service.html.haml +5 -0
  36. data/skeletons/real_estate_app/app/views/properties/index.html.haml +12 -0
  37. data/skeletons/real_estate_app/app/views/properties/show.html.haml +4 -0
  38. data/skeletons/real_estate_app/config/application.rb +62 -0
  39. data/skeletons/real_estate_app/config/boot.rb +6 -0
  40. data/skeletons/real_estate_app/config/database.yml +42 -0
  41. data/skeletons/real_estate_app/config/deploy.rb +3 -0
  42. data/skeletons/real_estate_app/config/deploy.yml +26 -0
  43. data/skeletons/real_estate_app/config/environment.rb +5 -0
  44. data/skeletons/real_estate_app/config/environments/development.rb +39 -0
  45. data/skeletons/real_estate_app/config/environments/production.rb +92 -0
  46. data/skeletons/real_estate_app/config/environments/test.rb +37 -0
  47. data/skeletons/real_estate_app/config/initializers/active_admin.rb +152 -0
  48. data/skeletons/real_estate_app/config/initializers/backtrace_silencers.rb +7 -0
  49. data/skeletons/real_estate_app/config/initializers/devise.rb +240 -0
  50. data/skeletons/real_estate_app/config/initializers/inflections.rb +15 -0
  51. data/skeletons/real_estate_app/config/initializers/mime_types.rb +5 -0
  52. data/skeletons/real_estate_app/config/initializers/secret_token.rb +7 -0
  53. data/skeletons/real_estate_app/config/initializers/session_store.rb +8 -0
  54. data/skeletons/real_estate_app/config/initializers/wrap_parameters.rb +14 -0
  55. data/skeletons/real_estate_app/config/locales/devise.en.yml +59 -0
  56. data/skeletons/real_estate_app/config/locales/en.yml +5 -0
  57. data/skeletons/real_estate_app/config/routes.rb +71 -0
  58. data/skeletons/real_estate_app/config.ru +4 -0
  59. data/skeletons/real_estate_app/db/migrate/20130209155748_devise_create_admin_users.rb +52 -0
  60. data/skeletons/real_estate_app/db/migrate/20130209155756_create_admin_notes.rb +17 -0
  61. data/skeletons/real_estate_app/db/migrate/20130209155757_move_admin_notes_to_comments.rb +26 -0
  62. data/skeletons/real_estate_app/db/migrate/20130209160552_initial_tables.rb +42 -0
  63. data/skeletons/real_estate_app/db/schema.rb +103 -0
  64. data/skeletons/real_estate_app/db/seeds.rb +7 -0
  65. data/skeletons/real_estate_app/doc/README_FOR_APP +2 -0
  66. data/skeletons/real_estate_app/public/404.html +26 -0
  67. data/skeletons/real_estate_app/public/422.html +26 -0
  68. data/skeletons/real_estate_app/public/500.html +25 -0
  69. data/skeletons/real_estate_app/public/favicon.ico +0 -0
  70. data/skeletons/real_estate_app/public/robots.txt +5 -0
  71. data/skeletons/real_estate_app/script/rails +6 -0
  72. data/skeletons/real_estate_app/spec/controllers/admin/admin_users_controller_spec.rb +11 -0
  73. data/skeletons/real_estate_app/spec/controllers/admin/neighborhoods_controller_spec.rb +12 -0
  74. data/skeletons/real_estate_app/spec/controllers/admin/properties_controller_spec.rb +12 -0
  75. data/skeletons/real_estate_app/spec/controllers/neighborhoods_controller_spec.rb +19 -0
  76. data/skeletons/real_estate_app/spec/controllers/pages_controller_spec.rb +31 -0
  77. data/skeletons/real_estate_app/spec/controllers/properties_controller_spec.rb +19 -0
  78. data/skeletons/real_estate_app/spec/factories/admin_users.rb +8 -0
  79. data/skeletons/real_estate_app/spec/factories/neigborhoods.rb +16 -0
  80. data/skeletons/real_estate_app/spec/factories/properties.rb +28 -0
  81. data/skeletons/real_estate_app/spec/fixtures/image.jpg +0 -0
  82. data/skeletons/real_estate_app/spec/models/admin_user_spec.rb +5 -0
  83. data/skeletons/real_estate_app/spec/models/image_spec.rb +10 -0
  84. data/skeletons/real_estate_app/spec/models/property_spec.rb +7 -0
  85. data/skeletons/real_estate_app/spec/spec_helper.rb +22 -0
  86. data/skeletons/real_estate_app/test/performance/browsing_test.rb +12 -0
  87. data/skeletons/real_estate_app/test/test_helper.rb +13 -0
  88. metadata +95 -9
@@ -1,3 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- require_relative '../lib/templates'
2
+ debugger
3
+ require_relative File.expand_path('../lib/templates', __FILE__)
3
4
  NubisRailsBoilerplate::Templates.expand_skeleton('real_estate_app', __FILE__)
@@ -0,0 +1,6 @@
1
+ load 'deploy'
2
+ load 'deploy/assets'
3
+ Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each do |plugin|
4
+ load(plugin)
5
+ end
6
+ load 'config/deploy'
@@ -0,0 +1,61 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rails', '3.2.11'
4
+
5
+ # Bundle edge Rails instead:
6
+ # gem 'rails', :git => 'git://github.com/rails/rails.git'
7
+
8
+ gem 'mysql2'
9
+
10
+ gem 'sass-rails', '~> 3.2.3'
11
+ gem 'compass-rails'
12
+ gem 'font-awesome-sass-rails'
13
+
14
+ # Gems used only for assets and not required
15
+ # in production environments by default.
16
+ group :assets do
17
+ gem 'coffee-rails', '~> 3.2.1'
18
+
19
+ # See https://github.com/sstephenson/execjs#readme for more supported runtimes
20
+ # gem 'therubyracer', :platforms => :ruby
21
+
22
+ gem 'uglifier', '>= 1.0.3'
23
+ end
24
+
25
+ group :development, :test do
26
+ gem "rspec-rails", ">= 2.11.0"
27
+ gem "factory_girl_rails", ">= 4.1.0"
28
+ gem "quiet_assets", ">= 1.0.1"
29
+ gem 'debugger'
30
+ end
31
+
32
+ group :development do
33
+ gem "haml-rails", ">= 0.3.5"
34
+ gem "hpricot", ">= 0.8.6"
35
+ gem "ruby_parser", ">= 2.3.1"
36
+ gem 'letter_opener'
37
+ end
38
+
39
+ group :test do
40
+ gem "email_spec", ">= 1.2.1"
41
+ gem "capybara"
42
+ gem 'capybara-webkit', '0.12.0'
43
+ gem 'shoulda-matchers'
44
+ end
45
+
46
+ gem 'jquery-rails'
47
+
48
+ gem 'settingslogic'
49
+ gem 'unicorn'
50
+ gem 'capistrano'
51
+ gem "bootstrap-sass", ">= 2.1.0.0"
52
+ gem 'haml'
53
+ gem 'jquery-rails'
54
+ gem 'email_validator'
55
+ gem 'exception_notification', git: 'git://github.com/smartinez87/exception_notification.git'
56
+ #gem 'nubis_rails_boilerplate', git: 'git://github.com/nubis/nubis_rails_boilerplate.git'
57
+ gem 'nubis_rails_boilerplate', path: '/Users/nubis/nubis_rails_boilerplate'
58
+ gem "simple_form"
59
+ gem 'activeadmin', '0.5.0'
60
+ gem 'paperclip'
61
+ gem 'kaminari'
@@ -0,0 +1,315 @@
1
+ GIT
2
+ remote: git://github.com/smartinez87/exception_notification.git
3
+ revision: 74811b206704c2a2c86b9647b4573929414f0c43
4
+ specs:
5
+ exception_notification (3.0.1)
6
+ actionmailer (>= 3.0.4)
7
+
8
+ PATH
9
+ remote: /Users/nubis/nubis_rails_boilerplate
10
+ specs:
11
+ nubis_rails_boilerplate (0.0.4)
12
+ activeadmin (= 0.5.0)
13
+ capistrano
14
+ rails (~> 3.2.0)
15
+ settingslogic
16
+
17
+ GEM
18
+ remote: https://rubygems.org/
19
+ specs:
20
+ actionmailer (3.2.11)
21
+ actionpack (= 3.2.11)
22
+ mail (~> 2.4.4)
23
+ actionpack (3.2.11)
24
+ activemodel (= 3.2.11)
25
+ activesupport (= 3.2.11)
26
+ builder (~> 3.0.0)
27
+ erubis (~> 2.7.0)
28
+ journey (~> 1.0.4)
29
+ rack (~> 1.4.0)
30
+ rack-cache (~> 1.2)
31
+ rack-test (~> 0.6.1)
32
+ sprockets (~> 2.2.1)
33
+ activeadmin (0.5.0)
34
+ arbre (>= 1.0.1)
35
+ bourbon (>= 1.0.0)
36
+ devise (>= 1.1.2)
37
+ fastercsv
38
+ formtastic (>= 2.0.0)
39
+ inherited_resources (>= 1.3.1)
40
+ jquery-rails (>= 1.0.0)
41
+ kaminari (>= 0.13.0)
42
+ meta_search (>= 0.9.2)
43
+ rails (>= 3.0.0)
44
+ sass (>= 3.1.0)
45
+ activemodel (3.2.11)
46
+ activesupport (= 3.2.11)
47
+ builder (~> 3.0.0)
48
+ activerecord (3.2.11)
49
+ activemodel (= 3.2.11)
50
+ activesupport (= 3.2.11)
51
+ arel (~> 3.0.2)
52
+ tzinfo (~> 0.3.29)
53
+ activeresource (3.2.11)
54
+ activemodel (= 3.2.11)
55
+ activesupport (= 3.2.11)
56
+ activesupport (3.2.11)
57
+ i18n (~> 0.6)
58
+ multi_json (~> 1.0)
59
+ addressable (2.3.2)
60
+ arbre (1.0.1)
61
+ activesupport (>= 3.0.0)
62
+ arel (3.0.2)
63
+ bcrypt-ruby (3.0.1)
64
+ bootstrap-sass (2.2.2.0)
65
+ sass (~> 3.2)
66
+ bourbon (3.1.0)
67
+ sass (>= 3.2.0)
68
+ thor
69
+ builder (3.0.4)
70
+ capistrano (2.14.2)
71
+ highline
72
+ net-scp (>= 1.0.0)
73
+ net-sftp (>= 2.0.0)
74
+ net-ssh (>= 2.0.14)
75
+ net-ssh-gateway (>= 1.1.0)
76
+ capybara (1.1.4)
77
+ mime-types (>= 1.16)
78
+ nokogiri (>= 1.3.3)
79
+ rack (>= 1.0.0)
80
+ rack-test (>= 0.5.4)
81
+ selenium-webdriver (~> 2.0)
82
+ xpath (~> 0.1.4)
83
+ capybara-webkit (0.12.0)
84
+ capybara (>= 1.0.0, < 1.2)
85
+ json
86
+ childprocess (0.3.7)
87
+ ffi (~> 1.0, >= 1.0.6)
88
+ chunky_png (1.2.5)
89
+ cocaine (0.4.2)
90
+ coffee-rails (3.2.2)
91
+ coffee-script (>= 2.2.0)
92
+ railties (~> 3.2.0)
93
+ coffee-script (2.2.0)
94
+ coffee-script-source
95
+ execjs
96
+ coffee-script-source (1.4.0)
97
+ columnize (0.3.6)
98
+ compass (0.12.2)
99
+ chunky_png (~> 1.2)
100
+ fssm (>= 0.2.7)
101
+ sass (~> 3.1)
102
+ compass-rails (1.0.3)
103
+ compass (>= 0.12.2, < 0.14)
104
+ debugger (1.3.1)
105
+ columnize (>= 0.3.1)
106
+ debugger-linecache (~> 1.1.1)
107
+ debugger-ruby_core_source (~> 1.1.8)
108
+ debugger-linecache (1.1.2)
109
+ debugger-ruby_core_source (>= 1.1.1)
110
+ debugger-ruby_core_source (1.1.8)
111
+ devise (2.2.3)
112
+ bcrypt-ruby (~> 3.0)
113
+ orm_adapter (~> 0.1)
114
+ railties (~> 3.1)
115
+ warden (~> 1.2.1)
116
+ diff-lcs (1.1.3)
117
+ email_spec (1.4.0)
118
+ launchy (~> 2.1)
119
+ mail (~> 2.2)
120
+ email_validator (1.3.0)
121
+ activemodel
122
+ erubis (2.7.0)
123
+ execjs (1.4.0)
124
+ multi_json (~> 1.0)
125
+ factory_girl (4.2.0)
126
+ activesupport (>= 3.0.0)
127
+ factory_girl_rails (4.2.1)
128
+ factory_girl (~> 4.2.0)
129
+ railties (>= 3.0.0)
130
+ fastercsv (1.5.5)
131
+ ffi (1.3.1)
132
+ font-awesome-sass-rails (2.0.0.0)
133
+ railties (>= 3.1.1)
134
+ sass-rails (>= 3.1.1)
135
+ formtastic (2.2.1)
136
+ actionpack (>= 3.0)
137
+ fssm (0.2.9)
138
+ haml (3.1.7)
139
+ haml-rails (0.3.5)
140
+ actionpack (>= 3.1, < 4.1)
141
+ activesupport (>= 3.1, < 4.1)
142
+ haml (~> 3.1)
143
+ railties (>= 3.1, < 4.1)
144
+ has_scope (0.5.1)
145
+ highline (1.6.15)
146
+ hike (1.2.1)
147
+ hpricot (0.8.6)
148
+ i18n (0.6.1)
149
+ inherited_resources (1.3.1)
150
+ has_scope (~> 0.5.0)
151
+ responders (~> 0.6)
152
+ journey (1.0.4)
153
+ jquery-rails (2.2.1)
154
+ railties (>= 3.0, < 5.0)
155
+ thor (>= 0.14, < 2.0)
156
+ json (1.7.6)
157
+ kaminari (0.14.1)
158
+ actionpack (>= 3.0.0)
159
+ activesupport (>= 3.0.0)
160
+ kgio (2.8.0)
161
+ launchy (2.2.0)
162
+ addressable (~> 2.3)
163
+ letter_opener (1.0.0)
164
+ launchy (>= 2.0.4)
165
+ mail (2.4.4)
166
+ i18n (>= 0.4.0)
167
+ mime-types (~> 1.16)
168
+ treetop (~> 1.4.8)
169
+ meta_search (1.1.3)
170
+ actionpack (~> 3.1)
171
+ activerecord (~> 3.1)
172
+ activesupport (~> 3.1)
173
+ polyamorous (~> 0.5.0)
174
+ mime-types (1.20.1)
175
+ multi_json (1.5.0)
176
+ mysql2 (0.3.11)
177
+ net-scp (1.1.0)
178
+ net-ssh (>= 2.6.5)
179
+ net-sftp (2.1.1)
180
+ net-ssh (>= 2.6.5)
181
+ net-ssh (2.6.5)
182
+ net-ssh-gateway (1.2.0)
183
+ net-ssh (>= 2.6.5)
184
+ nokogiri (1.5.6)
185
+ orm_adapter (0.4.0)
186
+ paperclip (3.4.0)
187
+ activemodel (>= 3.0.0)
188
+ activerecord (>= 3.0.0)
189
+ activesupport (>= 3.0.0)
190
+ cocaine (~> 0.4.0)
191
+ mime-types
192
+ polyamorous (0.5.0)
193
+ activerecord (~> 3.0)
194
+ polyglot (0.3.3)
195
+ quiet_assets (1.0.1)
196
+ railties (~> 3.1)
197
+ rack (1.4.5)
198
+ rack-cache (1.2)
199
+ rack (>= 0.4)
200
+ rack-ssl (1.3.3)
201
+ rack
202
+ rack-test (0.6.2)
203
+ rack (>= 1.0)
204
+ rails (3.2.11)
205
+ actionmailer (= 3.2.11)
206
+ actionpack (= 3.2.11)
207
+ activerecord (= 3.2.11)
208
+ activeresource (= 3.2.11)
209
+ activesupport (= 3.2.11)
210
+ bundler (~> 1.0)
211
+ railties (= 3.2.11)
212
+ railties (3.2.11)
213
+ actionpack (= 3.2.11)
214
+ activesupport (= 3.2.11)
215
+ rack-ssl (~> 1.3.2)
216
+ rake (>= 0.8.7)
217
+ rdoc (~> 3.4)
218
+ thor (>= 0.14.6, < 2.0)
219
+ raindrops (0.10.0)
220
+ rake (10.0.3)
221
+ rdoc (3.12.1)
222
+ json (~> 1.4)
223
+ responders (0.9.3)
224
+ railties (~> 3.1)
225
+ rspec-core (2.12.2)
226
+ rspec-expectations (2.12.1)
227
+ diff-lcs (~> 1.1.3)
228
+ rspec-mocks (2.12.2)
229
+ rspec-rails (2.12.2)
230
+ actionpack (>= 3.0)
231
+ activesupport (>= 3.0)
232
+ railties (>= 3.0)
233
+ rspec-core (~> 2.12.0)
234
+ rspec-expectations (~> 2.12.0)
235
+ rspec-mocks (~> 2.12.0)
236
+ ruby_parser (3.1.1)
237
+ sexp_processor (~> 4.1)
238
+ rubyzip (0.9.9)
239
+ sass (3.2.5)
240
+ sass-rails (3.2.6)
241
+ railties (~> 3.2.0)
242
+ sass (>= 3.1.10)
243
+ tilt (~> 1.3)
244
+ selenium-webdriver (2.29.0)
245
+ childprocess (>= 0.2.5)
246
+ multi_json (~> 1.0)
247
+ rubyzip
248
+ websocket (~> 1.0.4)
249
+ settingslogic (2.0.9)
250
+ sexp_processor (4.1.4)
251
+ shoulda-matchers (1.4.1)
252
+ activesupport (>= 3.0.0)
253
+ simple_form (2.0.4)
254
+ actionpack (~> 3.0)
255
+ activemodel (~> 3.0)
256
+ sprockets (2.2.2)
257
+ hike (~> 1.2)
258
+ multi_json (~> 1.0)
259
+ rack (~> 1.0)
260
+ tilt (~> 1.1, != 1.3.0)
261
+ thor (0.17.0)
262
+ tilt (1.3.3)
263
+ treetop (1.4.12)
264
+ polyglot
265
+ polyglot (>= 0.3.1)
266
+ tzinfo (0.3.35)
267
+ uglifier (1.3.0)
268
+ execjs (>= 0.3.0)
269
+ multi_json (~> 1.0, >= 1.0.2)
270
+ unicorn (4.6.0)
271
+ kgio (~> 2.6)
272
+ rack
273
+ raindrops (~> 0.7)
274
+ warden (1.2.1)
275
+ rack (>= 1.0)
276
+ websocket (1.0.7)
277
+ xpath (0.1.4)
278
+ nokogiri (~> 1.3)
279
+
280
+ PLATFORMS
281
+ ruby
282
+
283
+ DEPENDENCIES
284
+ activeadmin (= 0.5.0)
285
+ bootstrap-sass (>= 2.1.0.0)
286
+ capistrano
287
+ capybara
288
+ capybara-webkit (= 0.12.0)
289
+ coffee-rails (~> 3.2.1)
290
+ compass-rails
291
+ debugger
292
+ email_spec (>= 1.2.1)
293
+ email_validator
294
+ exception_notification!
295
+ factory_girl_rails (>= 4.1.0)
296
+ font-awesome-sass-rails
297
+ haml
298
+ haml-rails (>= 0.3.5)
299
+ hpricot (>= 0.8.6)
300
+ jquery-rails
301
+ kaminari
302
+ letter_opener
303
+ mysql2
304
+ nubis_rails_boilerplate!
305
+ paperclip
306
+ quiet_assets (>= 1.0.1)
307
+ rails (= 3.2.11)
308
+ rspec-rails (>= 2.11.0)
309
+ ruby_parser (>= 2.3.1)
310
+ sass-rails (~> 3.2.3)
311
+ settingslogic
312
+ shoulda-matchers
313
+ simple_form
314
+ uglifier (>= 1.0.3)
315
+ unicorn
@@ -0,0 +1,261 @@
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
+ | `-- tasks
177
+ |-- log
178
+ |-- public
179
+ |-- script
180
+ |-- test
181
+ | |-- fixtures
182
+ | |-- functional
183
+ | |-- integration
184
+ | |-- performance
185
+ | `-- unit
186
+ |-- tmp
187
+ | |-- cache
188
+ | |-- pids
189
+ | |-- sessions
190
+ | `-- sockets
191
+ `-- vendor
192
+ |-- assets
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.
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ RealEstateApp::Application.load_tasks
@@ -0,0 +1,20 @@
1
+ ActiveAdmin.register AdminUser do
2
+ index do
3
+ column :email
4
+ column :current_sign_in_at
5
+ column :last_sign_in_at
6
+ column :sign_in_count
7
+ default_actions
8
+ end
9
+
10
+ filter :email
11
+
12
+ form do |f|
13
+ f.inputs "Admin Details" do
14
+ f.input :email
15
+ f.input :password
16
+ f.input :password_confirmation
17
+ end
18
+ f.actions
19
+ end
20
+ end