Permalink
Browse files

updates and cleanup

  • Loading branch information...
1 parent 041f24a commit 9242f0e6c8b07310252b67b39fdda5efd48b9179 @derailed committed Jul 11, 2011
Showing with 44 additions and 35 deletions.
  1. +7 −0 Gemfile
  2. +5 −1 History.txt
  3. +5 −13 README.rdoc
  4. +1 −1 Rakefile
  5. +1 −1 lib/rackamole/mole.rb
  6. +4 −4 lib/rackamole/utils/agent_detect.rb
  7. +21 −14 spec/rackamole/utils/agent_detect_spec.rb
  8. +0 −1 spec/spec_helper.rb
View
@@ -1,5 +1,6 @@
source :rubygems
+gem 'rake'
gem "logging"
gem "hitimes"
gem "mongo" , ">= 1.0.1"
@@ -15,4 +16,10 @@ group :development do
gem "bones"
gem "bones-git"
gem "bones-extras"
+end
+
+group :test do
+ # gem "simplecov"
+ # gem "rcov"
+ gem "rspec"
end
View
@@ -78,4 +78,8 @@
0.4.0
* Updated bones version
-* Updated to bundler
+* Added bundler Gemfile
+* Fixed bug parsing agent
+
+0.4.1
+* Updates for rails 3.0.8
View
@@ -52,23 +52,15 @@
=== Rails applications
- Edit your environment.rb file and add the following lines:
+ Edit your environments ruby files and add the following lines:
- require 'rackamole'
config.middleware.use Rack::Mole, { :app_name => "My Cool App", :user_key => :user_name }
This instructs the mole to start logging information to the console and look for the user name
- in the session using the :user_name key. There are other options available, please take a look
- at the docs for more information.
-
- Given Rails exception handling logic, you can also edit your application_controller.rb file and
- include the mole interceptor to trap exceptions in production environment
-
- class ApplicationController
- include Rackamole::Interceptor
-
- This will instruct the mole to trap the raised exception from your rails stack.
-
+ in the session using the :user_name key. In order to associate an action with a logged in user you
+ must set a session env variable, in this case we use user_name. There are other options available,
+ please take a look at the docs for more information.
+
=== Sinatra Applications
Add the following lines in the config section and smoke it...
View
@@ -13,7 +13,7 @@ Bones {
readme_file 'README.rdoc'
email 'fernand.galiana@gmail.com'
url 'http://www.rackamole.com'
- spec.opts %w[--color]
+ # spec.opts %w[--color]
ruby_opts %w[-W0]
# Dependencies
@@ -419,7 +419,7 @@ def get_route( request )
return nil unless defined?( RAILS_ENV )
# Check for invalid route exception...
begin
- return ::ActionController::Routing::Routes.recognize_path( request.path, {:method => request.request_method.downcase.to_sym } )
+ return Rails.application.routes.recognize_path( request.path, {:method => request.request_method.downcase.to_sym } )
rescue => boom
return nil
end
@@ -60,12 +60,12 @@ def self.extract_platform( agent )
machine_info = match[1]
tokens = machine_info.split( ";" )
unless tokens.empty?
- index = 1
- platform = tokens[0].strip
+ platform = tokens.shift.strip
@info[:machine][:platform] = platform
- index += 1 if tokens[1].match( /[MSIE|U]/ )
- os = tokens[index].match( /(.+)\s([\w\d|\.]+)/ )
+ os_info = tokens.shift
+ os_info = tokens.shift if os_info && os_info.match( /[MSIE|U]/ )
+ os = os_info.match( /(.+)\s([\w\d|\.]+)/ ) if os_info
if os
@info[:machine][:os] = os[1].strip if os[1]
@info[:machine][:version] = os[2].strip if os[2]
@@ -5,23 +5,30 @@
describe "os" do
it "should detect the os and version correctly" do
agents = [
- "Opera/8.65 (X11; Linux i686; U; ru)",
- "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) Opera 8.65 [en]",
- "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/1.5.0.12 (.NET CLR 3.5.30729)",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.6) Gecko/2009011912 Firefox/1.5.0.12 Ubiquity/0.1.5",
- "Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.0.12) Gecko/20080326 CentOS/1.5.0.12-14.el5.centos Firefox/1.5.0.12",
- "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.24 Safari/532.0",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.24 Safari/532.0",
- "Mozilla/5.0 (iPod; U; CPU like Mac OS X; fr) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/4A102 Safari/522.12",
- "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3B48b Safari/522.12",
- "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)",
- "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SV1; CPT-IE401SP1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)",
- "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 1.1.4322; InfoPath.2)",
- "Mozilla/4.0 (compatible; MSIE 5.00; Windows 98)",
- "Opera/9.80 (Windows NT 6.1; U; es-ES) Presto/2.6.30 Version/10.61"
+ # "Opera/8.65 (X11; Linux i686; U; ru)",
+ # "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) Opera 8.65 [en]",
+ # "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/1.5.0.12 (.NET CLR 3.5.30729)",
+ # "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.6) Gecko/2009011912 Firefox/1.5.0.12 Ubiquity/0.1.5",
+ # "Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.0.12) Gecko/20080326 CentOS/1.5.0.12-14.el5.centos Firefox/1.5.0.12",
+ # "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.24 Safari/532.0",
+ # "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.24 Safari/532.0",
+ # "Mozilla/5.0 (iPod; U; CPU like Mac OS X; fr) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/4A102 Safari/522.12",
+ # "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3B48b Safari/522.12",
+ # "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)",
+ # "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SV1; CPT-IE401SP1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)",
+ # "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 1.1.4322; InfoPath.2)",
+ # "Mozilla/4.0 (compatible; MSIE 5.00; Windows 98)",
+ # "Opera/9.80 (Windows NT 6.1; U; es-ES) Presto/2.6.30 Version/10.61",
+ "Safari/6533.17.8 CFNetwork/454.9.7 Darwin/10.4.0 (i386) (iMac10%2C1)",
+ # "Mozilla/5.0 (SnapPreviewBot) Gecko/20061206 Firefox/1.5.0.9",
+ # "StackRambler/2.0 (MSIE incompatible)"
]
expectations = [
{
+ :browser => { :name => "Safari", :version => "6533.17.8" },
+ :machine => { :platform => "i386", :os => "Darwin", :version => "10.4.0", :local => "N/A" }
+ },
+ {
:browser => { :name => "Opera", :version => "8.65" },
:machine => { :platform => "X11", :os => "Linux", :version => "i686", :local => "N/A" }
},
View
@@ -1,4 +1,3 @@
-# require 'rubygems'
require 'rack'
require 'rack/test'

0 comments on commit 9242f0e

Please sign in to comment.