Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cleanup trailing whitespace

Trailing whitespace isn't friendly to git or vim users.
  • Loading branch information...
commit 1174647779f8cd7ed3f11fae8d8e78f7dc052e18 1 parent 9db9a8e
@sferik sferik authored
Showing with 104 additions and 104 deletions.
  1. +1 −1  CHANGELOG.rdoc
  2. +1 −1  VERSION
  3. +9 −9 app/controllers/impressionist_controller.rb
  4. +1 −1  app/models/impression.rb
  5. +3 −3 app/models/impressionist/bots.rb
  6. +1 −1  config/routes.rb
  7. +2 −2 lib/generators/impressionist/impressionist_generator.rb
  8. +1 −1  lib/generators/impressionist/templates/create_impressions_table.rb
  9. +1 −1  lib/impressionist/bots.rb
  10. +1 −1  lib/impressionist/engine.rb
  11. +1 −1  test_app/app/controllers/application_controller.rb
  12. +4 −4 test_app/app/controllers/articles_controller.rb
  13. +7 −7 test_app/app/controllers/posts_controller.rb
  14. +5 −5 test_app/app/controllers/widgets_controller.rb
  15. +1 −1  test_app/app/models/dummy.rb
  16. +1 −1  test_app/app/models/user.rb
  17. +1 −1  test_app/app/views/articles/index.html.erb
  18. +1 −1  test_app/app/views/articles/show.html.erb
  19. +2 −2 test_app/config/database.yml
  20. +6 −6 test_app/db/migrate/20111127195013_create_impressions_table.rb
  21. +2 −2 test_app/lib/tasks/cucumber.rake
  22. +1 −1  test_app/public/javascripts/controls.js
  23. +1 −1  test_app/public/javascripts/dragdrop.js
  24. +1 −1  test_app/public/javascripts/effects.js
  25. +5 −5 test_app/spec/controllers/controller_spec.rb
  26. +1 −1  test_app/spec/fixtures/articles.yml
  27. +7 −7 test_app/spec/fixtures/impressions.yml
  28. +1 −1  test_app/spec/fixtures/posts.yml
  29. +1 −1  test_app/spec/fixtures/widgets.yml
  30. +3 −3 test_app/spec/intializers/initializers_spec.rb
  31. +1 −1  test_app/spec/models/counter_caching_spec.rb
  32. +17 −17 test_app/spec/models/model_spec.rb
  33. +2 −2 test_app/spec/rails_generators/rails_generators_spec.rb
  34. +2 −2 test_app/spec/spec_helper.rb
  35. +7 −7 upgrade_migrations/version_0_3_0.rb
  36. +2 −2 upgrade_migrations/version_0_4_0.rb
