Skip to content

Commit

Permalink
Merged updates from tsevan
Browse files Browse the repository at this point in the history
  • Loading branch information
cannikin committed Mar 25, 2011
2 parents 9325943 + 3747d95 commit 22def91
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 24 deletions.
2 changes: 1 addition & 1 deletion lib/omniture_client.rb
Expand Up @@ -20,5 +20,5 @@ def config(config_hash)
end

if defined?(Rails)
require File.dirname(__FILE__) + '/rails'
require File.dirname(__FILE__) + '/omniture_rails'
end
11 changes: 10 additions & 1 deletion lib/omniture_client/base.rb
Expand Up @@ -13,6 +13,15 @@ def var(name, delimiter = ',', &block)
meta_var
end

def clear_meta_vars
if @meta_vars.present?
@meta_vars.each do |var|
instance_eval("@#{var.name} = nil")
end
@meta_vars = []
end
end

def for_action(name, &block)
RAILS_DEFAULT_LOGGER.info("name = #{name}")
yield
Expand Down Expand Up @@ -47,6 +56,6 @@ def add_var(name, value)
value
end
end

end
end
8 changes: 5 additions & 3 deletions lib/rails.rb → lib/omniture_rails.rb
Expand Up @@ -6,9 +6,10 @@ def self.included(base)
end

module ClassMethods
def reports_to_omniture
def reports_to_omniture(options = {})
include InstanceMethods
before_filter :set_reporter, :assign_flash_vars
before_filter :set_reporter, options
before_filter :assign_flash_vars, options
attr_accessor :reporter
end
end
Expand Down Expand Up @@ -43,6 +44,7 @@ def set_reporter
end

def assign_flash_vars
reporter.class.clear_meta_vars unless omniture_flash.empty?
omniture_flash.each do |name, value|
reporter.add_var(name, value)
end
Expand All @@ -53,4 +55,4 @@ def assign_flash_vars

ActionController::Base.send(:include, OmnitureClient::ActionControllerMethods) if defined?(ActionController::Base)

OmnitureClient::config(YAML::load(File.open(File.join(RAILS_ROOT, 'config', 'omniture.yml')))[RAILS_ENV]) if File.exists?(File.join(RAILS_ROOT, 'config', 'omniture.yml'))
OmnitureClient::config(YAML::load(File.open('config/omniture.yml'))[Rails.env]) if File.exists?('config/omniture.yml')
36 changes: 17 additions & 19 deletions omniture_client.gemspec
@@ -1,6 +1,6 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-

Gem::Specification.new do |s|
Expand All @@ -9,38 +9,36 @@ Gem::Specification.new do |s|

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Alexandru Catighera"]
s.date = %q{2010-01-12}
s.date = %q{2011-02-08}
s.email = %q{alex@patch.com}
s.extra_rdoc_files = [
"README.markdown"
]
s.files = [
".gitignore",
"MIT-LICENSE",
"README.markdown",
"Rakefile",
"VERSION",
"lib/omniture_client.rb",
"lib/omniture_client/base.rb",
"lib/omniture_client/controller_methods.rb",
"lib/omniture_client/meta_var.rb",
"lib/omniture_client/printer.rb",
"lib/omniture_client/var.rb",
"lib/rails.rb",
"omniture_client.gemspec",
"sample/omniture.yml"
"MIT-LICENSE",
"README.markdown",
"Rakefile",
"VERSION",
"lib/omniture_client.rb",
"lib/omniture_client/base.rb",
"lib/omniture_client/controller_methods.rb",
"lib/omniture_client/meta_var.rb",
"lib/omniture_client/printer.rb",
"lib/omniture_client/var.rb",
"lib/omniture_rails.rb",
"omniture_client.gemspec",
"sample/omniture.yml"
]
s.homepage = %q{http://github.com/acatighera/omniture_client}
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.5}
s.rubygems_version = %q{1.3.7}
s.summary = %q{A gem for implementing Omniture for web apps that use Rails, Sinatra, etc}

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3

if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
else
end
else
Expand Down

0 comments on commit 22def91

Please sign in to comment.