rugalytics 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ v0.1.4. now use fastercsv to parse table row data
2
+
1
3
  v0.1.3. fixed bug due to change in google's graph csv date labels
2
4
 
3
5
  v0.1.2. added profile.report_names method; handle '.' or '/' in graph column names without failing
data/README CHANGED
@@ -47,7 +47,11 @@ If account name and profile name are the same:
47
47
  At present your language setting for your Google Analytics account
48
48
  must be set to English for Rugalytics to work.
49
49
 
50
- Google: Settings -> Language: choose UK English or US English
50
+ Google: Settings -> Language: choose UK English
51
+
52
+ OR
53
+
54
+ Google: Settings -> Language: choose US English
51
55
 
52
56
 
53
57
  == Get Profile Summary Statistics
data/README.rdoc CHANGED
@@ -47,7 +47,11 @@ If account name and profile name are the same:
47
47
  At present your language setting for your Google Analytics account
48
48
  must be set to English for Rugalytics to work.
49
49
 
50
- Google: Settings -> Language: choose UK English or US English
50
+ Google: Settings -> Language: choose UK English
51
+
52
+ OR
53
+
54
+ Google: Settings -> Language: choose US English
51
55
 
52
56
 
53
57
  == Get Profile Summary Statistics
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ begin
10
10
  m.rubyforge_name = "rugalytics"
11
11
  m.rdoc_options << '--inline-source'
12
12
  m.rdoc_pattern = ["README", "CHANGELOG", "LICENSE"]
13
- m.dependencies = ["hpricot >=0.6", "activesupport >=2.0.2", "googlebase >=0.2.0", "morph >=0.2.0"]
13
+ m.dependencies = ["hpricot >=0.6", "activesupport >=2.0.2", "googlebase >=0.2.0", "morph >=0.2.0", "fastercsv >=1.4.0"]
14
14
  m.executable_pattern = 'bin/rugalytics'
15
15
  end
16
16
 
@@ -94,8 +94,9 @@ module Rugalytics
94
94
  items_attribute = (type && type.size > 0) ? "#{type.gsub(/([a-z])([A-Z])/, '\1_\2').downcase}_items" : 'items'
95
95
  morph(items_attribute, items)
96
96
 
