Skip to content

Commit

Permalink
Cleanup trailing whitespace
Browse files Browse the repository at this point in the history
Trailing whitespace isn't friendly to git or vim users.
  • Loading branch information
sferik committed Mar 6, 2012
1 parent 9db9a8e commit 1174647
Show file tree
Hide file tree
Showing 36 changed files with 104 additions and 104 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
* @widget.unique_impression_count now uses request_hash. This was incorrectly stated in the README, since it was using ip_address. The README is correct as a result of the method change.

== 0.2.4 (2011-02-17)
* Fix issue #1 - action_name and controller_name were not being logged for impressionist method inside action
* Fix issue #1 - action_name and controller_name were not being logged for impressionist method inside action
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.1
1.0.1
18 changes: 9 additions & 9 deletions app/controllers/impressionist_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,22 @@ def impressionist_subapp_filter(actions=nil,unique_opts=nil)
end

private

def bypass
Impressionist::Bots::WILD_CARDS.each do |wild_card|
return true if request.user_agent and request.user_agent.downcase.include? wild_card
end
Impressionist::Bots::LIST.include? request.user_agent
end

def unique_instance?(impressionable, unique_opts)
return unique_opts.blank? || !impressionable.impressions.where(unique_query(unique_opts)).exists?
end

def unique?(unique_opts)
return unique_opts.blank? || !Impression.where(unique_query(unique_opts)).exists?
end

# creates the query to check for uniqueness
def unique_query(unique_opts)
full_statement = direct_create_statement
Expand All @@ -64,7 +64,7 @@ def unique_query(unique_opts)
query
end
end

# creates a statment hash that contains default values for creating an impression via an AR relation.
def associative_create_statement(query_params={})
query_params.reverse_merge!(
Expand All @@ -77,7 +77,7 @@ def associative_create_statement(query_params={})
:referrer => request.referer
)
end

# creates a statment hash that contains default values for creating an impression.
def direct_create_statement(query_params={})
query_params.reverse_merge!(
Expand All @@ -86,7 +86,7 @@ def direct_create_statement(query_params={})
)
associative_create_statement(query_params)
end

def session_hash
# # careful: request.session_options[:id] encoding in rspec test was ASCII-8BIT
# # that broke the database query for uniqueness. not sure if this is a testing only issue.
Expand All @@ -95,12 +95,12 @@ def session_hash
# # request.session_options[:id].encode("ISO-8859-1")
request.session_options[:id]
end

