eventdb 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e67f167886afaad736928ea7019c69acf0f0fbcc
4
- data.tar.gz: 69a6a122068e5610f370321f1e23025850f5e63a
3
+ metadata.gz: fcd85ca2f956cc5d93ae5517a5465cfe2df9eb34
4
+ data.tar.gz: d6face1897c3486f1a6e64e34161600b6ffe0156
5
5
  SHA512:
6
- metadata.gz: 0f39c98b61f4b5082bf7521e30021be2343d08580d077b5580302eb0add55662ee7c54a8b64430389ec56bee5e5b37a9cec589ae1c9c7bc81f657c563baa95ab
7
- data.tar.gz: 472c4751d6849259b130eb2e8d67315614b501b2dc6846ec1154912aa6eb2ad47c4534028cebd01c2365fc143545499b2f67f9faea6a01c18a60e46d3390f3d8
6
+ metadata.gz: 206e344693ced6ae5a7109fb1145f1e40535d9755d8f9fd81be49681103ebbfabc30e577217cdce05800200056d8ea41ddfa4939f21bf0db7b54eb6810bb5294
7
+ data.tar.gz: c3f453fdb052f3fc547fe511001c3f77f7b1b1eea0dea62a28f1d7dcd93d2991b07f2be6bf53b4371565815f4b501729f5c55a63e7947c497fa61f16569de137
data/Manifest.txt CHANGED
@@ -11,7 +11,9 @@ lib/eventdb/reader.rb
11
11
  lib/eventdb/schema.rb
12
12
  lib/eventdb/version.rb
13
13
  test/data/RUBY.md
14
+ test/data/conferences.csv
14
15
  test/data/conferences.yml
16
+ test/data/conferences_ii.yml
15
17
  test/helper.rb
16
18
  test/templates/RUBY.md.erb
17
19
  test/test_calendar.rb
