tartarus 2.0.4 → 2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +1 -1
- data/Gemfile +7 -7
- data/Gemfile.lock +104 -85
- data/README.rdoc +1 -1
- data/lib/generators/tartarus/templates/app/views/exceptions/details.html.erb +3 -3
- data/lib/tartarus/logger.rb +2 -2
- data/spec/rails_app/.gitignore +15 -4
- data/spec/rails_app/Gemfile +35 -9
- data/spec/rails_app/Gemfile.lock +102 -83
- data/spec/rails_app/Rakefile +1 -1
- data/spec/rails_app/app/assets/javascripts/application.js +15 -0
- data/spec/rails_app/app/assets/stylesheets/application.css +13 -0
- data/spec/rails_app/app/controllers/logged_exceptions_controller.rb +5 -1
- data/spec/rails_app/app/views/layouts/application.html.erb +3 -3
- data/spec/rails_app/app/views/logged_exceptions/details.html.erb +3 -3
- data/spec/rails_app/config/application.rb +26 -7
- data/spec/rails_app/config/boot.rb +3 -10
- data/spec/rails_app/config/database.yml +4 -1
- data/spec/rails_app/config/environments/development.rb +17 -4
- data/spec/rails_app/config/environments/production.rb +31 -13
- data/spec/rails_app/config/environments/test.rb +9 -7
- data/spec/rails_app/config/exceptions.yml +2 -3
- data/spec/rails_app/config/initializers/inflections.rb +5 -0
- data/spec/rails_app/config/initializers/secret_token.rb +1 -1
- data/spec/rails_app/config/initializers/session_store.rb +1 -1
- data/spec/rails_app/config/initializers/wrap_parameters.rb +14 -0
- data/spec/rails_app/config/locales/en.yml +1 -1
- data/spec/rails_app/config/routes.rb +2 -2
- data/spec/rails_app/db/schema.rb +2 -1
- data/spec/rails_app/db/seeds.rb +2 -2
- data/spec/rails_app/public/500.html +0 -1
- data/spec/rails_app/public/index.html +241 -0
- data/spec/rails_app/spec/spec_helper.rb +0 -4
- data/spec/tartarus/logger_spec.rb +9 -3
- data/tartarus.gemspec +3 -4
- metadata +66 -95
- data/lib/tartarus/version.rb +0 -3
- data/spec/rails_app/.rspec +0 -1
- data/spec/rails_app/README +0 -256
- data/spec/rails_app/doc/README_FOR_APP +0 -2
- data/spec/rails_app/public/javascripts/application.js +0 -2
- data/spec/rails_app/public/javascripts/controls.js +0 -965
- data/spec/rails_app/public/javascripts/dragdrop.js +0 -974
- data/spec/rails_app/public/javascripts/effects.js +0 -1123
- data/spec/rails_app/public/javascripts/prototype.js +0 -6001
- data/spec/rails_app/public/javascripts/rails.js +0 -175
- data/spec/rails_app/vendor/plugins/.gitkeep +0 -0
- /data/spec/rails_app/{public → app/assets}/images/rails.png +0 -0
- /data/spec/rails_app/{lib/tasks → app/mailers}/.gitkeep +0 -0
- /data/spec/rails_app/{public/stylesheets → app/models}/.gitkeep +0 -0
- /data/spec/rails_app/db/migrate/{20101230191040_add_logged_exception_table.rb → 20120828161925_add_logged_exception_table.rb} +0 -0
data/tartarus.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = %q{tartarus}
|
3
|
-
s.version = "2.
|
3
|
+
s.version = "2.2"
|
4
4
|
s.platform = Gem::Platform::RUBY
|
5
5
|
|
6
6
|
s.authors = ["Daniel Insley"]
|
@@ -10,13 +10,12 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.homepage = %q{http://github.com/dinsley/tartarus}
|
11
11
|
s.rdoc_options = ["--charset=UTF-8"]
|
12
12
|
s.require_paths = ["lib"]
|
13
|
-
s.rubygems_version = %q{1.3.7}
|
14
13
|
s.summary = %q{Exception Logging for Rails}
|
15
14
|
|
16
15
|
s.files = `git ls-files`.split("\n")
|
17
16
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
17
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
18
|
|
20
|
-
s.add_runtime_dependency(%q<will_paginate
|
21
|
-
s.add_runtime_dependency(%q<json
|
19
|
+
s.add_runtime_dependency(%q<will_paginate>)
|
20
|
+
s.add_runtime_dependency(%q<json>)
|
22
21
|
end
|
metadata
CHANGED
@@ -1,64 +1,56 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: tartarus
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '2.2'
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 2
|
8
|
-
- 0
|
9
|
-
- 4
|
10
|
-
version: 2.0.4
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Daniel Insley
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-08-31 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: will_paginate
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 3
|
31
|
-
- 0
|
32
|
-
- pre
|
33
|
-
- 2
|
34
|
-
version: 3.0.pre2
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
35
22
|
type: :runtime
|
36
|
-
version_requirements: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: json
|
39
23
|
prerelease: false
|
40
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: json
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
41
33
|
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
|
46
|
-
segments:
|
47
|
-
- 1
|
48
|
-
- 5
|
49
|
-
- 1
|
50
|
-
version: 1.5.1
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
51
38
|
type: :runtime
|
52
|
-
|
53
|
-
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
description: Provides exception logging and a generator for creating a clean interface
|
47
|
+
to manage exceptions.
|
54
48
|
email: dinsley@gmail.com
|
55
49
|
executables: []
|
56
|
-
|
57
50
|
extensions: []
|
58
|
-
|
59
|
-
extra_rdoc_files:
|
51
|
+
extra_rdoc_files:
|
60
52
|
- README.rdoc
|
61
|
-
files:
|
53
|
+
files:
|
62
54
|
- .document
|
63
55
|
- .gitignore
|
64
56
|
- .rvmrc
|
@@ -84,16 +76,18 @@ files:
|
|
84
76
|
- lib/tartarus/notifiers/mail.rb
|
85
77
|
- lib/tartarus/rack.rb
|
86
78
|
- lib/tartarus/railtie.rb
|
87
|
-
- lib/tartarus/version.rb
|
88
79
|
- spec/rails_app/.gitignore
|
89
|
-
- spec/rails_app/.rspec
|
90
80
|
- spec/rails_app/Gemfile
|
91
81
|
- spec/rails_app/Gemfile.lock
|
92
|
-
- spec/rails_app/README
|
93
82
|
- spec/rails_app/Rakefile
|
83
|
+
- spec/rails_app/app/assets/images/rails.png
|
84
|
+
- spec/rails_app/app/assets/javascripts/application.js
|
85
|
+
- spec/rails_app/app/assets/stylesheets/application.css
|
94
86
|
- spec/rails_app/app/controllers/application_controller.rb
|
95
87
|
- spec/rails_app/app/controllers/logged_exceptions_controller.rb
|
96
88
|
- spec/rails_app/app/helpers/application_helper.rb
|
89
|
+
- spec/rails_app/app/mailers/.gitkeep
|
90
|
+
- spec/rails_app/app/models/.gitkeep
|
97
91
|
- spec/rails_app/app/models/logged_exception.rb
|
98
92
|
- spec/rails_app/app/views/layouts/application.html.erb
|
99
93
|
- spec/rails_app/app/views/logged_exceptions/_exception.html.erb
|
@@ -113,80 +107,66 @@ files:
|
|
113
107
|
- spec/rails_app/config/initializers/mime_types.rb
|
114
108
|
- spec/rails_app/config/initializers/secret_token.rb
|
115
109
|
- spec/rails_app/config/initializers/session_store.rb
|
110
|
+
- spec/rails_app/config/initializers/wrap_parameters.rb
|
116
111
|
- spec/rails_app/config/locales/en.yml
|
117
112
|
- spec/rails_app/config/routes.rb
|
118
|
-
- spec/rails_app/db/migrate/
|
113
|
+
- spec/rails_app/db/migrate/20120828161925_add_logged_exception_table.rb
|
119
114
|
- spec/rails_app/db/schema.rb
|
120
115
|
- spec/rails_app/db/seeds.rb
|
121
|
-
- spec/rails_app/doc/README_FOR_APP
|
122
|
-
- spec/rails_app/lib/tasks/.gitkeep
|
123
116
|
- spec/rails_app/public/404.html
|
124
117
|
- spec/rails_app/public/422.html
|
125
118
|
- spec/rails_app/public/500.html
|
126
119
|
- spec/rails_app/public/favicon.ico
|
127
|
-
- spec/rails_app/public/
|
128
|
-
- spec/rails_app/public/javascripts/application.js
|
129
|
-
- spec/rails_app/public/javascripts/controls.js
|
130
|
-
- spec/rails_app/public/javascripts/dragdrop.js
|
131
|
-
- spec/rails_app/public/javascripts/effects.js
|
132
|
-
- spec/rails_app/public/javascripts/prototype.js
|
133
|
-
- spec/rails_app/public/javascripts/rails.js
|
120
|
+
- spec/rails_app/public/index.html
|
134
121
|
- spec/rails_app/public/javascripts/tartarus.jquery.js
|
135
122
|
- spec/rails_app/public/robots.txt
|
136
|
-
- spec/rails_app/public/stylesheets/.gitkeep
|
137
123
|
- spec/rails_app/public/stylesheets/tartarus.css
|
138
124
|
- spec/rails_app/script/rails
|
139
125
|
- spec/rails_app/spec/controllers/logged_exceptions_controller_spec.rb
|
140
126
|
- spec/rails_app/spec/models/logged_exception_spec.rb
|
141
127
|
- spec/rails_app/spec/spec_helper.rb
|
142
|
-
- spec/rails_app/vendor/plugins/.gitkeep
|
143
128
|
- spec/spec_helper.rb
|
144
129
|
- spec/tartarus/logger_spec.rb
|
145
130
|
- spec/tartarus_spec.rb
|
146
131
|
- tartarus.gemspec
|
147
132
|
homepage: http://github.com/dinsley/tartarus
|
148
133
|
licenses: []
|
149
|
-
|
150
134
|
post_install_message:
|
151
|
-
rdoc_options:
|
135
|
+
rdoc_options:
|
152
136
|
- --charset=UTF-8
|
153
|
-
require_paths:
|
137
|
+
require_paths:
|
154
138
|
- lib
|
155
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
139
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
156
140
|
none: false
|
157
|
-
requirements:
|
158
|
-
- -
|
159
|
-
- !ruby/object:Gem::Version
|
160
|
-
|
161
|
-
|
162
|
-
- 0
|
163
|
-
version: "0"
|
164
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ! '>='
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
146
|
none: false
|
166
|
-
requirements:
|
167
|
-
- -
|
168
|
-
- !ruby/object:Gem::Version
|
169
|
-
|
170
|
-
segments:
|
171
|
-
- 0
|
172
|
-
version: "0"
|
147
|
+
requirements:
|
148
|
+
- - ! '>='
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '0'
|
173
151
|
requirements: []
|
174
|
-
|
175
152
|
rubyforge_project:
|
176
|
-
rubygems_version: 1.8.
|
153
|
+
rubygems_version: 1.8.24
|
177
154
|
signing_key:
|
178
155
|
specification_version: 3
|
179
156
|
summary: Exception Logging for Rails
|
180
|
-
test_files:
|
157
|
+
test_files:
|
181
158
|
- spec/rails_app/.gitignore
|
182
|
-
- spec/rails_app/.rspec
|
183
159
|
- spec/rails_app/Gemfile
|
184
160
|
- spec/rails_app/Gemfile.lock
|
185
|
-
- spec/rails_app/README
|
186
161
|
- spec/rails_app/Rakefile
|
162
|
+
- spec/rails_app/app/assets/images/rails.png
|
163
|
+
- spec/rails_app/app/assets/javascripts/application.js
|
164
|
+
- spec/rails_app/app/assets/stylesheets/application.css
|
187
165
|
- spec/rails_app/app/controllers/application_controller.rb
|
188
166
|
- spec/rails_app/app/controllers/logged_exceptions_controller.rb
|
189
167
|
- spec/rails_app/app/helpers/application_helper.rb
|
168
|
+
- spec/rails_app/app/mailers/.gitkeep
|
169
|
+
- spec/rails_app/app/models/.gitkeep
|
190
170
|
- spec/rails_app/app/models/logged_exception.rb
|
191
171
|
- spec/rails_app/app/views/layouts/application.html.erb
|
192
172
|
- spec/rails_app/app/views/logged_exceptions/_exception.html.erb
|
@@ -206,33 +186,24 @@ test_files:
|
|
206
186
|
- spec/rails_app/config/initializers/mime_types.rb
|
207
187
|
- spec/rails_app/config/initializers/secret_token.rb
|
208
188
|
- spec/rails_app/config/initializers/session_store.rb
|
189
|
+
- spec/rails_app/config/initializers/wrap_parameters.rb
|
209
190
|
- spec/rails_app/config/locales/en.yml
|
210
191
|
- spec/rails_app/config/routes.rb
|
211
|
-
- spec/rails_app/db/migrate/
|
192
|
+
- spec/rails_app/db/migrate/20120828161925_add_logged_exception_table.rb
|
212
193
|
- spec/rails_app/db/schema.rb
|
213
194
|
- spec/rails_app/db/seeds.rb
|
214
|
-
- spec/rails_app/doc/README_FOR_APP
|
215
|
-
- spec/rails_app/lib/tasks/.gitkeep
|
216
195
|
- spec/rails_app/public/404.html
|
217
196
|
- spec/rails_app/public/422.html
|
218
197
|
- spec/rails_app/public/500.html
|
219
198
|
- spec/rails_app/public/favicon.ico
|
220
|
-
- spec/rails_app/public/
|
221
|
-
- spec/rails_app/public/javascripts/application.js
|
222
|
-
- spec/rails_app/public/javascripts/controls.js
|
223
|
-
- spec/rails_app/public/javascripts/dragdrop.js
|
224
|
-
- spec/rails_app/public/javascripts/effects.js
|
225
|
-
- spec/rails_app/public/javascripts/prototype.js
|
226
|
-
- spec/rails_app/public/javascripts/rails.js
|
199
|
+
- spec/rails_app/public/index.html
|
227
200
|
- spec/rails_app/public/javascripts/tartarus.jquery.js
|
228
201
|
- spec/rails_app/public/robots.txt
|
229
|
-
- spec/rails_app/public/stylesheets/.gitkeep
|
230
202
|
- spec/rails_app/public/stylesheets/tartarus.css
|
231
203
|
- spec/rails_app/script/rails
|
232
204
|
- spec/rails_app/spec/controllers/logged_exceptions_controller_spec.rb
|
233
205
|
- spec/rails_app/spec/models/logged_exception_spec.rb
|
234
206
|
- spec/rails_app/spec/spec_helper.rb
|
235
|
-
- spec/rails_app/vendor/plugins/.gitkeep
|
236
207
|
- spec/spec_helper.rb
|
237
208
|
- spec/tartarus/logger_spec.rb
|
238
209
|
- spec/tartarus_spec.rb
|
data/lib/tartarus/version.rb
DELETED
data/spec/rails_app/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--colour
|
data/spec/rails_app/README
DELETED
@@ -1,256 +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.find(: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.com/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
|
-
| |-- controllers
|
160
|
-
| |-- helpers
|
161
|
-
| |-- mailers
|
162
|
-
| |-- models
|
163
|
-
| `-- views
|
164
|
-
| `-- layouts
|
165
|
-
|-- config
|
166
|
-
| |-- environments
|
167
|
-
| |-- initializers
|
168
|
-
| `-- locales
|
169
|
-
|-- db
|
170
|
-
|-- doc
|
171
|
-
|-- lib
|
172
|
-
| `-- tasks
|
173
|
-
|-- log
|
174
|
-
|-- public
|
175
|
-
| |-- images
|
176
|
-
| |-- javascripts
|
177
|
-
| `-- stylesheets
|
178
|
-
|-- script
|
179
|
-
|-- test
|
180
|
-
| |-- fixtures
|
181
|
-
| |-- functional
|
182
|
-
| |-- integration
|
183
|
-
| |-- performance
|
184
|
-
| `-- unit
|
185
|
-
|-- tmp
|
186
|
-
| |-- cache
|
187
|
-
| |-- pids
|
188
|
-
| |-- sessions
|
189
|
-
| `-- sockets
|
190
|
-
`-- vendor
|
191
|
-
`-- plugins
|
192
|
-
|
193
|
-
app
|
194
|
-
Holds all the code that's specific to this particular application.
|
195
|
-
|
196
|
-
app/controllers
|
197
|
-
Holds controllers that should be named like weblogs_controller.rb for
|
198
|
-
automated URL mapping. All controllers should descend from
|
199
|
-
ApplicationController which itself descends from ActionController::Base.
|
200
|
-
|
201
|
-
app/models
|
202
|
-
Holds models that should be named like post.rb. Models descend from
|
203
|
-
ActiveRecord::Base by default.
|
204
|
-
|
205
|
-
app/views
|
206
|
-
Holds the template files for the view that should be named like
|
207
|
-
weblogs/index.html.erb for the WeblogsController#index action. All views use
|
208
|
-
eRuby syntax by default.
|
209
|
-
|
210
|
-
app/views/layouts
|
211
|
-
Holds the template files for layouts to be used with views. This models the
|
212
|
-
common header/footer method of wrapping views. In your views, define a layout
|
213
|
-
using the <tt>layout :default</tt> and create a file named default.html.erb.
|
214
|
-
Inside default.html.erb, call <% yield %> to render the view using this
|
215
|
-
layout.
|
216
|
-
|
217
|
-
app/helpers
|
218
|
-
Holds view helpers that should be named like weblogs_helper.rb. These are
|
219
|
-
generated for you automatically when using generators for controllers.
|
220
|
-
Helpers can be used to wrap functionality for your views into methods.
|
221
|
-
|
222
|
-
config
|
223
|
-
Configuration files for the Rails environment, the routing map, the database,
|
224
|
-
and other dependencies.
|
225
|
-
|
226
|
-
db
|
227
|
-
Contains the database schema in schema.rb. db/migrate contains all the
|
228
|
-
sequence of Migrations for your schema.
|
229
|
-
|
230
|
-
doc
|
231
|
-
This directory is where your application documentation will be stored when
|
232
|
-
generated using <tt>rake doc:app</tt>
|
233
|
-
|
234
|
-
lib
|
235
|
-
Application specific libraries. Basically, any kind of custom code that
|
236
|
-
doesn't belong under controllers, models, or helpers. This directory is in
|
237
|
-
the load path.
|
238
|
-
|
239
|
-
public
|
240
|
-
The directory available for the web server. Contains subdirectories for
|
241
|
-
images, stylesheets, and javascripts. Also contains the dispatchers and the
|
242
|
-
default HTML files. This should be set as the DOCUMENT_ROOT of your web
|
243
|
-
server.
|
244
|
-
|
245
|
-
script
|
246
|
-
Helper scripts for automation and generation.
|
247
|
-
|
248
|
-
test
|
249
|
-
Unit and functional tests along with fixtures. When using the rails generate
|
250
|
-
command, template test files will be generated for you and placed in this
|
251
|
-
directory.
|
252
|
-
|
253
|
-
vendor
|
254
|
-
External libraries that the application depends on. Also includes the plugins
|
255
|
-
subdirectory. If the app has frozen rails, those gems also go here, under
|
256
|
-
vendor/rails/. This directory is in the load path.
|