97
- while (values = lines[index]) && values[/^# -/].nil? && values.strip.size > 0
98
- items << Item.new(attributes, values.split(','), base_url)
97
+ while (values_line = lines[index]) && values_line[/^# -/].nil? && values_line.strip.size > 0
98
+ values = FasterCSV.parse_line(values_line)
99
+ items << Item.new(attributes, values, base_url)
99
100
  index = index.next
100
101
  end
101
102
  end
@@ -1,4 +1,3 @@
1
- require 'yaml'
2
1
  require 'webrick'
3
2
  include WEBrick
4
3
 
@@ -13,6 +12,13 @@ module Rugalytics
13
12
 
14
13
  class Server
15
14
  def initialize
15
+ begin
16
+ require 'webrick'
17
+ self.class.send(:include, WEBrick)
18
+ rescue LoadError
19
+ puts "You need to have webrick installed to run a rugalytics server"
20
+ end
21
+
16
22
  @profile = Rugalytics.default_profile
17
23
 
18
24
  server = HTTPServer.new :Port => 8888
data/lib/rugalytics.rb CHANGED
@@ -8,10 +8,11 @@ require 'activesupport'
8
8
  require 'google/base'
9
9
  require 'morph'
10
10
  require 'yaml'
11
+ require 'fastercsv'
11
12
 
12
13
  # See README for usage documentation.
13
14
  module Rugalytics
14
- VERSION = "0.1.3"
15
+ VERSION = "0.1.4"
15
16
 
16
17
  FORMAT_PDF = '0' unless defined? FORMAT_PDF
17
18
  FORMAT_XML = '1' unless defined? FORMAT_XML
data/rugalytics.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{rugalytics}
5
- s.version = "0.1.3"
5
+ s.version = "0.1.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Rob McKinnon"]
@@ -30,12 +30,14 @@ Gem::Specification.new do |s|
30
30
  s.add_runtime_dependency(%q<activesupport>, [">= 2.0.2"])
31
31
  s.add_runtime_dependency(%q<googlebase>, [">= 0.2.0"])
32
32
  s.add_runtime_dependency(%q<morph>, [">= 0.2.0"])
33
+ s.add_runtime_dependency(%q<fastercsv>, [">= 1.4.0"])
33
34
  s.add_development_dependency(%q<echoe>, [">= 0"])
34
35
  else
35
36
  s.add_dependency(%q<hpricot>, [">= 0.6"])
36
37
  s.add_dependency(%q<activesupport>, [">= 2.0.2"])
37
38
  s.add_dependency(%q<googlebase>, [">= 0.2.0"])
38
39
  s.add_dependency(%q<morph>, [">= 0.2.0"])
40
+ s.add_dependency(%q<fastercsv>, [">= 1.4.0"])
39
41
  s.add_dependency(%q<echoe>, [">= 0"])
40
42
  end
41
43
  else
@@ -43,6 +45,7 @@ Gem::Specification.new do |s|
43
45
  s.add_dependency(%q<activesupport>, [">= 2.0.2"])
44
46
  s.add_dependency(%q<googlebase>, [">= 0.2.0"])
45
47
  s.add_dependency(%q<morph>, [">= 0.2.0"])
48
+ s.add_dependency(%q<fastercsv>, [">= 1.4.0"])
46
49
  s.add_dependency(%q<echoe>, [">= 0"])
47
50
  end
48
51
  end
@@ -98,9 +98,9 @@ describe Report do
98
98
  describe "when creating items from 'Table'" do
99
99
  before :all do
100
100
  @base_url = %Q|your_site.com|
101
- @attributes = %Q|URL,Page Views,Unique Page Views,Time on Page,Bounce Rate,% Exit,$ Index|
102
- @values1 = %Q|/,189,157,54.94957983193277,0.4862385392189026,0.37037035822868347,0.0|
103
- @values2 = %Q|/bills,60,38,54.17307692307692,0.0,0.13333334028720856,0.0|
101
+ @attributes = %Q|URL,Page Views,Unique Page Views,Time on Page,Bounce Rate,% Exit,$ Index, Keyword|
102
+ @values1 = %Q|/,189,157,54.94957983193277,0.4862385392189026,0.37037035822868347,0.0,"ABC, Project"|
103
+ @values2 = %Q|/bills,60,38,54.17307692307692,0.0,0.13333334028720856,0.0,shoes|
104
104
  @csv = ['# ----------------------------------------',
105
105
  @base_url,
106
106
  'Top Content,',
@@ -118,8 +118,10 @@ describe Report do
118
118
  it 'should create item for each data row in "Table"' do
119
119
  item1 = mock('item1')
120
120
  item2 = mock('item2')
121
- Item.should_receive(:new).with(@attributes.split(','), @values1.split(','), @base_url).and_return item1
122
- Item.should_receive(:new).with(@attributes.split(','), @values2.split(','), @base_url).and_return item2
121
+ array1 = ['/','189','157','54.94957983193277','0.4862385392189026','0.37037035822868347','0.0',"ABC, Project"]
122
+ array2 = ['/bills','60','38','54.17307692307692','0.0','0.13333334028720856','0.0','shoes']
123
+ Item.should_receive(:new).with(@attributes.split(','), array1, @base_url).and_return item1
124
+ Item.should_receive(:new).with(@attributes.split(','), array2, @base_url).and_return item2
123
125
 
124
126
  report = Report.new(@csv.join("\n"))
125
127
  report.items.should == [item1, item2]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rugalytics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob McKinnon
@@ -52,6 +52,16 @@ dependencies:
52
52
  - !ruby/object:Gem::Version
53
53
  version: 0.2.0
54
54
  version:
55
+ - !ruby/object:Gem::Dependency
56
+ name: fastercsv
57
+ type: :runtime
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: 1.4.0
64
+ version:
55
65
  - !ruby/object:Gem::Dependency
56
66
  name: echoe
57
67
  type: :development