rackamole 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -28,6 +28,6 @@ PROJ.rcov.opts = ["--sort", "coverage", "-T", '-x mongo']
28
28
  depend_on "logging" , ">= 1.2.2"
29
29
  depend_on "hitimes" , ">= 1.0.3"
30
30
  depend_on "mongo" , ">= 0.17.1"
31
- depend_on "darkfish-rdoc", ">= 1.1.5"
31
+ # depend_on "darkfish-rdoc", ">= 1.1.5"
32
32
  depend_on "twitter4r" , ">= 0.3.0"
33
33
  depend_on "actionmailer" , ">= 2.1.0"
data/aaa.txt ADDED
@@ -0,0 +1,52 @@
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/lib/rackamole.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Rackamole
2
2
 
3
3
  # :stopdoc:
4
- VERSION = '0.0.8'
4
+ VERSION = '0.0.9'
5
5
  LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
6
6
  PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
7
7
  # :startdoc:
@@ -0,0 +1,5 @@
1
+ module Rackamole::Config
2
+ def twitter( &block )
3
+ puts "Twitt options"
4
+ end
5
+ end
@@ -31,22 +31,21 @@ module Rack
31
31
  # ==
32
32
  #
33
33
  # :excluded_paths:: Exclude paths that you do not wish to mole by specifying an array of regular expresssions.
34
- # :twitter_auth :: You can setup the MOle twit interesting events to a private (public if you indulge pain!) twitter account.
35
- # Specified your twitter account information using a hash with :username and :password key
36
- # :twitt_on :: You must configure your twitter auth and configuration using this hash. By default this option is disabled.
34
+ # :twitter :: Set this option to have the mole twitt certain alerts. You must configure your twitter auth
35
+ # via the :username and :password keys and :alert_on with an array of mole types you
36
+ # wish to be notified on.
37
37
  # ==
38
- # :twitt_on => { :enabled => false, :features => [Rackamole.perf, Rackamole.fault] }
38
+ # :twitter => { :username => 'fred', :password => 'blee', :alert_on => [Rackamole.perf, Rackamole.fault] }
39
39
  # ==
40
40
  # ==== BOZO! currently there is not support for throttling or monitoring these alerts.
41
41
  # ==
42
- # :emails :: The mole can be configured to send out emails bases on interesting mole features.
43
- # This feature uses actionmailer. You must specify a hash for the from and to options.
42
+ # :email :: The mole can be configured to send out emails bases on interesting mole features.
43
+ # This feature uses actionmailer. You must specify a hash with the following keys :from, :to
44
+ # and :alert_on options to indicate which mole type your wish to be alerted on.
44
45
  # ==
45
- # :emails => { :from => 'fred@acme.com', :to => ['blee@acme.com', 'doh@acme.com'] }
46
+ # :email => { :from => 'fred@acme.com', :to => ['blee@acme.com', 'doh@acme.com'], :alert_on => [Rackamole.perf, Rackamole.fault] }
46
47
  # ==
47
- # :mail_on :: Hash for email alert triggers. May be enabled or disabled per env settings. Default is disabled
48
- # ==
49
- # :mail_on => {:enabled => true, :features => [Rackamole.perf, Rackamole.fault] }
48
+ #
50
49
  def initialize( app, opts={} )
51
50
  @app = app
52
51
  init_options( opts )
@@ -92,9 +91,7 @@ module Rack
92
91
  :environment => 'test',
93
92
  :excluded_paths => [/.?\.ico/, /.?\.png/],
94
93
  :perf_threshold => 10.0,
95
- :store => Rackamole::Store::Log.new,
96
- :twitt_on => { :enabled => false, :features => [Rackamole.perf, Rackamole.fault] },
97
- :mail_on => { :enabled => false, :features => [Rackamole.perf, Rackamole.fault] }
94
+ :store => Rackamole::Store::Log.new
98
95
  }
99
96
  end
100
97
 
@@ -106,10 +103,9 @@ module Rack
106
103
  raise "[M()le] -- Unable to locate required option key `#{k}" unless options[k.to_sym]
107
104
  end
108
105
 
109
- configured?( :twitter_auth, [:username, :password] )
110
- configured?( :twitt_on , [:enabled, :features] )
111
- configured?( :emails , [:from, :to] )
112
- configured?( :mail_on , [:enabled, :features] )
106
+ # Barf early if something is wrong in the configuration
107
+ configured?( :twitter, [:username, :password, :alert_on], true )
108
+ configured?( :email , [:from, :to, :alert_on], true )
113
109
  end
114
110
 
115
111
  # Send moled info to store and potentially send out alerts...
@@ -120,12 +116,12 @@ module Rack
120
116
  options[:store].mole( attrs )
