yandex_metrika 0.0.1 → 0.0.2

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
@@ -18,11 +18,16 @@ begin
18
18
  gem.email = "zed.0xff@gmail.com"
19
19
  gem.homepage = "http://github.com/zed-0xff/yandex_metrika"
20
20
  gem.authors = ["Andrey 'Zed' Zaikin"]
21
+ gem.rubyforge_project = 'yandex-metrika'
21
22
  #gem.add_development_dependency "thoughtbot-shoulda"
22
23
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
23
24
  gem.add_dependency 'actionpack', '>= 2.3.3'
24
25
  gem.add_dependency 'activesupport', '>= 2.3.3'
25
26
  end
27
+ Jeweler::GemcutterTasks.new
28
+ # Jeweler::RubyforgeTasks.new do |rubyforge|
29
+ # rubyforge.doc_task = "rdoc"
30
+ # end
26
31
  rescue LoadError
27
32
  puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
28
33
  end
@@ -51,7 +56,7 @@ task :test => :check_dependencies
51
56
 
52
57
  task :default => :test
53
58
 
54
- require 'rake/rdoctask'
59
+ require 'rdoc/task'
55
60
  Rake::RDocTask.new do |rdoc|
56
61
  if File.exist?('VERSION')
57
62
  version = File.read('VERSION')
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -13,19 +13,20 @@ module Yandex # :nodoc:
13
13
  def metrika_code
14
14
  Metrika.code if Metrika.enabled?(request.format)
15
15
  end
16
-
16
+
17
17
  # An after_filter to automatically add the metrika code.
18
18
  def add_yandex_metrika_code
19
- if Metrika.defer_load
20
- response.body.sub! /<\/[bB][oO][dD][yY]>/, "#{metrika_code}</body>" if response.body.respond_to?(:sub!)
21
- else
22
- response.body.sub! /(<[bB][oO][dD][yY][^>]*>)/, "\\1#{metrika_code}" if response.body.respond_to?(:sub!)
23
- end
19
+ response.body =
20
+ if Metrika.defer_load
21
+ response.body.sub /<\/[bB][oO][dD][yY]>/, "#{metrika_code}</body>"
22
+ else
23
+ response.body.sub /(<[bB][oO][dD][yY][^>]*>)/, "\\1#{metrika_code}"
24
+ end
24
25
  end
25
26
  end
26
27
 
27
28
  class ConfigurationError < StandardError #:nodoc:
28
- DEFAULT_MESSAGE = "Yandex::Metrika.counter_id is not set in config/environment.rb or config/initializers/yandex_metrika.rb"
29
+ DEFAULT_MESSAGE = "Yandex::Metrika.counter_id is not set in config/initializers/yandex_metrika.rb"
29
30
 
30
31
  def initialize(message = nil)
31
32
  super(message || DEFAULT_MESSAGE)
@@ -37,7 +38,7 @@ module Yandex # :nodoc:
37
38
  # :singleton-method:
38
39
  # Specify the Yandex.Metrika COUNTER_ID for this web site. This can be found
39
40
  # as the value of "new Ya.Metrika(123456)", where 123456 is the actual ID.
40
- cattr_accessor :counter_id
41
+ cattr_accessor :counter_id
41
42
 
42
43
  @@environments = ['production']
43
44
  ##
@@ -45,7 +46,7 @@ module Yandex # :nodoc:
45
46
  # The environments in which to enable the Yandex.Metrika code. Defaults
46
47
  # to 'production' only. Supply an array of environment names to change this.
47
48
  cattr_accessor :environments
48
-
49
+
49
50
  @@formats = [:html, :all]
50
51
  ##
51
52
  # :singleton-method:
@@ -58,19 +59,19 @@ module Yandex # :nodoc:
58
59
  @@defer_load = true
59
60
  ##
60
61
  # :singleton-method:
61
- # Set this to true (the default) if you want to load the Metrika javascript at
62
+ # Set this to true (the default) if you want to load the Metrika javascript at
62
63
  # the bottom of page. Set this to false if you want to load the Metrika
63
64
  # javascript at the top of the page. The page will render faster if you set this to
64
65
  # true.
65
66
  cattr_accessor :defer_load
66
-
67
+
67
68
  # Return true if the Yandex.Metrika system is enabled and configured
68
69
  # correctly for the specified format
69
70
  def self.enabled?(format)
70
71
  raise ConfigurationError if counter_id.blank?
71
- environments.include?(RAILS_ENV) && formats.include?(format.to_sym)
72
+ environments.include?(Rails.env) && formats.include?(format.to_sym)
72
73
  end
73
-
74
+
74
75
  # Construct the javascript code to be inserted on the calling page.
75
76
  def self.code
76
77
  <<-EOHTML