data/README.md CHANGED
@@ -9,22 +9,34 @@ event.db schema 'n' models for easy (re)use
9
9
  * forum :: [ruby-talk@ruby-lang.org](http://www.ruby-lang.org/en/community/mailing-lists)
10
10
 
11
11
 
12
- ## Command Line Tools
12
+ ---
13
13
 
14
- NOTE: The command-line tools (e.g. rubyconf, kickoff, beerfest, etc.)
15
- for listing upcoming events (ruby conferences, football tournaments, beer festivals. etc.)
16
- moved to its own gem, that is, whatson.
14
+ NOTE: Command Line Tools - `rubyconf`, `kickoff`, `beerfest` - Now in `whatson` Package
15
+
16
+ The "out-of-the-box" ready-to-use command line tools (that is, `rubyconf`, `kickoff`, `beerfest`, etc.)
17
+ for listing upcoming events (ruby conferences, football tournaments, beer festivals, etc.)
18
+ moved to its own package / library, that is, `whatson`.
17
19
  See the [whatson project for more »](https://github.com/textkit/whatson)
18
20
 
21
+ ---
22
+
23
+
19
24
 
20
25
  ## Usage
21
26
 
22
27
  ``` ruby
28
+ require 'eventdb'
29
+
30
+ ## Step 1 - Setup (In-Memory) Database and Read-in / Fetch Events
31
+
23
32
  url = "https://github.com/planetruby/calendar/raw/master/_data/conferences2020.yml"
24
33
 
25
34
  db = EventDb::Memory.new # note: use in-memory SQLite database
26
35
  db.read( url )
27
36
 
37
+
38
+ ## Step 2 - Print Out Ongoing and Upcoming Events
39
+
28
40
  today = Date.today
29
41
 
30
42
  puts 'Upcoming Ruby Conferences:'
@@ -32,7 +44,7 @@ puts ''
32
44
 
33
45
  on = EventDb::Model::Event.live( today )
34
46
  on.each do |e|
35
- puts " NOW ON #{current_day(today)}d #{e.title} #{e.start_date.year}, #{e.date_fmt} (#{e.days}d) @ #{e.place}"
47
+ puts " NOW ON #{cur_day(today)}d #{e.title}, #{e.date_fmt} (#{e.days}d) @ #{e.place}"
36
48
  end
37
49
 
38
50
  puts '' if on.any?
@@ -49,9 +61,9 @@ will print in 2020:
49
61
  ```
50
62
  Upcoming Ruby Conferences:
51
63
 
52
- in 62d Rubyfuza, Thu-Sat Feb/6-8 (3d) @ Cape Town, South Africa
53
- in 74d ParisRB Conf, Tue+Wed Feb/18+19 (2d) @ Paris, France
54
- in 76d RubyConf Australia, Thu+Fri Feb/20+21 (2d) @ Melbourne, Victoria, Australia
64
+ in 62d Rubyfuza, Thu-Sat Feb/6-8 (3d) @ Cape Town, South Africa
65
+ in 74d ParisRB Conf, Tue+Wed Feb/18+19 (2d) @ Paris, France
66
+ in 76d RubyConf Australia, Thu+Fri Feb/20+21 (2d) @ Melbourne, Victoria, Australia
55
67
  in 105d Wrocław <3 Ruby (wroclove.rb), Fri-Sun Mar/20-22 (3d) @ Wrocław, Poland
56
68
  in 118d RubyDay Italy, Thu Apr/2 (1d) @ Verona, Veneto, Italy
57
69
  in 125d RubyKaigi, Thu-Sat Apr/9-11 (3d) @ Nagano, Japan
@@ -80,9 +92,9 @@ Upcoming Ruby Conferences:
80
92
  in 71d RubyConf Taiwan, Fri+Sat Sep/11+12 (2d) @ Taipei, Taiwan
81
93
  in 72d RubyConf Portugal, Mon+Tue Sep/14+15 (2d) @ Braga, Portugal
82
94
  in 78d RubyConf Brasil, Fri+Sat Sep/18+19 (2d) @ São Paulo, Brazil
83
- in 83d Rocky Mountain Ruby Conference, Wed-Fri Sep/23-25 (3d) @ Boulder, Colorado, Rocky Mountains, United States
95
+ in 83d Rocky Mountain RubyConf, Wed-Fri Sep/23-25 (3d) @ Boulder, Colorado, Rocky Mountains, United States
84
96
  in 85d Ruby Open Source Software (ROSS) Conference - ROSSConf, Sat Sep/26 (1d) @ Berlin, Germany
85
- in 93d ArrrCamp, Thu+Fri Oct/1+2 (2d) @ Ghent, Oost-Vlaanderen, Belgium
97
+ in 93d ArrrCamp, Thu+Fri Oct/1+2 (2d) @ Ghent, Oost-Vlaanderen, Belgium
86
98
  in 105d RubyConf Colombia, Thu+Fri Oct/15+16 (2d) @ Medellin, Colombia
87
99
  in 107d European Ruby Konference - EuRuKo, Sat+Sun Oct/17+18 (2d) @ Salzburg, Austria
88
100
  in 132d RubyWorld Conference, Wed+Thu Nov/11+12 (2d) @ Matsue, Japan
@@ -90,6 +102,7 @@ Upcoming Ruby Conferences:
90
102
  ```
91
103
 
92
104
 
105
+
93
106
  ## Format
94
107
 
95
108
  **Markdown**
@@ -110,7 +123,7 @@ Option 1b) Modern Style
110
123
 
111
124
  **YAML**
112
125
 
113
- Option 2a) Classic Style A
126
+ Option 2a) Style A
114
127
 
115
128
  ``` yaml
116
129
  - title: European Ruby Konference - EuRuKo
@@ -120,7 +133,7 @@ Option 2a) Classic Style A
120
133
  end_date: 2020-08-22
121
134
  ```
122
135
 
123
- Option 2b) Classic Style B
136
+ Option 2b) Style B
124
137
 
125
138
  ``` yaml
126
139
  - name: European Ruby Konference - EuRuKo
@@ -130,16 +143,39 @@ Option 2b) Classic Style B
130
143
  end: 2020-08-22
