statwhore 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +3 -0
- data/License.txt +19 -0
- data/Manifest.txt +31 -0
- data/README.txt +4 -0
- data/Rakefile +4 -0
- data/config/hoe.rb +71 -0
- data/config/requirements.rb +17 -0
- data/lib/statwhore/connection.rb +38 -0
- data/lib/statwhore/google/analytics/account.rb +34 -0
- data/lib/statwhore/google/analytics/profile.rb +77 -0
- data/lib/statwhore/google/analytics.rb +17 -0
- data/lib/statwhore/google/feedburner.rb +27 -0
- data/lib/statwhore/google.rb +2 -0
- data/lib/statwhore/version.rb +9 -0
- data/lib/statwhore.rb +16 -0
- data/log/debug.log +0 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +74 -0
- data/setup.rb +1585 -0
- data/spec/fixtures/analytics_account_find_all.html +296 -0
- data/spec/fixtures/analytics_profile_find_all.html +296 -0
- data/spec/fixtures/dashboard_report_webgroup.xml +2705 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +5 -0
- data/spec/statwhore_google_analytics_account_spec.rb +39 -0
- data/spec/statwhore_google_analytics_profile_spec.rb +45 -0
- data/spec/statwhore_google_analytics_spec.rb +1 -0
- data/tasks/deployment.rake +27 -0
- data/tasks/environment.rake +7 -0
- data/tasks/website.rake +17 -0
- metadata +113 -0
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
+
|
3
|
+
describe "Statwhore::Google::Analytics::Account" do
|
4
|
+
|
5
|
+
describe "being initialized" do
|
6
|
+
|
7
|
+
it "should accept :name as key" do
|
8
|
+
a = Statwhore::Google::Analytics::Account.new(:name => 'test')
|
9
|
+
a.name.should == 'test'
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should accept :account_id as key" do
|
13
|
+
a = Statwhore::Google::Analytics::Account.new(:account_id => '12341234')
|
14
|
+
a.account_id.should == '12341234'
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should be able to find all accounts for user" do
|
20
|
+
html = open(File.dirname(__FILE__) + '/fixtures/analytics_account_find_all.html').read
|
21
|
+
Statwhore::Google::Analytics::Account.should_receive(:get).and_return(html)
|
22
|
+
accounts = Statwhore::Google::Analytics::Account.find_all
|
23
|
+
accounts.collect(&:name).should == %w[alumni.nd.edu webgroup.nd.edu]
|
24
|
+
accounts.collect(&:account_id).should == %w[1254221 344381].map(&:to_i)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should be able to find profiles for an account" do
|
28
|
+
html = open(File.dirname(__FILE__) + '/fixtures/analytics_profile_find_all.html').read
|
29
|
+
Statwhore::Google::Analytics::Profile.should_receive(:get).and_return(html)
|
30
|
+
accounts = Statwhore::Google::Analytics::Account.new(:name => 'alumni.nd.edu', :account_id => '1254221').profiles
|
31
|
+
accounts.collect(&:name).should == ["pray.nd.edu"]
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should print kind of pretty" do
|
35
|
+
account = Statwhore::Google::Analytics::Account.new(:name => 'alumni.nd.edu', :account_id => '1254221')
|
36
|
+
account.to_s.should == "alumni.nd.edu (1254221)"
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
+
|
3
|
+
describe "Statwhore::Google::Analytics::Profile" do
|
4
|
+
|
5
|
+
describe "being initialized" do
|
6
|
+
|
7
|
+
it "should accept :name as key" do
|
8
|
+
a = Statwhore::Google::Analytics::Profile.new(:name => 'test', :profile_id => '12341234')
|
9
|
+
a.name.should == 'test'
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should accept :account_id as key" do
|
13
|
+
a = Statwhore::Google::Analytics::Profile.new(:account_id => '12341234', :profile_id => '12341234')
|
14
|
+
a.account_id.should == '12341234'
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should accept :profile_id as key" do
|
18
|
+
a = Statwhore::Google::Analytics::Profile.new(:profile_id => '12341234')
|
19
|
+
a.profile_id.should == '12341234'
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should be able to find all profiles for an account" do
|
25
|
+
html = open(File.dirname(__FILE__) + '/fixtures/analytics_profile_find_all.html').read
|
26
|
+
Statwhore::Google::Analytics::Profile.should_receive(:get).and_return(html)
|
27
|
+
accounts = Statwhore::Google::Analytics::Profile.find_all('1254221')
|
28
|
+
accounts.collect(&:name).should == ["pray.nd.edu"]
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should be able to get pageviews" do
|
32
|
+
profile = Statwhore::Google::Analytics::Profile.new(:account_id => 344381, :profile_id => 543890)
|
33
|
+
xml = open(File.dirname(__FILE__) + '/fixtures/dashboard_report_webgroup.xml').read
|
34
|
+
Statwhore::Google::Analytics::Profile.should_receive(:get).and_return(xml)
|
35
|
+
profile.pageviews.should == 283
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should be able to get visits" do
|
39
|
+
profile = Statwhore::Google::Analytics::Profile.new(:account_id => 344381, :profile_id => 543890)
|
40
|
+
xml = open(File.dirname(__FILE__) + '/fixtures/dashboard_report_webgroup.xml').read
|
41
|
+
Statwhore::Google::Analytics::Profile.should_receive(:get).and_return(xml)
|
42
|
+
profile.visits.should == 228
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
desc 'Release the website and new gem version'
|
2
|
+
task :deploy => [:check_version, :website, :release] do
|
3
|
+
puts "Remember to create SVN tag:"
|
4
|
+
puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
|
5
|
+
"svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
|
6
|
+
puts "Suggested comment:"
|
7
|
+
puts "Tagging release #{CHANGES}"
|
8
|
+
end
|
9
|
+
|
10
|
+
desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
|
11
|
+
task :local_deploy => [:website_generate, :install_gem]
|
12
|
+
|
13
|
+
task :check_version do
|
14
|
+
unless ENV['VERSION']
|
15
|
+
puts 'Must pass a VERSION=x.y.z release version'
|
16
|
+
exit
|
17
|
+
end
|
18
|
+
unless ENV['VERSION'] == VERS
|
19
|
+
puts "Please update your version.rb to match the release version, currently #{VERS}"
|
20
|
+
exit
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
|
25
|
+
task :install_gem_no_doc => [:clean, :package] do
|
26
|
+
sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
|
27
|
+
end
|
data/tasks/website.rake
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
desc 'Generate website files'
|
2
|
+
task :website_generate => :ruby_env do
|
3
|
+
# (Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt|
|
4
|
+
# sh %{ #{RUBY_APP} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
|
5
|
+
# end
|
6
|
+
end
|
7
|
+
|
8
|
+
desc 'Upload website files to rubyforge'
|
9
|
+
task :website_upload do
|
10
|
+
host = "#{rubyforge_username}@rubyforge.org"
|
11
|
+
remote_dir = "/var/www/gforge-projects/#{RUBYFORGE_PROJECT}/"
|
12
|
+
local_dir = 'website'
|
13
|
+
sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
|
14
|
+
end
|
15
|
+
|
16
|
+
desc 'Generate and upload website files'
|
17
|
+
task :website => [:website_generate, :website_upload, :publish_docs]
|
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: statwhore
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- FIXME full name
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-05-12 00:00:00 -04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: googlebase
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.2.0
|
23
|
+
version:
|
24
|
+
- !ruby/object:Gem::Dependency
|
25
|
+
name: activesupport
|
26
|
+
version_requirement:
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 2.0.2
|
32
|
+
version:
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: hpricot
|
35
|
+
version_requirement:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: "0.6"
|
41
|
+
version:
|
42
|
+
description: description of gem
|
43
|
+
email: FIXME email
|
44
|
+
executables: []
|
45
|
+
|
46
|
+
extensions: []
|
47
|
+
|
48
|
+
extra_rdoc_files:
|
49
|
+
- History.txt
|
50
|
+
- License.txt
|
51
|
+
- Manifest.txt
|
52
|
+
- README.txt
|
53
|
+
files:
|
54
|
+
- History.txt
|
55
|
+
- License.txt
|
56
|
+
- Manifest.txt
|
57
|
+
- README.txt
|
58
|
+
- Rakefile
|
59
|
+
- config/hoe.rb
|
60
|
+
- config/requirements.rb
|
61
|
+
- lib/statwhore.rb
|
62
|
+
- lib/statwhore/connection.rb
|
63
|
+
- lib/statwhore/google.rb
|
64
|
+
- lib/statwhore/google/analytics.rb
|
65
|
+
- lib/statwhore/google/analytics/account.rb
|
66
|
+
- lib/statwhore/google/analytics/profile.rb
|
67
|
+
- lib/statwhore/google/feedburner.rb
|
68
|
+
- lib/statwhore/version.rb
|
69
|
+
- log/debug.log
|
70
|
+
- script/destroy
|
71
|
+
- script/generate
|
72
|
+
- script/txt2html
|
73
|
+
- setup.rb
|
74
|
+
- spec/fixtures/analytics_account_find_all.html
|
75
|
+
- spec/fixtures/analytics_profile_find_all.html
|
76
|
+
- spec/fixtures/dashboard_report_webgroup.xml
|
77
|
+
- spec/spec.opts
|
78
|
+
- spec/spec_helper.rb
|
79
|
+
- spec/statwhore_google_analytics_account_spec.rb
|
80
|
+
- spec/statwhore_google_analytics_profile_spec.rb
|
81
|
+
- spec/statwhore_google_analytics_spec.rb
|
82
|
+
- tasks/deployment.rake
|
83
|
+
- tasks/environment.rake
|
84
|
+
- tasks/website.rake
|
85
|
+
has_rdoc: true
|
86
|
+
homepage: http://statwhore.rubyforge.org
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options:
|
89
|
+
- --main
|
90
|
+
- README.txt
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: "0"
|
98
|
+
version:
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: "0"
|
104
|
+
version:
|
105
|
+
requirements: []
|
106
|
+
|
107
|
+
rubyforge_project: statwhore
|
108
|
+
rubygems_version: 1.1.1
|
109
|
+
signing_key:
|
110
|
+
specification_version: 2
|
111
|
+
summary: description of gem
|
112
|
+
test_files: []
|
113
|
+
|