eventdb 0.6.1 → 0.7.0
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.
- checksums.yaml +4 -4
- data/README.md +54 -0
- data/lib/eventdb/database.rb +24 -5
- data/lib/eventdb/schema.rb +1 -0
- data/lib/eventdb/version.rb +2 -2
- data/test/data/RUBY.md +7 -1
- data/test/test_reader.rb +14 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ce9835b60dc43f40f40dbead99151906d27deae
|
4
|
+
data.tar.gz: ec81011031ec13b0ee2954b82566e512c543ff66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7c4f46d4b8b832388b2f16597bdadda3e228266b8ea7827767394dbd6679b46d0b22281472c2f240411d7caad0fa9ec7198b22a16cd8489655af6eb5f343c71
|
7
|
+
data.tar.gz: 3ff8eaebf5e775fd87dd454e259e1d36b3300109e4566c85774e0c2742dec9b020ff7923c7928f438358f89c5f1e46d848ec4b98d6bfdeefe608a795da64cc14
|
data/README.md
CHANGED
@@ -17,6 +17,60 @@ moved to its own gem, that is, whatson.
|
|
17
17
|
See the [whatson project for more »](https://github.com/textkit/whatson)
|
18
18
|
|
19
19
|
|
20
|
+
## Format
|
21
|
+
|
22
|
+
**Markdown**
|
23
|
+
|
24
|
+
Option 1) Classic (Simple) Style
|
25
|
+
|
26
|
+
~~~
|
27
|
+
- [European Ruby Konference - EuRuKo](http://euruko.org)
|
28
|
+
- 2015 @ Salzburg, Austria; Oct/17+18
|
29
|
+
~~~
|
30
|
+
|
31
|
+
Option 2) Modern (New) Style
|
32
|
+
|
33
|
+
~~~
|
34
|
+
- **European Ruby Konference - EuRuKo** (web: [euruko.org](http://euruko.org))
|
35
|
+
- 2015 @ Salzburg, Austria; Oct/17+18
|
36
|
+
~~~
|
37
|
+
|
38
|
+
resulting in:
|
39
|
+
|
40
|
+
~~~
|
41
|
+
#<EventDb::Model::Event:0xa286a54
|
42
|
+
id: 1,
|
43
|
+
title: "European Ruby Konference - EuRuKo",
|
44
|
+
link: "http://euruko.org",
|
45
|
+
place: "Salzburg, Austria › Europe",
|
46
|
+
start_date: Sat, 17 Oct 2015,
|
47
|
+
end_date: Sun, 18 Oct 2015,
|
48
|
+
days: 2,
|
49
|
+
created_at: 2015-07-12 08:51:52 UTC,
|
50
|
+
updated_at: 2015-07-12 08:51:52 UTC>
|
51
|
+
~~~
|
52
|
+
|
53
|
+
Note: The headings hierarchy (starting w/ heading level 2) gets added to the place as a
|
54
|
+
geo tree. Example:
|
55
|
+
|
56
|
+
~~~
|
57
|
+
## Europe
|
58
|
+
|
59
|
+
### Central Europe
|
60
|
+
|
61
|
+
#### Germany
|
62
|
+
|
63
|
+
##### Bavaria
|
64
|
+
|
65
|
+
###### Upper Franconia
|
66
|
+
~~~
|
67
|
+
|
68
|
+
resulting in:
|
69
|
+
|
70
|
+
~~~
|
71
|
+
Upper Franconia › Bavaria › Germany › Central Europe › Europe
|
72
|
+
~~~
|
73
|
+
|
20
74
|
|
21
75
|
## Usage
|
22
76
|
|
data/lib/eventdb/database.rb
CHANGED
@@ -25,19 +25,38 @@ class DatabaseBase ## fix: rename to Database (see below)
|
|
25
25
|
|
26
26
|
def add( events )
|
27
27
|
events.each do |ev|
|
28
|
-
|
29
|
-
## note: extract title
|
30
|
-
|
31
|
-
|
28
|
+
|
29
|
+
## note: extract title and link from line
|
30
|
+
|
31
|
+
### 1) try "new" format first e.g.
|
32
|
+
## - **European Ruby Konference - EuRuKo** (web: [euruko.org](http://euruko.org), t: [euruko](https://twitter.com/euruko)) - _since 2003_
|
33
|
+
if m = (ev.title =~ /^\*{2}([^*]+)\*{2}/) ## note: **title** must start line
|
34
|
+
title = $1
|
35
|
+
puts " adding (new/modern format) => #{title} #{ev.start_date.year}, #{ev.date}"
|
36
|
+
## 2) try "old" classic format - get title from first (markdown) link e.g.
|
37
|
+
## - [Oktoberfest ("Die Wiesn")](http://www.muenchen.de/veranstaltungen/oktoberfest.html)
|
38
|
+
elsif m = (ev.title =~ /^\[([^\]]+)\]/) ## note: [title](link) must start line
|
32
39
|
title = $1
|
33
|
-
puts " adding #{title} #{ev.start_date.year}, #{ev.date}"
|
40
|
+
puts " adding (old/classic format) => #{title} #{ev.start_date.year}, #{ev.date}"
|
34
41
|
else
|
35
42
|
puts "*** warn: cannot find event title in #{ev.title}"
|
36
43
|
next # skip record; todo: issue error
|
37
44
|
end
|
38
45
|
|
46
|
+
## try extract link - use first (markdown) link
|
47
|
+
## todo/fix: use shared markdown link regex!!!!!
|
48
|
+
if m = (ev.title =~ /\[[^\]]+\]\(([^\)]+)\)/)
|
49
|
+
link = $1
|
50
|
+
puts " => @ #{link}"
|
51
|
+
else
|
52
|
+
link = nil
|
53
|
+
puts "*** warn: cannot find event link in #{ev.title}"
|
54
|
+
end
|
55
|
+
|
56
|
+
|
39
57
|
Model::Event.create!(
|
40
58
|
title: title,
|
59
|
+
link: link,
|
41
60
|
text: ev.title, ### "full" title - incl. markdown links
|
42
61
|
place: ev.place,
|
43
62
|
date: ev.date,
|
data/lib/eventdb/schema.rb
CHANGED
@@ -9,6 +9,7 @@ def up
|
|
9
9
|
|
10
10
|
create_table :events do |t|
|
11
11
|
t.string :title, null: false ## title (just the first link text)
|
12
|
+
t.string :link ## for now optional - why? why not??
|
12
13
|
t.string :text, null: false ## -- "full" title - incl. markdown link(s)
|
13
14
|
t.string :place, null: false
|
14
15
|
t.string :date, null: false # note: full date range (start to end) for now as *string*
|
data/lib/eventdb/version.rb
CHANGED
data/test/data/RUBY.md
CHANGED
@@ -81,9 +81,15 @@ NOTE: A calendar page ([CALENDAR.md](CALENDAR.md)) gets auto-generated from this
|
|
81
81
|
|
82
82
|
## Online
|
83
83
|
|
84
|
+
|
85
|
+
<!-- try "old" classic format -->
|
86
|
+
|
84
87
|
- [Rails Rumble](https://railsrumble.com)
|
85
88
|
- 2014 @ Intertubes; Oct/18+19
|
86
|
-
|
89
|
+
|
90
|
+
<!-- try "new" modern format -->
|
91
|
+
|
92
|
+
- **JekyllConf** (web: [jekyllconf.com](http://jekyllconf.com))
|
87
93
|
- 2015 @ Intertubes; May/2
|
88
94
|
|
89
95
|
## Europe
|
data/test/test_reader.rb
CHANGED
@@ -15,12 +15,20 @@ class TestReader < MiniTest::Test
|
|
15
15
|
events = r.read
|
16
16
|
|
17
17
|
## pp events
|
18
|
-
|
19
|
-
|
20
|
-
assert_equal '[Rails Rumble](https://railsrumble.com)',
|
21
|
-
assert_equal 'Intertubes › Online',
|
22
|
-
assert_equal 'Oct/18+19',
|
23
|
-
assert_equal Date.new(2014,10,18),
|
18
|
+
ev1 = events[0]
|
19
|
+
|
20
|
+
assert_equal '[Rails Rumble](https://railsrumble.com)', ev1.title
|
21
|
+
assert_equal 'Intertubes › Online', ev1.place
|
22
|
+
assert_equal 'Oct/18+19', ev1.date
|
23
|
+
assert_equal Date.new(2014,10,18), ev1.start_date
|
24
|
+
|
25
|
+
ev2 = events[1]
|
26
|
+
|
27
|
+
assert_equal '**JekyllConf** (web: [jekyllconf.com](http://jekyllconf.com))', ev2.title
|
28
|
+
assert_equal 'Intertubes › Online', ev2.place
|
29
|
+
assert_equal 'May/2', ev2.date
|
30
|
+
assert_equal Date.new(2015,5,2), ev2.start_date
|
31
|
+
|
24
32
|
end
|
25
33
|
|
26
34
|
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: 0.
|
4
|
+
version: 0.7.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: 2015-07-
|
11
|
+
date: 2015-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: props
|