131
144
  ```
132
145
 
146
+ **CSV**
147
+
148
+ Option 3a) Style A
149
+
150
+ ``` csv
151
+ title, link, place, start_date, end_date
152
+ European Ruby Konference - EuRuKo, http://euruko.org, "Helsinki, Finnland", 2020-08-21, 2020-08-22
153
+ ```
154
+
155
+ Option 3b) Style B
156
+
157
+ ``` csv
158
+ name, url, location, start, end
159
+ European Ruby Konference - EuRuKo, http://euruko.org, "Helsinki, Finnland", 2020-08-21, 2020-08-22
160
+ ```
161
+
162
+ Option 3c) Style C
163
+
164
+ ``` csv
165
+ subject, website_url, location, start_date, end_date
166
+ European Ruby Konference - EuRuKo, http://euruko.org, "Helsinki, Finnland", 2020-08-21, 2020-08-22
167
+ ```
168
+
133
169
 
134
170
  resulting in:
135
171
 
136
172
  ```
137
173
  #<Event
138
- title: "European Ruby Konference - EuRuKo",
139
- link: "http://euruko.org",
140
- place: "Helsinki, Finnland",
141
- start_date: Fri, 21 Aug 2020,
142
- end_date: Sat, 22 Aug 2020>
174
+ title: "European Ruby Konference - EuRuKo",
175
+ link: "http://euruko.org",
176
+ place: "Helsinki, Finnland",
177
+ start_date: Fri, 21 Aug 2020,
178
+ end_date: Sat, 22 Aug 2020>
143
179
  ```
144
180
 
145
181
  Note: The headings hierarchy (starting w/ heading level 2) gets added to the place as a
@@ -155,20 +191,28 @@ geo tree. Example:
155
191
  ##### Bavaria
156
192
 
157
193
  ###### Upper Franconia
194
+
195
+ - [**Sandwerka (Sandkirchweih)**](http://www.sandkerwa.de)
196
+ - 2020 @ Bamberg, Aug/20-24
158
197
  ```
159
198
 
160
199
  resulting in:
161
200
 
162
201
  ```
163
- Upper Franconia, Bavaria, Germany, Central Europe, Europe
202
+ #<Event
203
+ title: "Sandwerka (Sandkirchweih)",
204
+ link: "http://www.sandkerwa.de",
205
+ place: "Bamberg, Upper Franconia, Bavaria, Germany, Central Europe, Europe",
206
+ ...>
164
207
  ```
165
208
 
166
209
 
210
+
167
211
  ## Public Event Datasets
168
212
 