File without changes
@@ -1,15 +1,15 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{yandex_metrika}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Andrey 'Zed' Zaikin"]
12
- s.date = %q{2009-10-12}
11
+ s.authors = [%q{Andrey 'Zed' Zaikin}]
12
+ s.date = %q{2011-05-21}
13
13
  s.description = %q{[Rails] Easily enable Yandex.Metrika support in your Rails application.
14
14
  <br/><br/>
15
15
  By default this gem will output Yandex.Metrika code for every page automagically, if it's configured correctly. This is done by adding: <br/>
@@ -18,38 +18,32 @@ to your `config/environment.rb`, inserting your own COUNTER_ID. This can be disc
18
18
  s.email = %q{zed.0xff@gmail.com}
19
19
  s.extra_rdoc_files = [
20
20
  "LICENSE",
21
- "README.rdoc"
21
+ "README.rdoc"
22
22
  ]
23
23
  s.files = [
24
24
  ".document",
25
- ".gitignore",
26
- "CREDITS",
27
- "LICENSE",
28
- "README.rdoc",
29
- "Rakefile",
30
- "VERSION",
31
- "lib/yandex.rb",
32
- "lib/yandex/metrika.rb",
33
- "rails/init.rb",
34
- "test/test_helper.rb",
35
- "test/yandex_metrika_test.rb",
36
- "yandex_metrika.gemspec"
25
+ "CREDITS",
26
+ "LICENSE",
27
+ "README.rdoc",
28
+ "Rakefile",
29
+ "VERSION",
30
+ "lib/yandex.rb",
31
+ "lib/yandex/metrika.rb",
32
+ "lib/yandex_metrika.rb",
33
+ "test/test_helper.rb",
34
+ "test/yandex_metrika_test.rb",
35
+ "yandex_metrika.gemspec"
37
36
  ]
38
37
  s.homepage = %q{http://github.com/zed-0xff/yandex_metrika}
39
- s.rdoc_options = ["--charset=UTF-8"]
40
- s.require_paths = ["lib"]
41
- s.rubygems_version = %q{1.3.5}
38
+ s.require_paths = [%q{lib}]
39
+ s.rubyforge_project = %q{yandex-metrika}
40
+ s.rubygems_version = %q{1.8.3}
42
41
  s.summary = %q{[Rails] Easily enable Yandex.Metrika support in your Rails application.}
43
- s.test_files = [
44
- "test/yandex_metrika_test.rb",
45
- "test/test_helper.rb"
46
- ]
47
42
 
48
43
  if s.respond_to? :specification_version then
49
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
50
44
  s.specification_version = 3
51
45
 
52
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
46
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
53
47
  s.add_runtime_dependency(%q<actionpack>, [">= 2.3.3"])
54
48
  s.add_runtime_dependency(%q<activesupport>, [">= 2.3.3"])
55
49
  else
@@ -61,3 +55,4 @@ to your `config/environment.rb`, inserting your own COUNTER_ID. This can be disc
61
55
  s.add_dependency(%q<activesupport>, [">= 2.3.3"])
62
56
  end
63
57
  end
58
+
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yandex_metrika
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ prerelease:
5
+ version: 0.0.2
5
6
  platform: ruby
6
7
  authors:
7
8
  - Andrey 'Zed' Zaikin
@@ -9,29 +10,30 @@ autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
12
 
12
- date: 2009-10-12 00:00:00 +06:00
13
- default_executable:
13
+ date: 2011-05-21 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: actionpack
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
23
  version: 2.3.3
24
- version:
24
+ type: :runtime
25
+ version_requirements: *id001
25
26
  - !ruby/object:Gem::Dependency
26
27
  name: activesupport
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
28
+ prerelease: false
29
+ requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
30
31
  requirements:
31
32
  - - ">="
32
33
  - !ruby/object:Gem::Version
33
34
  version: 2.3.3
34
- version:
35
+ type: :runtime
36
+ version_requirements: *id002
35
37
  description: |-
36
38
  [Rails] Easily enable Yandex.Metrika support in your Rails application.
37
39
  <br/><br/>
@@ -48,7 +50,6 @@ extra_rdoc_files:
48
50
  - README.rdoc
49
51
  files:
50
52
  - .document
51
- - .gitignore
52
53
  - CREDITS
53
54
  - LICENSE
54
55
  - README.rdoc
@@ -56,38 +57,36 @@ files:
56
57
  - VERSION
57
58
  - lib/yandex.rb
58
59
  - lib/yandex/metrika.rb
59
- - rails/init.rb
60
+ - lib/yandex_metrika.rb
60
61
  - test/test_helper.rb
61
62
  - test/yandex_metrika_test.rb
62
63
  - yandex_metrika.gemspec
63
- has_rdoc: true
64
64
  homepage: http://github.com/zed-0xff/yandex_metrika
65
65
  licenses: []
66
66
 
67
67
  post_install_message:
68
- rdoc_options:
69
- - --charset=UTF-8
68
+ rdoc_options: []
69
+
70
70
  require_paths:
71
71
  - lib
72
72
  required_ruby_version: !ruby/object:Gem::Requirement
73
+ none: false
73
74
  requirements:
74
75
  - - ">="
75
76
  - !ruby/object:Gem::Version
76
77
  version: "0"
77
- version:
78
78
  required_rubygems_version: !ruby/object:Gem::Requirement
79
+ none: false
79
80
  requirements:
80
81
  - - ">="
81
82
  - !ruby/object:Gem::Version
82
83
  version: "0"
83
- version:
84
84
  requirements: []
85
85
 
86
- rubyforge_project:
87
- rubygems_version: 1.3.5
86
+ rubyforge_project: yandex-metrika
87
+ rubygems_version: 1.8.3
88
88
  signing_key:
89
89
  specification_version: 3
90
90
  summary: "[Rails] Easily enable Yandex.Metrika support in your Rails application."
91
- test_files:
92
- - test/yandex_metrika_test.rb
93
- - test/test_helper.rb
91
+ test_files: []
92
+
data/.gitignore DELETED
@@ -1,5 +0,0 @@
1
- *.sw?
2
- .DS_Store
3
- coverage
4
- rdoc
5
- pkg