eventdb 1.1.0 → 1.1.1

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: fcd85ca2f956cc5d93ae5517a5465cfe2df9eb34
4
- data.tar.gz: d6face1897c3486f1a6e64e34161600b6ffe0156
3
+ metadata.gz: 9169738a5ad4fee9be73ee07be118ca0863f3010
4
+ data.tar.gz: 1c130ff583526395bcd4ac0166ffb3ba20d687c7
5
5
  SHA512:
6
- metadata.gz: 206e344693ced6ae5a7109fb1145f1e40535d9755d8f9fd81be49681103ebbfabc30e577217cdce05800200056d8ea41ddfa4939f21bf0db7b54eb6810bb5294
7
- data.tar.gz: c3f453fdb052f3fc547fe511001c3f77f7b1b1eea0dea62a28f1d7dcd93d2991b07f2be6bf53b4371565815f4b501729f5c55a63e7947c497fa61f16569de137
6
+ metadata.gz: 0a76a72bbfd9208ce180775670c27b435a4f5c49ca270188846bf37224cf36331bdc57b79c414f831c9e0f451f88a34179f9cc2e267f1ef44fe1c05aa3c03e62
7
+ data.tar.gz: ec52d123d9fa07c6acbbfacd708ed2a81d7abb2b96fde2a54da83b71b867c88e80a53fc3d12d8eb8b50de36062015177c5602db14fcb62702f5e5e8ad6f15018
@@ -1,5 +1,6 @@
1
1
  CHANGELOG.md
2
2
  Manifest.txt
3
+ NOTES.md
3
4
  README.md
4
5
  Rakefile
5
6
  lib/eventdb.rb
@@ -14,6 +15,7 @@ test/data/RUBY.md
14
15
  test/data/conferences.csv
15
16
  test/data/conferences.yml
16
17
  test/data/conferences_ii.yml
18
+ test/data/test.txt
17
19
  test/helper.rb
18
20
  test/templates/RUBY.md.erb
19
21
  test/test_calendar.rb
@@ -0,0 +1,12 @@
1
+ # Notes
2
+
3
+
4
+ # ToDos
5
+
6
+ - add to schema tags - why? why not?
7
+ - add an (optional) country and city field to schema - why? why not?
8
+ - lets you search/filter by country
9
+ - lets you add geocoords (via nominatum/openstreetmap?) for adding maps?
10
+ - save database - optional? why? why not?
11
+ - use default as :memory: or something?
12
+ - add a config/ini file for (easy) database setup/reuse - why? why not?
@@ -25,6 +25,8 @@ class EventReader
25
25
  YamlParser.new( txt )
26
26
  elsif path.end_with?( '.csv')
27
27
  CsvParser.new( txt )
28
+ elsif path.end_with?( '.txt')
29
+ DatafileParser.new( txt )
28
30
  else
29
31
  MarkdownParser.new( txt )
30
32
  end
@@ -32,6 +34,34 @@ class EventReader
32
34
  end
33
35
 
34
36
 
37
+ class DatafileParser
38
+ def self.parse( text ) new( text ).parse; end
39
+
40
+ include LogUtils::Logging
41
+
42
+ def initialize( text )
43
+ @text = text
44
+ end
45
+
46
+ def parse
47
+ events = []
48
+
49
+ @text.each_line do |line|
50
+ line = line.strip
51
+ next if line.empty? ## skip empty lines
52
+ next if line.start_with?( '#') ## skip comment lines
53
+
54
+ ## todo/check: add inline comments too - why? why not?
55
+
56
+ puts " reading >#{line}<..."
57
+ events += EventReader.read( line )
58
+ end
59
+
60
+ events
61
+ end
62
+ end # class DatafileParser
63
+
64
+
35
65
  class CsvParser
36
66
  def self.parse( text ) new( text ).parse; end
37
67
 
@@ -4,7 +4,7 @@ module EventDb
4
4
 
5
5
  MAJOR = 1 ## todo: namespace inside version or something - why? why not??
6
6
  MINOR = 1
7
- PATCH = 0
7
+ PATCH = 1
8
8
  VERSION = [MAJOR,MINOR,PATCH].join('.')
9
9
 
10
10
  def self.version
@@ -0,0 +1,5 @@
1
+ #####################################
2
+ # Test List of Event Datafiles / Dataset Sources
3
+
4
+ test/data/conferences.yml
5
+ test/data/conferences.csv
@@ -9,6 +9,11 @@ require 'helper'
9
9
 
10
10
  class TestReader < MiniTest::Test
11
11
 
12
+ def test_datafiles
13
+ events = EventDb::EventReader.read( "#{EventDb.root}/test/data/test.txt" )
14
+ pp events
15
+ end
16
+
12
17
  def test_markdown
13
18
  events = EventDb::EventReader.read( "#{EventDb.root}/test/data/RUBY.md" )
14
19
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eventdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
@@ -129,10 +129,12 @@ extensions: []
129
129
  extra_rdoc_files:
130
130
  - CHANGELOG.md
131
131
  - Manifest.txt
132
+ - NOTES.md
132
133
  - README.md
133
134
  files:
134
135
  - CHANGELOG.md
135
136
  - Manifest.txt
137
+ - NOTES.md
136
138
  - README.md
137
139
  - Rakefile
138
140
  - lib/eventdb.rb
@@ -147,6 +149,7 @@ files:
147
149
  - test/data/conferences.csv
148
150
  - test/data/conferences.yml
149
151
  - test/data/conferences_ii.yml
152
+ - test/data/test.txt
150
153
  - test/helper.rb
151
154
  - test/templates/RUBY.md.erb
152
155
  - test/test_calendar.rb