#use both @current_user and current_user helper
def user_id
user_id = @current_user ? @current_user.id : nil rescue nil
user_id = current_user ? current_user.id : nil rescue nil if user_id.blank?
user_id
end
end
end
end
2 changes: 1 addition & 1 deletion app/models/impression.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ def update_impressions_counter_cache
resouce.try(:update_counter_cache)
end
end
end
end
6 changes: 3 additions & 3 deletions app/models/impressionist/bots.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module Impressionist
module Bots
WILD_CARDS = ["bot","yahoo","slurp","google","msn","crawler"]
LIST = ["<a href='http://www.unchaos.com/'> UnChaos </a> From Chaos To Order Hybrid Web Search Engine.([email protected])",

LIST = ["<a href='http://www.unchaos.com/'> UnChaos </a> From Chaos To Order Hybrid Web Search Engine.([email protected])",
"<a href='http://www.unchaos.com/'> UnChaos Bot Hybrid Web Search Engine. </a> ([email protected])",
"<b> UnChaosBot From Chaos To Order UnChaos Hybrid Web Search Engine at www.unchaos.com </b> ([email protected])",
"<http://www.sygol.com/> http://www.sygol.com",
Expand Down Expand Up @@ -1459,4 +1459,4 @@ module Bots
"zspider/0.9-dev http://feedback.redkolibri.com/",
"ZyBorg/1.0 ([email protected]; http://www.WISEnut.com)"]
end
end
end
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Rails.application.routes.draw do
end
end
4 changes: 2 additions & 2 deletions lib/generators/impressionist/impressionist_generator.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require 'rails/generators'
require 'rails/generators/migration'
require 'rails/generators/migration'

class ImpressionistGenerator < Rails::Generators::Base
include Rails::Generators::Migration
Expand All @@ -17,4 +17,4 @@ def self.next_migration_number(dirname)
def create_migration_file
migration_template 'create_impressions_table.rb', 'db/migrate/create_impressions_table.rb'
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ def self.down

drop_table :impressions
end
end
end
2 changes: 1 addition & 1 deletion lib/impressionist/bots.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ def self.consume
list
end
end
end
end
2 changes: 1 addition & 1 deletion lib/impressionist/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ class Engine < Rails::Engine
end
end
end
end
end
2 changes: 1 addition & 1 deletion test_app/app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :secondary_before_filter

def secondary_before_filter
@test_secondary_before_filter = "this is a test"
end
Expand Down
8 changes: 4 additions & 4 deletions test_app/app/controllers/articles_controller.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
class ArticlesController < ApplicationController
before_filter :test_current_user_var

def test_current_user_var
if session[:user_id]
@current_user = User.new
@current_user.id = session[:user_id]
end
end

def index
impressionist(Article.first,"this is a test article impression")
end

def show
impressionist(Article.first)
end
end
end
14 changes: 7 additions & 7 deletions test_app/app/controllers/posts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ class PostsController < ApplicationController
helper_method :current_user
impressionist
def index

end

def show

end

def edit

end

def current_user
if session[:user_id]
user = User.new
user.id = session[:user_id]
@current_user ||= user
end
end
end
end
10 changes: 5 additions & 5 deletions test_app/app/controllers/widgets_controller.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
class WidgetsController < ApplicationController
impressionist :actions=>[:show,:index], :unique => [:controller_name,:action_name,:impressionable_id]

def show
end

def index
end

def new
end
end

end
2 changes: 1 addition & 1 deletion test_app/app/models/dummy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
class Dummy < ActiveRecord::Base
self.abstract_class = true # doesn't need to be backed by an actual table
is_impressionable
end
end
2 changes: 1 addition & 1 deletion test_app/app/models/user.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class User
attr_accessor :id
end
end
2 changes: 1 addition & 1 deletion test_app/app/views/articles/index.html.erb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%=@impressionist_hash==nil%>
<%=@impressionist_hash==nil%>
2 changes: 1 addition & 1 deletion test_app/app/views/articles/show.html.erb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%=link_to "Same Page", article_url(Article.first)%>
<%=link_to "Same Page", article_url(Article.first)%>
4 changes: 2 additions & 2 deletions test_app/config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test: &test
# adapter: postgresql
# database: impressionist_test
# username: johnmcaliley
# password:
# password:
# host: localhost
# encoding: UTF8

Expand All @@ -27,4 +27,4 @@ production:
timeout: 5000

cucumber:
<<: *test
<<: *test
12 changes: 6 additions & 6 deletions test_app/db/migrate/20111127195013_create_impressions_table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ def self.up
end
add_index :impressions, [:impressionable_type, :impressionable_id, :request_hash], :name => "poly_request_index", :unique => false
add_index :impressions, [:impressionable_type, :impressionable_id, :ip_address], :name => "poly_ip_index", :unique => false
add_index :impressions, [:impressionable_type, :impressionable_id, :session_hash], :name => "poly_session_index", :unique => false
add_index :impressions, [:impressionable_type, :impressionable_id, :session_hash], :name => "poly_session_index", :unique => false
add_index :impressions, [:controller_name,:action_name,:request_hash], :name => "controlleraction_request_index", :unique => false
add_index :impressions, [:controller_name,:action_name,:ip_address], :name => "controlleraction_ip_index", :unique => false
add_index :impressions, [:controller_name,:action_name,:session_hash], :name => "controlleraction_session_index", :unique => false
add_index :impressions, [:controller_name,:action_name,:session_hash], :name => "controlleraction_session_index", :unique => false
add_index :impressions, :user_id
end

def self.down
remove_index :impressions, :name => :poly_request_index
remove_index :impressions, :name => :poly_ip_index
remove_index :impressions, :name => :poly_session_index
remove_index :impressions, :name => :poly_session_index
remove_index :impressions, :name => :controlleraction_request_index
remove_index :impressions, :name => :controlleraction_ip_index
remove_index :impressions, :name => :controlleraction_session_index
remove_index :impressions, :name => :controlleraction_session_index
remove_index :impressions, :user_id

drop_table :impressions
end
end
end
4 changes: 2 additions & 2 deletions test_app/lib/tasks/cucumber.rake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
# It is recommended to regenerate this file in the future when you upgrade to a
# newer version of cucumber-rails. Consider adding your own code to a new file
# It is recommended to regenerate this file in the future when you upgrade to a
# newer version of cucumber-rails. Consider adding your own code to a new file
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
# files.

Expand Down
2 changes: 1 addition & 1 deletion test_app/public/javascripts/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -962,4 +962,4 @@ Form.Element.DelayedObserver = Class.create({
this.timer = null;
this.callback(this.element, $F(this.element));
}
});
});
2 changes: 1 addition & 1 deletion test_app/public/javascripts/dragdrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -971,4 +971,4 @@ Element.findChildren = function(element, only, recursive, tagName) {

Element.offsetSize = function (element, type) {
return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')];
};
};
2 changes: 1 addition & 1 deletion test_app/public/javascripts/effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -1120,4 +1120,4 @@ $w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTex
function(f) { Effect.Methods[f] = Element[f]; }
);

Element.addMethods(Effect.Methods);
Element.addMethods(Effect.Methods);
10 changes: 5 additions & 5 deletions test_app/spec/controllers/controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@
get "show", :id=> 1
Impression.all.size.should eq 11
end

describe "impressionist unique options" do

it "should log unique impressions at the per action level" do
get "show", :id=> 1
Impression.all.size.should eq 12
Expand All @@ -108,7 +108,7 @@
get "index"
Impression.all.size.should eq 14
end

it "should log unique impressions only once per id" do
get "show", :id=> 1
Impression.all.size.should eq 12
Expand All @@ -119,7 +119,7 @@
get "index"
Impression.all.size.should eq 14
end

end

end
2 changes: 1 addition & 1 deletion test_app/spec/fixtures/articles.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
one:
id: 1
name: Test Article
name: Test Article
Loading

0 comments on commit 1174647

Please sign in to comment.