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 +4 -4
- data/Manifest.txt +2 -0
- data/NOTES.md +12 -0
- data/lib/eventdb/reader.rb +30 -0
- data/lib/eventdb/version.rb +1 -1
- data/test/data/test.txt +5 -0
- data/test/test_reader.rb +5 -0
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9169738a5ad4fee9be73ee07be118ca0863f3010
|
4
|
+
data.tar.gz: 1c130ff583526395bcd4ac0166ffb3ba20d687c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a76a72bbfd9208ce180775670c27b435a4f5c49ca270188846bf37224cf36331bdc57b79c414f831c9e0f451f88a34179f9cc2e267f1ef44fe1c05aa3c03e62
|
7
|
+
data.tar.gz: ec52d123d9fa07c6acbbfacd708ed2a81d7abb2b96fde2a54da83b71b867c88e80a53fc3d12d8eb8b50de36062015177c5602db14fcb62702f5e5e8ad6f15018
|
data/Manifest.txt
CHANGED
@@ -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
|
data/NOTES.md
ADDED
@@ -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?
|
data/lib/eventdb/reader.rb
CHANGED
@@ -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
|
|
data/lib/eventdb/version.rb
CHANGED
data/test/data/test.txt
ADDED
data/test/test_reader.rb
CHANGED
@@ -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.
|
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
|