121
117
 
122
118
  # send email alert ?
123
- if configured?( :emails, [:from, :to] ) and alertable?( :mail_on, attrs[:type] )
124
- Rackamole::Alert::Emole.deliver_alert( options[:emails][:from], options[:emails][:to], attrs )
119
+ if alertable?( :email, attrs[:type] )
120
+ Rackamole::Alert::Emole.deliver_alert( options[:email][:from], options[:email][:to], attrs )
125
121
  end
126
122
 
127
123
  # send twitter alert ?
128
- if configured?( :twitter_auth, [:username, :password] ) and alertable?( :twitt_on, attrs[:type] )
124
+ if alertable?( :twitter, attrs[:type] )
129
125
  twitt.send_alert( attrs )
130
126
  end
131
127
  rescue => boom
@@ -134,12 +130,13 @@ module Rack
134
130
  end
135
131
 
136
132
  # Check if an options is set and configured
137
- def configured?( key, configs )
138
- return false unless options.key?(key)
133
+ def configured?( key, configs, optional=true )
134
+ return false if optional and !options.has_key?(key)
135
+ raise "Missing option key :#{key}" unless options.has_key?(key)
139
136
  configs.each do |c|
140
- raise "Invalid value for option #{key}. Expecting a hash with symbols #{configs.join(',')}." unless options[key].respond_to? :key?
137
+ raise "Invalid value for option :#{key}. Expecting a hash with symbols [#{configs.join(',')}]" unless options[key].respond_to? :key?
141
138
  unless options[key].key?(c)
142
- raise "Option #{key} is not properly configured missing #{c.inspect}"
139
+ raise "Option :#{key} is not properly configured. Missing #{c.inspect} in [#{options[key].keys.sort{|a,b| a.to_s <=> b.to_s}.join(',')}]"
143
140
  end
144
141
  end
145
142
  true
@@ -147,14 +144,14 @@ module Rack
147
144
 
148
145
  # Check if feature should be send to alert clients ie email or twitter
149
146
  def alertable?( filter, type )
150
- return false unless configured?( filter, [:enabled,:features] )
151
- return false unless options[filter][:enabled]
152
- options[filter][:features].include?( type )
147
+ return false unless configured?( filter, [:alert_on] )
148
+ return false unless options[filter][:alert_on]
149
+ options[filter][:alert_on].include?( type )
153
150
  end
154
151
 
155
152
  # Create or retrieve twitter client
156
153
  def twitt
157
- @twitt ||= Rackamole::Alert::Twitt.new( options[:twitter_auth][:username], options[:twitter_auth][:password] )
154
+ @twitt ||= Rackamole::Alert::Twitt.new( options[:twitter][:username], options[:twitter][:password] )
158
155
  end
159
156
 
160
157
  # Check if this request should be moled according to the exclude filters
@@ -114,12 +114,20 @@ describe Rack::Mole do
114
114
  describe '#alertable?' do
115
115
  before( :each ) do
116
116
  @rack = Rack::Mole.new( nil,
117
- :twitt_on => { :enabled => true , :features => [Rackamole.perf, Rackamole.fault] },
118
- :mail_on => { :enabled => false, :features => [Rackamole.perf, Rackamole.fault, Rackamole.feature] } )
117
+ :twitter => {
118
+ :username => 'fred',
119
+ :password => 'blee',
120
+ :alert_on => [Rackamole.perf, Rackamole.fault]
121
+ },
122
+ :email => {
123
+ :from => 'fred',
124
+ :to => 'blee',
125
+ :alert_on => [Rackamole.perf, Rackamole.fault, Rackamole.feature]
126
+ } )
119
127
  end
120
128
 
121
129
  it "should succeeed if a feature can be twitted on" do
122
- @rack.send( :alertable?, :twitt_on, Rackamole.perf ).should == true
130
+ @rack.send( :alertable?, :twitter, Rackamole.perf ).should == true
123
131
  end
124
132
 
125
133
  it "should fail if the type is not in range" do
@@ -127,15 +135,11 @@ describe Rack::Mole do
127
135
  end
128
136
 
129
137
  it "should fail if this is not an included feature" do
130
- @rack.send( :alertable?, :twitt_on, Rackamole.feature ).should == false
138
+ @rack.send( :alertable?, :twitter, Rackamole.feature ).should == false
131
139
  end
132
140
 
133
- it "should always return false if the alert is disabled" do
141
+ it "should fail if an alert is not configured" do
134
142
  @rack.send( :alertable?, :mail_on, Rackamole.perf ).should == false
135
- end
136
-
137
- it "should fail if the alert is not configured" do
138
- @rack.send( :alertable?, :fred, Rackamole.perf ).should == false
139
143
  end
