rugalytics 0.0.7 → 0.0.8

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/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ v0.0.8. moved i18n date parse method to Rugalytics module
2
+
1
3
  v0.0.7. consolidated on US English spelling of pageviews for method names
2
4
 
3
5
  v0.0.6. fixed report date parsing bug reported by masolino
@@ -25,8 +25,8 @@ module Rugalytics
25
25
 
26
26
  def with_dates_from_period period, list
27
27
  dates = period.split('-')
28
- from = Date.i18n_parse(dates[0].strip)
29
- to = Date.i18n_parse(dates[1].strip)
28
+ from = Rugalytics.i18n_date_parse(dates[0].strip)
29
+ to = Rugalytics.i18n_date_parse(dates[1].strip)
30
30
 
31
31
  index = 0
32
32
  from.upto(to) do |date|
@@ -42,8 +42,8 @@ module Rugalytics
42
42
  @base_url = lines[1]
43
43
  @report_name = lines[2].chomp(',')
44
44
  dates = lines[3].include?('","') ? lines[3].split('","') : lines[3].split(',')
45
- @start_date = Date.i18n_parse(dates[0])
46
- @end_date = Date.i18n_parse(dates[1])
45
+ @start_date = Rugalytics.i18n_date_parse(dates[0])
46
+ @end_date = Rugalytics.i18n_date_parse(dates[1])
47
47
  end
48
48
 
49
49
  def handle_graphs lines
data/lib/rugalytics.rb CHANGED
@@ -11,7 +11,7 @@ require 'yaml'
11
11
 
12
12
  # See README for usage documentation.
13
13
  module Rugalytics
14
- VERSION = "0.0.7"
14
+ VERSION = "0.0.8"
15
15
 
16
16
  FORMAT_PDF = '0' unless defined? FORMAT_PDF
17
17
  FORMAT_XML = '1' unless defined? FORMAT_XML
@@ -72,6 +72,18 @@ module Rugalytics
72
72
  OpenStruct.new(hash)
73
73
  end
74
74
 
75
+ def i18n_date_parse text
76
+ if text.include? '年'
77
+ text = text.sub('年','-')
78
+ text = text.sub('月','-')
79
+ text = text.sub('日','')
80
+ end
81
+ begin
82
+ Date.parse(text)
83
+ rescue Exception => e
84
+ raise "#{e}: #{text}"
85
+ end
86
+ end
75
87
  end
76
88
  end
77
89
 
@@ -81,6 +93,5 @@ require File.dirname(__FILE__) + '/rugalytics/profile'
81
93
  require File.dirname(__FILE__) + '/rugalytics/report'
82
94
  require File.dirname(__FILE__) + '/rugalytics/item'
83
95
  require File.dirname(__FILE__) + '/rugalytics/graph'
84
- require File.dirname(__FILE__) + '/rugalytics/date_extension'
85
96
 
86
97
  # Rugalytics.config_setup(RAILS_ROOT) if defined?(RAILS_ROOT) && RAILS_ROOT
data/rugalytics.gemspec CHANGED
@@ -1,18 +1,18 @@
1
1
 
2
- # Gem::Specification for Rugalytics-0.0.7
2
+ # Gem::Specification for Rugalytics-0.0.8
3
3
  # Originally generated by Echoe
4
4
 
5
5
  --- !ruby/object:Gem::Specification
6
6
  name: rugalytics
7
7
  version: !ruby/object:Gem::Version
8
- version: 0.0.7
8
+ version: 0.0.8
9
9
  platform: ruby
10
10
  authors:
11
11
  - Rob McKinnon
12
12
  autorequire:
13
13
  bindir: bin
14
14
 
15
- date: 2008-08-05 00:00:00 +01:00
15
+ date: 2008-08-06 00:00:00 +01:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
@@ -112,5 +112,9 @@ describe Rugalytics do
112
112
  Rugalytics.default_profile.should == profile
113
113
  end
114
114
  end
115
-
115
+ describe 'when parsing Japanese formatted date' do
116
+ it 'should parse correctly' do
117
+ Rugalytics.i18n_date_parse('2008年7月29日').should == Date.new(2008,7,29)
118
+ end
119
+ end
116
120
  end
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.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob McKinnon
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-08-05 00:00:00 +01:00
12
+ date: 2008-08-06 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency