rackamole 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +12 -1
- data/README.rdoc +35 -35
- data/lib/rackamole.rb +1 -1
- data/lib/rackamole/alert/twitt.rb +5 -4
- data/lib/rackamole/mole.rb +40 -18
- data/lib/rackamole/store/mongo_db.rb +5 -3
- data/spec/rackamole/alert/twitt_spec.rb +3 -3
- data/spec/rackamole/mole_spec.rb +52 -5
- data/spec/rackamole/store/mongo_db_spec.rb +4 -4
- data/tasks/setup.rb +1 -1
- data/tasks/test.rake +1 -0
- metadata +3 -85
- data/a.rb +0 -18
- data/aaa.txt +0 -52
- data/images/mole_logo.png +0 -0
- data/images/mole_logo.psd +0 -0
- data/images/mole_logo_small.png +0 -0
- data/images/mole_logo_small.psd +0 -0
- data/samples/rails/moled/README +0 -243
- data/samples/rails/moled/Rakefile +0 -10
- data/samples/rails/moled/app/controllers/application_controller.rb +0 -21
- data/samples/rails/moled/app/controllers/fred_controller.rb +0 -14
- data/samples/rails/moled/app/helpers/application_helper.rb +0 -3
- data/samples/rails/moled/app/views/fred/index.html.erb +0 -1
- data/samples/rails/moled/app/views/fred/show.html.erb +0 -1
- data/samples/rails/moled/config/boot.rb +0 -110
- data/samples/rails/moled/config/database.yml +0 -22
- data/samples/rails/moled/config/environment.rb +0 -52
- data/samples/rails/moled/config/environments/development.rb +0 -17
- data/samples/rails/moled/config/environments/production.rb +0 -28
- data/samples/rails/moled/config/environments/test.rb +0 -28
- data/samples/rails/moled/config/initializers/backtrace_silencers.rb +0 -7
- data/samples/rails/moled/config/initializers/inflections.rb +0 -10
- data/samples/rails/moled/config/initializers/mime_types.rb +0 -5
- data/samples/rails/moled/config/initializers/new_rails_defaults.rb +0 -19
- data/samples/rails/moled/config/initializers/session_store.rb +0 -15
- data/samples/rails/moled/config/locales/en.yml +0 -5
- data/samples/rails/moled/config/routes.rb +0 -6
- data/samples/rails/moled/db/development.sqlite3 +0 -0
- data/samples/rails/moled/db/production.sqlite3 +0 -0
- data/samples/rails/moled/doc/README_FOR_APP +0 -2
- data/samples/rails/moled/log/development.log +0 -100
- data/samples/rails/moled/log/production.log +0 -46
- data/samples/rails/moled/log/server.log +0 -0
- data/samples/rails/moled/log/test.log +0 -0
- data/samples/rails/moled/public/404.html +0 -30
- data/samples/rails/moled/public/422.html +0 -30
- data/samples/rails/moled/public/500.html +0 -30
- data/samples/rails/moled/public/favicon.ico +0 -0
- data/samples/rails/moled/public/images/rails.png +0 -0
- data/samples/rails/moled/public/index.html +0 -275
- data/samples/rails/moled/public/javascripts/application.js +0 -2
- data/samples/rails/moled/public/javascripts/controls.js +0 -963
- data/samples/rails/moled/public/javascripts/dragdrop.js +0 -973
- data/samples/rails/moled/public/javascripts/effects.js +0 -1128
- data/samples/rails/moled/public/javascripts/prototype.js +0 -4320
- data/samples/rails/moled/public/robots.txt +0 -5
- data/samples/rails/moled/script/about +0 -4
- data/samples/rails/moled/script/console +0 -3
- data/samples/rails/moled/script/dbconsole +0 -3
- data/samples/rails/moled/script/destroy +0 -3
- data/samples/rails/moled/script/generate +0 -3
- data/samples/rails/moled/script/performance/benchmarker +0 -3
- data/samples/rails/moled/script/performance/profiler +0 -3
- data/samples/rails/moled/script/plugin +0 -3
- data/samples/rails/moled/script/runner +0 -3
- data/samples/rails/moled/script/server +0 -3
- data/samples/rails/moled/test/performance/browsing_test.rb +0 -9
- data/samples/rails/moled/test/test_helper.rb +0 -38
- data/samples/sinatra/moled.rb +0 -63
- data/samples/sinatra/public/.DS_Store +0 -0
- data/samples/sinatra/public/images/mole_logo.png +0 -0
- data/samples/sinatra/public/stylesheets/styles.css +0 -58
- data/samples/sinatra/views/index.erb +0 -14
- data/samples/sinatra/views/layout.erb +0 -23
- data/samples/sinatra/views/normal.erb +0 -1
- data/samples/sinatra/views/params.erb +0 -1
- data/samples/sinatra/views/post.erb +0 -1
- data/samples/sinatra/views/slow.erb +0 -1
- data/z_experiments/config.rb +0 -38
- data/z_experiments/config_sample.rb +0 -9
- data/z_experiments/configuration.rb +0 -5
data/tasks/setup.rb
CHANGED
@@ -21,7 +21,7 @@ PROJ = OpenStruct.new(
|
|
21
21
|
:email => nil,
|
22
22
|
:url => "\000",
|
23
23
|
:version => ENV['VERSION'] || '0.0.0',
|
24
|
-
:exclude => %w(tmp$ bak$ ~$ CVS \.svn/ \.git/ ^pkg/),
|
24
|
+
:exclude => %w(tmp$ bak$ ~$ CVS \.svn/ \.git/ ^pkg/ samples/* z_experiments/* images/*),
|
25
25
|
:release_name => ENV['RELEASE'],
|
26
26
|
|
27
27
|
# System Defaults
|
data/tasks/test.rake
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rackamole
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fernand Galiana
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-21 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -102,17 +102,7 @@ dependencies:
|
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: 2.5.1
|
104
104
|
version:
|
105
|
-
description: "The MOle is a rack application that monitors user interactions with your web site. We are not \n\
|
106
|
-
talking about counting page hits here. The MOle tracks all the information available to capture\n\
|
107
|
-
the essence of a user interaction with your application. Using the MOle, you are able to see\n\
|
108
|
-
which feature is a hit or a bust. As an added bonus, the MOle also track performance and exceptions \n\
|
109
|
-
that might have escaped your test suites or alpha env. To boot your managers will love you for it! \n\n\
|
110
|
-
Whether you are releasing a new application or improving on an old one, it is always a good thing \n\
|
111
|
-
to know if anyone is using your application and if they are, how they are using it. \n\
|
112
|
-
What features are your users most fond of and which features find their way into the abyss? \n\
|
113
|
-
You will be able to rapidly assess whether or not your application is a hit and if\n\
|
114
|
-
your coolest features are thought as such by your users. You will be able to elegantly record user\n\
|
115
|
-
interactions and leverage these findings for the next iteration of your application. "
|
105
|
+
description: " The MOle is a rack application that monitors user interactions with your web site. We are not \n talking about counting page hits here. The MOle tracks all the information available to capture\n the essence of a user interaction with your application. Using the MOle, you are able to see\n which feature is a hit or a bust. As an added bonus, the MOle also track performance and exceptions \n that might have escaped your test suites or alpha env. To boot your managers will love you for it! \n\n Whether you are releasing a new application or improving on an old one, it is always a good thing \n to know if anyone is using your application and if they are, how they are using it. \n What features are your users most fond of and which features find their way into the abyss? \n You will be able to rapidly assess whether or not your application is a hit and if\n your coolest features are thought as such by your users. You will be able to elegantly record user\n interactions and leverage these findings for the next iteration of your application. "
|
116
106
|
email: fernand.galiana@gmail.com
|
117
107
|
executables: []
|
118
108
|
|
@@ -120,20 +110,12 @@ extensions: []
|
|
120
110
|
|
121
111
|
extra_rdoc_files:
|
122
112
|
- README.rdoc
|
123
|
-
- aaa.txt
|
124
113
|
- lib/rackamole/alert/templates/alert.erb
|
125
|
-
- samples/rails/moled/public/robots.txt
|
126
114
|
files:
|
127
115
|
- ...
|
128
116
|
- HISTORY
|
129
117
|
- README.rdoc
|
130
118
|
- Rakefile
|
131
|
-
- a.rb
|
132
|
-
- aaa.txt
|
133
|
-
- images/mole_logo.png
|
134
|
-
- images/mole_logo.psd
|
135
|
-
- images/mole_logo_small.png
|
136
|
-
- images/mole_logo_small.psd
|
137
119
|
- lib/rackamole.rb
|
138
120
|
- lib/rackamole/alert/emole.rb
|
139
121
|
- lib/rackamole/alert/templates/alert.erb
|
@@ -148,67 +130,6 @@ files:
|
|
148
130
|
- lib/rackamole/store.rb
|
149
131
|
- lib/rackamole/store/log.rb
|
150
132
|
- lib/rackamole/store/mongo_db.rb
|
151
|
-
- samples/rails/moled/README
|
152
|
-
- samples/rails/moled/Rakefile
|
153
|
-
- samples/rails/moled/app/controllers/application_controller.rb
|
154
|
-
- samples/rails/moled/app/controllers/fred_controller.rb
|
155
|
-
- samples/rails/moled/app/helpers/application_helper.rb
|
156
|
-
- samples/rails/moled/app/views/fred/index.html.erb
|
157
|
-
- samples/rails/moled/app/views/fred/show.html.erb
|
158
|
-
- samples/rails/moled/config/boot.rb
|
159
|
-
- samples/rails/moled/config/database.yml
|
160
|
-
- samples/rails/moled/config/environment.rb
|
161
|
-
- samples/rails/moled/config/environments/development.rb
|
162
|
-
- samples/rails/moled/config/environments/production.rb
|
163
|
-
- samples/rails/moled/config/environments/test.rb
|
164
|
-
- samples/rails/moled/config/initializers/backtrace_silencers.rb
|
165
|
-
- samples/rails/moled/config/initializers/inflections.rb
|
166
|
-
- samples/rails/moled/config/initializers/mime_types.rb
|
167
|
-
- samples/rails/moled/config/initializers/new_rails_defaults.rb
|
168
|
-
- samples/rails/moled/config/initializers/session_store.rb
|
169
|
-
- samples/rails/moled/config/locales/en.yml
|
170
|
-
- samples/rails/moled/config/routes.rb
|
171
|
-
- samples/rails/moled/db/development.sqlite3
|
172
|
-
- samples/rails/moled/db/production.sqlite3
|
173
|
-
- samples/rails/moled/doc/README_FOR_APP
|
174
|
-
- samples/rails/moled/log/development.log
|
175
|
-
- samples/rails/moled/log/production.log
|
176
|
-
- samples/rails/moled/log/server.log
|
177
|
-
- samples/rails/moled/log/test.log
|
178
|
-
- samples/rails/moled/public/404.html
|
179
|
-
- samples/rails/moled/public/422.html
|
180
|
-
- samples/rails/moled/public/500.html
|
181
|
-
- samples/rails/moled/public/favicon.ico
|
182
|
-
- samples/rails/moled/public/images/rails.png
|
183
|
-
- samples/rails/moled/public/index.html
|
184
|
-
- samples/rails/moled/public/javascripts/application.js
|
185
|
-
- samples/rails/moled/public/javascripts/controls.js
|
186
|
-
- samples/rails/moled/public/javascripts/dragdrop.js
|
187
|
-
- samples/rails/moled/public/javascripts/effects.js
|
188
|
-
- samples/rails/moled/public/javascripts/prototype.js
|
189
|
-
- samples/rails/moled/public/robots.txt
|
190
|
-
- samples/rails/moled/script/about
|
191
|
-
- samples/rails/moled/script/console
|
192
|
-
- samples/rails/moled/script/dbconsole
|
193
|
-
- samples/rails/moled/script/destroy
|
194
|
-
- samples/rails/moled/script/generate
|
195
|
-
- samples/rails/moled/script/performance/benchmarker
|
196
|
-
- samples/rails/moled/script/performance/profiler
|
197
|
-
- samples/rails/moled/script/plugin
|
198
|
-
- samples/rails/moled/script/runner
|
199
|
-
- samples/rails/moled/script/server
|
200
|
-
- samples/rails/moled/test/performance/browsing_test.rb
|
201
|
-
- samples/rails/moled/test/test_helper.rb
|
202
|
-
- samples/sinatra/moled.rb
|
203
|
-
- samples/sinatra/public/.DS_Store
|
204
|
-
- samples/sinatra/public/images/mole_logo.png
|
205
|
-
- samples/sinatra/public/stylesheets/styles.css
|
206
|
-
- samples/sinatra/views/index.erb
|
207
|
-
- samples/sinatra/views/layout.erb
|
208
|
-
- samples/sinatra/views/normal.erb
|
209
|
-
- samples/sinatra/views/params.erb
|
210
|
-
- samples/sinatra/views/post.erb
|
211
|
-
- samples/sinatra/views/slow.erb
|
212
133
|
- spec/expected_results/mole_exception.log
|
213
134
|
- spec/expected_results/mole_feature.log
|
214
135
|
- spec/expected_results/mole_perf.log
|
@@ -238,9 +159,6 @@ files:
|
|
238
159
|
- tasks/svn.rake
|
239
160
|
- tasks/test.rake
|
240
161
|
- tasks/zentest.rake
|
241
|
-
- z_experiments/config.rb
|
242
|
-
- z_experiments/config_sample.rb
|
243
|
-
- z_experiments/configuration.rb
|
244
162
|
has_rdoc: true
|
245
163
|
homepage: http://www.rackamole.com
|
246
164
|
licenses: []
|
data/a.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'pony'
|
3
|
-
|
4
|
-
# :to => ['fernand.galiana@gmail.com', 'fernand@collectiveintellect.com'],
|
5
|
-
|
6
|
-
result = Pony.mail(
|
7
|
-
:from => 'fernand@collectiveintellect.com',
|
8
|
-
:to => 'fernand.galiana@gmail.com, fernand@collectiveintellect.com',
|
9
|
-
:subject => 'test5',
|
10
|
-
:body => "Hello World"
|
11
|
-
# :via => :smtp,
|
12
|
-
# :smtp => { :host => "exchange@collectiveintellect.com", :port => 25, : }
|
13
|
-
# :user => 'fernand@collectiveintellect.com',
|
14
|
-
# :password => '$mistral1',
|
15
|
-
# :auth => :plain
|
16
|
-
)
|
17
|
-
|
18
|
-
puts result.inspect
|
data/aaa.txt
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
Information:
|
2
|
-
|
3
|
-
* Fernand Galiana: fernand.galiana@gmail.com : @kitesufer
|
4
|
-
* Rackamole: http://rackamole.com : @rackamole
|
5
|
-
* Forum: http://groups.google.com/group/rackamole
|
6
|
-
* Git: git://github.com/derailed/rackamole.git
|
7
|
-
|
8
|
-
Rackamole: Observe your web applications in the wild...
|
9
|
-
|
10
|
-
These days, companies love to claim their entire devotion to the Agile process.
|
11
|
-
We all iterate, do the SCRUM thing, often for longer than we care for, and we are
|
12
|
-
all sworn into delivering early and often...
|
13
|
-
|
14
|
-
But how can you really measure if your application is a success or a bust?
|
15
|
-
We all know that page hits and heat maps are only good in the eyes of marketeers,
|
16
|
-
or some usability PHD... How do you accurately assess that the "must have" features
|
17
|
-
in your application are actually being used and how are your customers actually using them ?
|
18
|
-
More importantly, how can you accurately assess you are iterating down the right path for
|
19
|
-
your product and company success, and not simply digging further in the rat hole ?
|
20
|
-
|
21
|
-
In other word, at times do you feel you are adhering to the frAgile methodology
|
22
|
-
whose motto is 'Deliver early and often deliver the wrong shit?
|
23
|
-
|
24
|
-
Rackamole is a rack application that allows you to cover the 'death zone' in your application
|
25
|
-
life cycle. Prior to your next iteration, why not take the time to observe the interactions of your
|
26
|
-
customers with your application in the wild. Rackmole specializes in trapping and recording
|
27
|
-
feature usage, performance issues and application exception. By being part and not seating
|
28
|
-
outside your application stack, the mole can record the very essence of an interaction.
|
29
|
-
You can then leverage this new found knowledge to prepare for your next iterations.
|
30
|
-
As an added bonus, you can leverage Rackamole, to track your QA team progress and making sure
|
31
|
-
no features is left unturned prior to the big push.
|
32
|
-
|
33
|
-
Installation:
|
34
|
-
|
35
|
-
> gem install rackamole -s http://gemcutter.org
|
36
|
-
|
37
|
-
Usage:
|
38
|
-
|
39
|
-
use Rack::Mole, {...}
|
40
|
-
|
41
|
-
You can simply log the interaction to the console (the default) or log file.
|
42
|
-
Alternatively leverage the mongo adapter to use MongoDB to store the information
|
43
|
-
for later querying and reporting.
|
44
|
-
|
45
|
-
The gem comes bundled with an email notifier to alert you when something is happening and
|
46
|
-
needs your attention. Granted this won't improve your social ranking much, but additionally
|
47
|
-
you and your team can follow your application 'happenings' on twitter...
|
48
|
-
|
49
|
-
We are currently working on companion application aka 'Wackamole' that will allow you to view
|
50
|
-
and drilldown on the collected information.
|
51
|
-
|
52
|
-
Thanks for stopping by!
|
data/images/mole_logo.png
DELETED
Binary file
|
data/images/mole_logo.psd
DELETED
Binary file
|
data/images/mole_logo_small.png
DELETED
Binary file
|
data/images/mole_logo_small.psd
DELETED
Binary file
|
data/samples/rails/moled/README
DELETED
@@ -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.
|