rubaidh-google_analytics 1.0.20081111 → 1.1
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/CREDITS +14 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +2 -0
- data/tasks/google_analytics.rake +62 -0
- metadata +4 -2
data/CREDITS
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
This plugin was initially release by Graeme Mathieson, of Rubaidh Ltd.
|
2
|
+
However, since it appeared on github, it has benefited from the contributions
|
3
|
+
of many, including:
|
4
|
+
|
5
|
+
* Mike Gunderloy (ffmike)
|
6
|
+
* Mark Catley (markcatley)
|
7
|
+
* Kenneth Kalmer (kennethkalmer)
|
8
|
+
* Daniel Morrison (danielmorrison)
|
9
|
+
|
10
|
+
Thank you to all these folks for their contributions, and thank you also to
|
11
|
+
Github for facilitating their contribution without having to wait for me to
|
12
|
+
accept patches!
|
13
|
+
|
14
|
+
If I've missed anybody out, please fork, patch and send me a pull request. :-)
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2006-2008 Rubaidh Ltd.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
CHANGED
@@ -0,0 +1,62 @@
|
|
1
|
+
namespace :google_analytics do
|
2
|
+
|
3
|
+
desc "Update the local copy of the Analytics JS"
|
4
|
+
task :update => :environment do
|
5
|
+
file = Rubaidh::GoogleAnalytics.legacy_mode ? 'urchin.js' : 'ga.js'
|
6
|
+
File.open( File.join( RAILS_ROOT, 'public', 'javascripts', file ), 'w+' ) do |f|
|
7
|
+
res = Net::HTTP.get_response( 'www.google-analytics.com', '/' + file )
|
8
|
+
f.write( res.plain_body )
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# Intended to extend the Net::HTTP response object
|
14
|
+
# and adds support for decoding gzip and deflate encoded pages
|
15
|
+
#
|
16
|
+
# Author: Jason Stirk <http://griffin.oobleyboo.com>
|
17
|
+
# Home: http://griffin.oobleyboo.com/projects/http_encoding_helper
|
18
|
+
# Created: 5 September 2007
|
19
|
+
# Last Updated: 23 November 2007
|
20
|
+
#
|
21
|
+
# Usage:
|
22
|
+
#
|
23
|
+
# require 'net/http'
|
24
|
+
# require 'http_encoding_helper'
|
25
|
+
# headers={'Accept-Encoding' => 'gzip, deflate' }
|
26
|
+
# http = Net::HTTP.new('griffin.oobleyboo.com', 80)
|
27
|
+
# http.start do |h|
|
28
|
+
# request = Net::HTTP::Get.new('/', headers)
|
29
|
+
# response = http.request(request)
|
30
|
+
# content=response.plain_body # Method from our library
|
31
|
+
# puts "Transferred: #{response.body.length} bytes"
|
32
|
+
# puts "Compression: #{response['content-encoding']}"
|
33
|
+
# puts "Extracted: #{response.plain_body.length} bytes"
|
34
|
+
# end
|
35
|
+
#
|
36
|
+
|
37
|
+
require 'net/http'
|
38
|
+
require 'zlib'
|
39
|
+
require 'stringio'
|
40
|
+
|
41
|
+
class Net::HTTPResponse
|
42
|
+
# Return the uncompressed content
|
43
|
+
def plain_body
|
44
|
+
encoding=self['content-encoding']
|
45
|
+
content=nil
|
46
|
+
if encoding then
|
47
|
+
case encoding
|
48
|
+
when 'gzip'
|
49
|
+
i=Zlib::GzipReader.new(StringIO.new(self.body))
|
50
|
+
content=i.read
|
51
|
+
when 'deflate'
|
52
|
+
i=Zlib::Inflate.new
|
53
|
+
content=i.inflate(self.body)
|
54
|
+
else
|
55
|
+
raise "Unknown encoding - #{encoding}"
|
56
|
+
end
|
57
|
+
else
|
58
|
+
content=self.body
|
59
|
+
end
|
60
|
+
return content
|
61
|
+
end
|
62
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubaidh-google_analytics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: "1.1"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Graeme Mathieson
|
@@ -30,6 +30,8 @@ extensions: []
|
|
30
30
|
extra_rdoc_files: []
|
31
31
|
|
32
32
|
files:
|
33
|
+
- CREDITS
|
34
|
+
- MIT-LICENSE
|
33
35
|
- README.rdoc
|
34
36
|
- Rakefile
|
35
37
|
- rails/init.rb
|
@@ -38,7 +40,7 @@ files:
|
|
38
40
|
- test/view_helpers_test.rb
|
39
41
|
- lib/rubaidh/google_analytics.rb
|
40
42
|
- lib/rubaidh/view_helpers.rb
|
41
|
-
-
|
43
|
+
- tasks/google_analytics.rake
|
42
44
|
has_rdoc: true
|
43
45
|
homepage: http://github.com/rubaidh/google_analytics/tree/master
|
44
46
|
post_install_message:
|