View
2  CHANGELOG.rdoc
@@ -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
View
2  VERSION
@@ -1 +1 @@
-1.0.1
+1.0.1
View
18 app/controllers/impressionist_controller.rb
@@ -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
@@ -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!(
@@ -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!(
@@ -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.
@@ -95,7 +95,7 @@ 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
@@ -103,4 +103,4 @@ def user_id
user_id
end
end
-end
+end
View
2  app/models/impression.rb
@@ -13,4 +13,4 @@ def update_impressions_counter_cache
resouce.try(:update_counter_cache)
end
end
-end
+end
View
6 app/models/impressionist/bots.rb
@@ -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.(vadim_gonchar@unchaos.com)",
+
+ LIST = ["<a href='http://www.unchaos.com/'> UnChaos </a> From Chaos To Order Hybrid Web Search Engine.(vadim_gonchar@unchaos.com)",
"<a href='http://www.unchaos.com/'> UnChaos Bot Hybrid Web Search Engine. </a> (vadim_gonchar@unchaos.com)",
"<b> UnChaosBot From Chaos To Order UnChaos Hybrid Web Search Engine at www.unchaos.com </b> (info@unchaos.com)",
"<http://www.sygol.com/> http://www.sygol.com",
@@ -1459,4 +1459,4 @@ module Bots
"zspider/0.9-dev http://feedback.redkolibri.com/",
"ZyBorg/1.0 (ZyBorg@WISEnut.com; http://www.WISEnut.com)"]
end
-end
+end
View
2  config/routes.rb
@@ -1,2 +1,2 @@
Rails.application.routes.draw do
-end
+end
View
4 lib/generators/impressionist/impressionist_generator.rb
@@ -1,5 +1,5 @@
require 'rails/generators'
-require 'rails/generators/migration'
+require 'rails/generators/migration'
class ImpressionistGenerator < Rails::Generators::Base
include Rails::Generators::Migration
@@ -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
View
2  lib/generators/impressionist/templates/create_impressions_table.rb
@@ -34,4 +34,4 @@ def self.down
drop_table :impressions
end
-end
+end
View
2  lib/impressionist/bots.rb
@@ -15,4 +15,4 @@ def self.consume
list
end
end
-end
+end
View
2  lib/impressionist/engine.rb
@@ -14,4 +14,4 @@ class Engine < Rails::Engine
end
end
end
-end
+end
View
2  test_app/app/controllers/application_controller.rb
@@ -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
View
8 test_app/app/controllers/articles_controller.rb
@@ -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
View
14 test_app/app/controllers/posts_controller.rb
@@ -2,17 +2,17 @@ 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
@@ -20,4 +20,4 @@ def current_user
@current_user ||= user
end
end
-end
+end
View
10 test_app/app/controllers/widgets_controller.rb
@@ -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
View
2  test_app/app/models/dummy.rb
@@ -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
View
2  test_app/app/models/user.rb
@@ -1,3 +1,3 @@
class User
attr_accessor :id
-end
+end
View
2  test_app/app/views/articles/index.html.erb
@@ -1 +1 @@
-<%=@impressionist_hash==nil%>
+<%=@impressionist_hash==nil%>
View
2  test_app/app/views/articles/show.html.erb
@@ -1 +1 @@
-<%=link_to "Same Page", article_url(Article.first)%>
+<%=link_to "Same Page", article_url(Article.first)%>
View
4 test_app/config/database.yml
@@ -16,7 +16,7 @@ test: &test
# adapter: postgresql
# database: impressionist_test
# username: johnmcaliley
-# password:
+# password:
# host: localhost
# encoding: UTF8
@@ -27,4 +27,4 @@ production:
timeout: 5000
cucumber:
- <<: *test
+ <<: *test
View
12 test_app/db/migrate/20111127195013_create_impressions_table.rb
@@ -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
View
4 test_app/lib/tasks/cucumber.rake
@@ -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.
View
2  test_app/public/javascripts/controls.js
@@ -962,4 +962,4 @@ Form.Element.DelayedObserver = Class.create({
this.timer = null;
this.callback(this.element, $F(this.element));
}
-});
+});
View
2  test_app/public/javascripts/dragdrop.js
@@ -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')];
-};
+};
View
2  test_app/public/javascripts/effects.js
@@ -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);
View
10 test_app/spec/controllers/controller_spec.rb
@@ -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
@@ -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
@@ -119,7 +119,7 @@
get "index"
Impression.all.size.should eq 14
end
-
+
end
-
+
end
View
2  test_app/spec/fixtures/articles.yml
@@ -1,3 +1,3 @@
one:
id: 1
- name: Test Article
+ name: Test Article
View
14 test_app/spec/fixtures/impressions.yml
@@ -16,7 +16,7 @@ impression8:
session_hash: b1
ip_address: 127.0.0.1
created_at: 2010-01-01
-
+
impression9:
impressionable_type: Article
impressionable_id: 1
@@ -24,20 +24,20 @@ impression9:
session_hash: b2
ip_address: 127.0.0.1
created_at: 2011-01-03
-
+
impression10:
impressionable_type: Article
impressionable_id: 1
request_hash: a9
session_hash: b3
ip_address: 127.0.0.8
- created_at: 2010-01-01
-
+ created_at: 2010-01-01
+
impression11:
impressionable_type: Article
impressionable_id: 1
request_hash: a10
- session_hash: b4
+ session_hash: b4
ip_address: 127.0.0.1
- created_at: 2010-01-01
-
+ created_at: 2010-01-01
+
View
2  test_app/spec/fixtures/posts.yml
@@ -1,3 +1,3 @@
one:
id: 1
- name: Test Post
+ name: Test Post
View
2  test_app/spec/fixtures/widgets.yml
@@ -1,4 +1,4 @@
one:
id: 1
name: A Widget
- impressions_count: 0
+ impressions_count: 0
View
6 test_app/spec/intializers/initializers_spec.rb
@@ -5,14 +5,14 @@
method = RUBY_VERSION.match("1.8") ? "is_impressionable" : :is_impressionable
ActiveRecord::Base.methods.include?(method).should be true
end
-
+
it "should include methods in ApplicationController" do
method = RUBY_VERSION.match("1.8") ? "impressionist" : :impressionist
ApplicationController.instance_methods.include?(method).should be true
end
-
+
it "should include the before_filter method in ApplicationController" do
filters = ApplicationController._process_action_callbacks.select { |c| c.kind == :before }
filters.collect{|filter|filter.filter}.include?(:impressionist_app_filter).should be true
end
-end
+end
View
2  test_app/spec/models/counter_caching_spec.rb
@@ -27,4 +27,4 @@
end
end
-end
+end
View
34 test_app/spec/models/model_spec.rb
@@ -2,33 +2,33 @@
describe Impression do
fixtures :articles,:impressions,:posts
-
+
before(:each) do
@article = Article.find(1)
end
-
+
it "should save a blank impression for an Article that has 10 impressions" do
@article.impressions.create
@article.impressions.size.should eq 12
end
-
+
it "should save an impression with a message" do
@article.impressions.create(:message=>"test message")
@article.impressions.last.message.should eq "test message"
end
-
+
it "should return the impression count for all with no date range specified" do
@article.impressionist_count(:filter=>:all).should eq 11
end
-
+
it "should return unique impression count with no date range specified" do
@article.impressionist_count.should eq 9
end
-
+
it "should return impression count with only start date specified" do
@article.impressionist_count(:start_date=>"2011-01-01",:filter=>:all).should eq 8
end
-
+
it "should return impression count with whole date range specified" do
@article.impressionist_count(:start_date=>"2011-01-01",:end_date=>"2011-01-02",:filter=>:all).should eq 7
end
@@ -36,11 +36,11 @@
it "should return unique impression count with only start date specified" do
@article.impressionist_count(:start_date=>"2011-01-01").should eq 7
end
-
+
it "should return unique impression count with date range specified" do
@article.impressionist_count(:start_date=>"2011-01-01",:end_date=>"2011-01-02").should eq 7
end
-
+
it "should return unique impression count using ip address (which in turn eliminates duplicate request_hashes)" do
@article.impressionist_count(:filter=>:ip_address).should eq 8
end
@@ -48,7 +48,7 @@
it "should return unique impression count using session_hash (which in turn eliminates duplicate request_hashes)" do
@article.impressionist_count(:filter=>:session_hash).should eq 7
end
-
+
# tests :dependent => :destroy
it "should delete impressions on deletion of impressionable" do
impressions_count = Impression.all.size
@@ -58,20 +58,20 @@
a.destroyed?.should be_true
i.destroyed?.should be_true
end
-
+
#OLD COUNT METHODS. DEPRECATE SOON
it "should return the impression count with no date range specified" do
@article.impression_count.should eq 11
end
-
+
it "should return unique impression count with no date range specified" do
@article.unique_impression_count.should eq 9
end
-
+
it "should return impression count with only start date specified" do
@article.impression_count("2011-01-01").should eq 8
end
-
+
it "should return impression count with whole date range specified" do
@article.impression_count("2011-01-01","2011-01-02").should eq 7
end
@@ -79,11 +79,11 @@
it "should return unique impression count with only start date specified" do
@article.unique_impression_count("2011-01-01").should eq 7
end
-
+
it "should return unique impression count with date range specified" do
@article.unique_impression_count("2011-01-01","2011-01-02").should eq 7
end
-
+
it "should return unique impression count using ip address (which in turn eliminates duplicate request_hashes)" do
@article.unique_impression_count_ip.should eq 8
end
@@ -91,4 +91,4 @@
it "should return unique impression count using session_hash (which in turn eliminates duplicate request_hashes)" do
@article.unique_impression_count_session.should eq 7
end
-end
+end
View
4 test_app/spec/rails_generators/rails_generators_spec.rb
@@ -13,9 +13,9 @@
migration_name = generator_output.split("migrate/")[1].strip
Dir.entries(migrations_dir).include?(migration_name).should be true
end
-
+
it "should run the migration created in the previous spec" do
migrate_output = systemu("rake db:migrate RAILS_ENV=test")
migrate_output[1].include?("CreateImpressionsTable: migrated").should be true
end
-end
+end
View
4 test_app/spec/spec_helper.rb
@@ -24,10 +24,10 @@
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = true
-
+
# make the rails logger usable in the tests as logger.xxx "..."
def logger
Rails.logger
end
-
+
end
View
14 upgrade_migrations/version_0_3_0.rb
@@ -5,23 +5,23 @@ def self.up
remove_index :impressions, :name => :controlleraction_index
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
+
end
def self.down
remove_column :impressions, :session_hash
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
add_index :impressions, [:impressionable_type, :impressionable_id, :request_hash, :ip_address], :name => "poly_index", :unique => false
- add_index :impressions, [:controller_name,:action_name,:request_hash,:ip_address], :name => "controlleraction_index", :unique => false
+ add_index :impressions, [:controller_name,:action_name,:request_hash,:ip_address], :name => "controlleraction_index", :unique => false
end
-end
+end
View
4 upgrade_migrations/version_0_4_0.rb
@@ -1,9 +1,9 @@
class Version04UpdateImpressionsTable < ActiveRecord::Migration
def self.up
- add_column :impressions, :referrer, :string
+ add_column :impressions, :referrer, :string
end
def self.down
remove_column :impressions, :referrer
end
-end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.