140
144
  end
141
145
 
@@ -143,31 +147,32 @@ describe Rack::Mole do
143
147
  before( :each ) do
144
148
  options = {
145
149
  :blee => [1,2,3],
146
- :twitter_auth => { :username => 'Fernand', :password => "Blee" },
147
- :twitt_on => { :enabled => true, :features => [Rackamole.perf, Rackamole.fault] }
150
+ :twitter => { :username => 'Fernand', :password => "Blee", :alert_on => [Rackamole.perf, Rackamole.fault] },
148
151
  }
149
152
  @rack = Rack::Mole.new( nil, options )
150
153
  end
151
154
 
152
155
  it "should return true if an option is correctly configured" do
153
- @rack.send( :configured?, :twitter_auth, [:username, :password] ).should == true
154
- @rack.send( :configured?, :twitt_on, [:enabled, :features] ).should == true
156
+ @rack.send( :configured?, :twitter, [:username, :password] ).should == true
157
+ @rack.send( :configured?, :twitter, [:alert_on] ).should == true
155
158
  end
156
159
 
157
160
  it "should fail if an option is not set" do
158
- @rack.send( :configured?, :twitter, [:username, :password] ).should == false
161
+ lambda {
162
+ @rack.send( :configured?, :twitter, [:username, :password, :blee] )
163
+ }.should raise_error(RuntimeError, /Option \:twitter is not properly configured. Missing \:blee in \[alert_on,password,username\]/)
159
164
  end
160
165
 
161
166
  it "should fail if an option is not a hash" do
162
167
  lambda {
163
168
  @rack.send( :configured?, :blee, [:username, :pwd] )
164
- }.should raise_error(RuntimeError, /Invalid value for option blee. Expecting a hash with symbols username,pwd/ )
165
- end
169
+ }.should raise_error(RuntimeError, /Invalid value for option \:blee\. Expecting a hash with symbols \[username,pwd\]/ )
170
+ end
166
171
 
167
172
  it "should fail if an option is not correctly configured" do
168
173
  lambda {
169
- @rack.send( :configured?, :twitter_auth, [:username, :pwd] )
170
- }.should raise_error(RuntimeError, /missing :pwd/ )
174
+ @rack.send( :configured?, :fred, [:username, :pwd], false )
175
+ }.should raise_error(RuntimeError, /Missing option key \:fred/ )
171
176
  end
172
177
  end
173
178
 
@@ -0,0 +1,9 @@
1
+ require 'rubygems'
2
+ require File.join( File.dirname(__FILE__), %w[.. lib rackamole] )
3
+
4
+ include Rackamole::Config
5
+
6
+ twitter do
7
+ username 'duh'
8
+ password 'fred'
9
+ end
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.0.8
4
+ version: 0.0.9
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: 2009-11-24 00:00:00 -07:00
12
+ date: 2009-11-25 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -42,16 +42,6 @@ dependencies:
42
42
  - !ruby/object:Gem::Version
43
43
  version: 0.17.1
44
44
  version:
45
- - !ruby/object:Gem::Dependency
46
- name: darkfish-rdoc
47
- type: :runtime
48
- version_requirement:
49
- version_requirements: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: 1.1.5
54
- version:
55
45
  - !ruby/object:Gem::Dependency
56
46
  name: twitter4r
57
47
  type: :runtime
@@ -100,12 +90,14 @@ extensions: []
100
90
 
101
91
  extra_rdoc_files:
102
92
  - README.rdoc
93
+ - aaa.txt
103
94
  - lib/rackamole/alert/templates/rackamole/alert/emole/alert.erb
104
95
  - samples/rails/moled/public/robots.txt
105
96
  files:
106
97
  - ...
107
98
  - README.rdoc
108
99
  - Rakefile
100
+ - aaa.txt
109
101
  - images/mole_logo.png
110
102
  - images/mole_logo.psd
111
103
  - images/mole_logo_small.png
@@ -114,6 +106,7 @@ files:
114
106
  - lib/rackamole/alert/emole.rb
115
107
  - lib/rackamole/alert/templates/rackamole/alert/emole/alert.erb
116
108
  - lib/rackamole/alert/twitt.rb
109
+ - lib/rackamole/config.rb
117
110
  - lib/rackamole/interceptor.rb
118
111
  - lib/rackamole/logger.rb
119
112
  - lib/rackamole/mole.rb
@@ -200,6 +193,7 @@ files:
200
193
  - tasks/test.rake
201
194
  - tasks/zentest.rake
202
195
  - z_experiments/config.rb
196
+ - z_experiments/config_sample.rb
203
197
  has_rdoc: true
204
198
  homepage: http://www.rackamole.com
205
199
  licenses: []