169
- - [calendar @ Planet Ruby](https://github.com/planetruby/calendar) - a collection of awesome Ruby events (meetups, conferences, camps, etc.) from around the world
170
- - [calendar @ World Football Book](https://github.com/footballbook/calendar) - a collection of awesome football tournaments, cups, etc. from around the world
171
- - [calendar @ World Beer Book](https://github.com/beerbook/calendar) - a collection of awesome beer events (oktoberfest, starkbierfest, etc.) from around the world
213
+ - [Calendar @ Planet Ruby](https://github.com/planetruby/calendar) - a collection of awesome Ruby events (meetups, conferences, camps, etc.) from around the world
214
+ - [Calendar @ World Football Book](https://github.com/footballbook/calendar) - a collection of awesome football tournaments, cups, etc. from around the world
215
+ - [Calendar @ World Beer Book](https://github.com/beerbook/calendar) - a collection of awesome beer events (oktoberfest, starkbierfest, etc.) from around the world
172
216
 
173
217
 
174
218
 
data/Rakefile CHANGED
@@ -20,6 +20,7 @@ Hoe.spec 'eventdb' do
20
20
  self.extra_deps = [
21
21
  ['props', '>= 1.2.0'], # settings / prop(ertie)s / env / INI
22
22
  ['logutils', '>= 0.6.1'], # logging
23
+ ['csvreader', '>= 1.2.4'], # read tabular (csv) data
23
24
 
24
25
  ## 3rd party
25
26
  ['activerecord'], # NB: will include activesupport,etc.
data/lib/eventdb.rb CHANGED
@@ -10,6 +10,7 @@ require 'erb'
10
10
  # 3rd party libs (gems)
11
11
  require 'props'
12
12
  require 'logutils'
13
+ require 'csvreader'
13
14
 
14
15
  require 'props/activerecord'
15
16
  require 'logutils/activerecord'
@@ -23,6 +23,8 @@ class EventReader
23
23
  parser = if path.end_with?( '.yml') ||
24
24
  path.end_with?( '.yaml')
25
25
  YamlParser.new( txt )
26
+ elsif path.end_with?( '.csv')
27
+ CsvParser.new( txt )
26
28
  else
27
29
  MarkdownParser.new( txt )
28
30
  end
@@ -30,6 +32,46 @@ class EventReader
30
32
  end
31
33
 
32
34
 
35
+ class CsvParser
36
+ def self.parse( text ) new( text ).parse; end
37
+
38
+
39
+ include LogUtils::Logging
40
+
41
+ def initialize( text )
42
+ @text = text
43
+ end
44
+
45
+ def parse
46
+ events = []
47
+ recs = CsvHash.parse( @text, :header_converters => :symbol )
48
+
49
+ ## note:
50
+ ## support python's conferences.csv
51
+ ## subject => name / title
52
+ ## website_url => url / link
53
+
54
+ recs.each do |rec|
55
+ title = rec[:name] || rec[:title] || rec[:subject]
56
+ link = rec[:url] || rec[:link] || rec[:website_url]
57
+ place = rec[:location] || rec[:place]
58
+
59
+ start_date = Date.strptime( rec[:start] || rec[:start_date], '%Y-%m-%d' )
60
+ end_date = Date.strptime( rec[:end] || rec[:end_date], '%Y-%m-%d' )
61
+
62
+ event = Event.new( title, link,
63
+ place,
64
+ start_date, end_date )
65
+ ## pp event
66
+
67
+ events << event
68
+ end
69
+
70
+ events
71
+ end
72
+ end # class CsvParser
73
+
74
+
33
75
  class YamlParser
34
76
  def self.parse( text ) new( text ).parse; end
35
77
 
@@ -45,21 +87,13 @@ class YamlParser
45
87
  recs = YAML.load( @text )
46
88
 
47
89
  recs.each do |rec|
48
- if rec.has_key?( 'title' ) ||
49
- rec.has_key?( 'link' ) ||
50
- rec.has_key?( 'place' )
51
- title = rec['title']
52
- link = rec['link']
53
- place = rec['place']
54
- start_date = rec['start_date'] # note: already parsed into a date (NOT string) by yaml parser!!
55
- end_date = rec['end_date'] # note: already parsed into a date (NOT string) by yaml parser!!
56
- else ## assume "default" format
57
- title = rec['name']
58
- link = rec['url']
59
- place = rec['location']
60
- start_date = rec['start'] # note: already parsed into a date (NOT string) by yaml parser!!
61
- end_date = rec['end'] # note: already parsed into a date (NOT string) by yaml parser!!
62
- end
90
+ title = rec['name'] || rec['title']
91
+ link = rec['url'] || rec['link']
92
+ place = rec['location'] || rec['place']
93
+
94
+ # note: already parsed into a date (NOT string) by yaml parser!!
95
+ start_date = rec['start'] || rec['start_date']
96
+ end_date = rec['end'] || rec['end_date']
63
97
 
64
98
  event = Event.new( title, link,
65
99
  place,
@@ -3,7 +3,7 @@
3
3
  module EventDb
4
4
 
5
5
  MAJOR = 1 ## todo: namespace inside version or something - why? why not??
6
- MINOR = 0
6
+ MINOR = 1
7
7
  PATCH = 0
8
8
  VERSION = [MAJOR,MINOR,PATCH].join('.')
9
9
 
@@ -0,0 +1,15 @@
1
+ ## source: https://github.com/python-organizers/conferences/blob/master/2020.csv
2
+
3
+ Subject,Start Date,End Date,Location,Country,Venue,Tutorial Deadline,Talk Deadline,Website URL,Proposal URL,Sponsorship URL
4
+ PyCascades,2020-02-08,2020-02-09,"Portland, Oregon, United States of America",USA,Revolution Hall,,2019-10-01,https://2020.pycascades.com,https://www.papercall.io/pycascades-2020,https://2020.pycascades.com/become-a-sponsor/
5
+ PyCon Namibia,2020-02-18,2020-02-20,"Windhoek, Namibia",NAM,,,2019-12-27,https://na.pycon.org/,https://na.pycon.org/call-proposals/,
6
+ PyTennessee,2020-03-07,2020-03-08,"Nashville, Tennessee, United States of America",USA,Nashville School of Law,,,https://www.pytennessee.org/,https://www.pytennessee.org/prospectus,
7
+ PyCon US,2020-04-15,2020-04-23,"Pittsburgh, Pennsylvania, United States of America",USA,David L. Lawrence Convention Center,2019-11-22,2019-12-20,https://us.pycon.org/,https://us.pycon.org/2020/speaking/talks/,https://us.pycon.org/2020/sponsors/
8
+ PyTexas,2020-05-16,2020-05-17,"Austin, Texas, United States of America",USA,,,,https://www.pytexas.org/2020/,,
9
+ PyCon Italy,2020-04-02,2020-04-05,"Florence, Italy",ITA,"Grand Hotel Mediterraneo",,,https://www.pycon.it/en/,,https://www.pycon.it/en/sponsor/
10
+ EuroPython,2020-07-20,2020-07-26,"Dublin, Ireland",IRL,,,,,,
11
+ PyOhio,2020-07-25,2020-07-26,"Columbus, Ohio, United States of America",USA,"The Ohio Union",,,https://www.pyohio.org/2020/,,
12
+ EuroSciPy,2020-07-27,2020-07-31,"Bilbao, Spain",ESP,"Bizkaia Aretoa",,,https://www.euroscipy.org/,,
13
+ GeoPython,2020-07-27,2020-07-31,"Bilbao, Spain",ESP,"Bizkaia Aretoa",,,http://2020.geopython.net,,
14
+ "PyConDE & PyData Berlin 2020",2020-10-14,2020-10-16,"Berlin, Germany",DEU,,,,https://de.pycon.org,,https://de.pycon.org/sponsors/
15
+ "Moscow Python Conf ++ 2020",2020-03-27,2020-03-27,"Moscow, Russia",RUS,"Infospace",,2020-01-13,https://conf.python.ru/en/2020,https://onticoconferences.typeform.com/to/OySCUQ,
@@ -1,43 +1,34 @@
1
1
  #############################
2
2
  # ruby event news in 2020
3
+ #
4
+ # source: https://github.com/planetruby/calendar/blob/master/_data/conferences2020.yml
3
5
 
4
6
  - name: Rubyfuza
5
7
  location: Cape Town, South Africa
6
8
  start: 2020-02-06 # February 6-8, 2020
7
9
  end: 2020-02-08
8
- days: 3
9
- month: 2
10
10
  url: http://www.rubyfuza.org
11
11
  twitter: rubyfuza
12
- updated: 2019-12-03 ## note: used for feed.xml|json
13
12
 
14
13
  - name: ParisRB Conf
15
14
  location: Paris, France
16
15
  start: 2020-02-18 # February 18-19, 2020
17
16
  end: 2020-02-19
18
- days: 2
19
- month: 2
20
17
  url: https://2020.rubyparis.org
21
18
  twitter: parisrb
22
- updated: 2019-12-03 ## note: used for feed.xml|json
23
19
 
24
20
  - name: RubyConf Australia
25
21
  location: Melbourne, Victoria, Australia
26
22
  start: 2020-02-20
27
23
  end: 2020-02-21
28
- days: 2
29
- month: 2
30
24
  url: https://www.rubyconf.org.au/2020
31
25
  twitter: rubyconf_au
32
- updated: 2019-12-03 ## note: used for feed.xml|json
33
26
 
34
27
 
35
28
  - name: Wrocław <3 Ruby (wroclove.rb)
36
29
  location: Wrocław, Poland
37
30
  start: 2020-03-20 # 20-22th March, 2020
38
31
  end: 2020-03-22
39
- days: 3
40
- month: 3
41
32
  url: https://wrocloverb.com
42
33
  twitter: wrocloverb
43
34
 
@@ -46,8 +37,6 @@
46
37
  location: Verona, Veneto, Italy
47
38
  start: 2020-04-02
48
39
  end: 2020-04-02
49
- days: 1
50
- month: 4
51
40
  url: https://2020.rubyday.it
52
41
  twitter: rubydayit
53
42
 
@@ -56,8 +45,6 @@
56
45
  location: Nagano, Japan
57
46
  start: 2020-04-09
58
47
  end: 2020-04-11
59
- days: 3
60
- month: 4
61
48
  url: https://rubykaigi.org/2020
62
49
  twitter: rubykaigi
63
50
 
@@ -65,8 +52,6 @@
65
52
  location: Goa, India
66
53
  start: 2020-04-25 # April 25-26 2020
67
54
  end: 2020-04-26
68
- days: 2
69
- month: 4
70
55
  url: http://rubyconfindia.org
71
56
  twitter: rubyconfindia
72
57
 
@@ -76,8 +61,6 @@
76
61
  location: Portland, Oregon, United States
77
62
  start: 2020-05-05
78
63
  end: 2020-05-07
79
- days: 3
80
- month: 5
81
64
  url: https://railsconf.com
82
65
  twitter: railsconf
83
66
 
@@ -85,8 +68,6 @@
85
68
  location: Sofia, Bulgaria
86
69
  start: 2020-05-15
87
70
  end: 2020-05-16
88
- days: 2
89
- month: 5
90
71
  url: https://balkanruby.com
91
72
  twitter: balkanruby
92
73
 
@@ -95,8 +76,6 @@
95
76
  location: Hamburg, Germany
96
77
  start: 2020-06-06 ## June 6th & 7th 2020
97
78
  end: 2020-06-07
98
- days: 2
99
- month: 6
100
79
  url: http://2020.rubyunconf.eu
101
80
  twitter: rubyunconfeu
102
81
 
@@ -105,8 +84,6 @@
105
84
  location: Brighton, Sussex, England, United Kingdom
106
85
  start: 2020-07-03
107
86
  end: 2020-07-03
108
- days: 1
109
- month: 7
110
87
  url: https://brightonruby.com
111
88
  twitter: brightonruby
112
89
 
@@ -114,8 +91,6 @@
114
91
  location: Nairobi, Kenya
115
92
  start: 2020-07-23
116
93
  end: 2020-07-25
117
- days: 3
118
- month: 7
119
94
  url: http://rubyconf.nairuby.org/2020
120
95
  twitter: nairubyke
121
96
 
@@ -124,8 +99,6 @@
124
99
  location: Helsinki, Finnland
125
100
  start: 2020-08-21 # 21–22.8.2020
126
101
  end: 2020-08-22
127
- days: 2
128
- month: 8
129
102
  url: https://euruko2020.org
130
103
  twitter: euruko
131
104
 
@@ -134,7 +107,5 @@
134
107
  location: Houston, Texas, United States
135
108
  start: 2020-11-17
136
109
  end: 2020-11-19
137
- days: 3
138
- month: 11
139
110
  url: https://rubyconf.org
140
111
  twitter: rubyconf
@@ -0,0 +1,68 @@
1
+ ## source: https://github.com/ruby-conferences/ruby-conferences.github.io/blob/master/_data/conferences.yml
2
+
3
+ - name: Rubyfuza
4
+ location: Cape Town, South Africa
5
+ start_date: 2020-02-06
6
+ end_date: 2020-02-08
7
+ url: http://www.rubyfuza.org
8
+ twitter: rubyfuza
9
+
10
+ - name: ParisRB Conf
11
+ location: Paris, France
12
+ url: https://2020.rubyparis.org/
13
+ start_date: 2020-02-18
14
+ end_date: 2020-02-19
15
+ twitter: parisrb
16
+
17
+ - name: RubyConf AU
18
+ location: Melbourne, Australia
19
+ url: https://www.rubyconf.org.au/2020
20
+ start_date: 2020-02-20
21
+ end_date: 2020-02-21
22
+ twitter: rubyconf_au
23
+
24
+
25
+ - name: RubyDay
26
+ location: Verona, Italy
27
+ start_date: 2020-04-02
28
+ end_date: 2020-04-02
29
+ url: https://2020.rubyday.it
30
+ twitter: rubydayit
31
+
32
+ - name: RubyKaigi
33
+ location: Nagano, Japan
34
+ start_date: 2020-04-09
35
+ end_date: 2020-04-11
36
+ url: https://rubykaigi.org/2020
37
+ twitter: rubykaigi
38
+
39
+
40
+ - name: RailsConf
41
+ location: Portland, OR
42
+ start_date: 2020-05-05
43
+ end_date: 2020-05-07
44
+ url: https://railsconf.com/
45
+ twitter: railsconf
46
+
47
+ - name: Balkan Ruby
48
+ location: Sofia, Bulgaria
49
+ start_date: 2020-05-15
50
+ end_date: 2020-05-16
51
+ url: https://balkanruby.com
52
+ twitter: balkanruby
53
+
54
+
55
+ - name: Brighton Ruby Conf
56
+ location: Brighton, UK
57
+ start_date: 2020-07-03
58
+ end_date: 2020-07-03
59
+ url: https://brightonruby.com
60
+ twitter: brightonruby
61
+
62
+
63
+ - name: RubyConf
64
+ location: Houston, TX
65
+ start_date: 2020-11-17
66
+ end_date: 2020-11-19
67
+ url: https://rubyconf.org
68
+ twitter: rubyconf
data/test/test_parser.rb CHANGED
@@ -49,17 +49,54 @@ TXT
49
49
  txt =<<TXT
50
50
  # Awesome Events
51
51
 
52
- - name: Rails Rumble
53
- url: https://railsrumble.com
54
- place: Intertubes, Online
55
- start: 2014-10-18
56
- end: 2014-10-19
57
-
58
- - name: JekyllConf
59
- url: http://jekyllconf.com
60
- place: Intertubes, Online
61
- start: 2015-05-02
62
- end: 2015-05-02
52
+ - name: Rails Rumble
53
+ url: https://railsrumble.com
54
+ location: Intertubes, Online
55
+ start: 2014-10-18
56
+ end: 2014-10-19
57
+
58
+ - name: JekyllConf
59
+ url: http://jekyllconf.com
60
+ location: Intertubes, Online
61
+ start: 2015-05-02
62
+ end: 2015-05-02
63
+ TXT
64
+
65
+ events = EventDb::EventReader::YamlParser.parse( txt )
66
+
67
+ ## pp events
68
+ ev = events[0]
69
+
70
+ assert_equal 'Rails Rumble', ev.title
71
+ assert_equal 'https://railsrumble.com', ev.link
72
+ assert_equal 'Intertubes, Online', ev.place
73
+ assert_equal Date.new(2014,10,18), ev.start_date
74
+ assert_equal Date.new(2014,10,19), ev.end_date
75
+
76
+ ev = events[1]
77
+
78
+ assert_equal 'JekyllConf', ev.title
79
+ assert_equal 'http://jekyllconf.com', ev.link
80
+ assert_equal 'Intertubes, Online', ev.place
81
+ assert_equal Date.new(2015,5,2), ev.start_date
82
+ end
83
+
84
+ def test_ruby_yaml_ii
85
+ ## use variants e.g. start_date/end_date (instead of start/end)
86
+ txt =<<TXT
87
+ # Awesome Events
88
+
89
+ - name: Rails Rumble
90
+ url: https://railsrumble.com
91
+ location: Intertubes, Online
92
+ start_date: 2014-10-18
93
+ end_date: 2014-10-19
94
+
95
+ - name: JekyllConf
96
+ url: http://jekyllconf.com
97
+ location: Intertubes, Online
98
+ start_date: 2015-05-02
99
+ end_date: 2015-05-02
63
100
  TXT
64
101
 
65
102
  events = EventDb::EventReader::YamlParser.parse( txt )
data/test/test_reader.rb CHANGED
@@ -9,8 +9,7 @@ require 'helper'
9
9
 
10
10
  class TestReader < MiniTest::Test
11
11
 
12
- def test_ruby
13
-
12
+ def test_markdown
14
13
  events = EventDb::EventReader.read( "#{EventDb.root}/test/data/RUBY.md" )
15
14
 
16
15
  ## pp events
@@ -31,4 +30,28 @@ class TestReader < MiniTest::Test
31
30
  assert_equal Date.new(2015,5,2), ev.start_date
32
31
  end
33
32
 
33
+ def test_csv
34
+ rows = CsvHash.read( "#{EventDb.root}/test/data/conferences.csv", :header_converters => :symbol )
35
+ pp rows
36
+
37
+ events = EventDb::EventReader.read( "#{EventDb.root}/test/data/conferences.csv" )
38
+
39
+ ## pp events
40
+ ev = events[0]
41
+
42
+ assert_equal 'PyCascades', ev.title
43
+ assert_equal 'https://2020.pycascades.com', ev.link
44
+ assert_equal 'Portland, Oregon, United States of America', ev.place
45
+ assert_equal Date.new(2020, 2, 8), ev.start_date
46
+ assert_equal Date.new(2020, 2, 9), ev.end_date
47
+
48
+ ev = events[1]
49
+
50
+ assert_equal 'PyCon Namibia', ev.title
51
+ assert_equal 'https://na.pycon.org/', ev.link
52
+ assert_equal 'Windhoek, Namibia', ev.place
53
+ assert_equal Date.new(2020, 2, 18), ev.start_date
54
+ assert_equal Date.new(2020, 2, 20), ev.end_date
55
+ end
56
+
34
57
  end # class TestReader
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eventdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-06 00:00:00.000000000 Z
11
+ date: 2019-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: props
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.6.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: csvreader
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 1.2.4
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 1.2.4
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: activerecord
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -130,7 +144,9 @@ files:
130
144
  - lib/eventdb/schema.rb
131
145
  - lib/eventdb/version.rb
132
146
  - test/data/RUBY.md
147
+ - test/data/conferences.csv
133
148
  - test/data/conferences.yml
149
+ - test/data/conferences_ii.yml
134
150
  - test/helper.rb
135
151
  - test/templates/RUBY.md.erb
136
152
  - test/test_calendar.rb