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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 757265d114eb64c9f578024115c21041535b8cd9
4
- data.tar.gz: a1c2148b333d7751b77bc65dbb6ebc49dcbf484a
3
+ metadata.gz: 6ce9835b60dc43f40f40dbead99151906d27deae
4
+ data.tar.gz: ec81011031ec13b0ee2954b82566e512c543ff66
5
5
  SHA512:
6
- metadata.gz: dccfd18666bcf7787a700b0eee990705e74afdbc8fb4e5c530cc8c1b62b3468217624e8d23634a2cc669edf667adfe318cd9e5ed48212861ce0fe6a53c4eb280
7
- data.tar.gz: fe3c1037f4c4116236afee2c2f64127adba16478fce58adea00f799b97c794bdb5d7160d38dae52450265f2871172db8e2d0acd4a04c6b83254acd69f1064542
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
 
@@ -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 from first (markdown) link
30
- m = (ev.title =~ /^\[([^\]]+)\]/)
31
- if m
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,
@@ -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*
@@ -3,8 +3,8 @@
3
3
  module EventDb
4
4
 
5
5
  MAJOR = 0 ## todo: namespace inside version or something - why? why not??
6
- MINOR = 6
7
- PATCH = 1
6
+ MINOR = 7
7
+ PATCH = 0
8
8
  VERSION = [MAJOR,MINOR,PATCH].join('.')
9
9
 
10
10
  def self.version
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
- - [JekyllConf](http://jekyllconf.com)
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
- ev = events[0]
19
-
20
- assert_equal '[Rails Rumble](https://railsrumble.com)', ev.title
21
- assert_equal 'Intertubes › Online', ev.place
22
- assert_equal 'Oct/18+19', ev.date
23
- assert_equal Date.new(2014,10,18), ev.start_date
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.6.1
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-10 00:00:00.000000000 Z
11
+ date: 2015-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: props