eventdb 0.7.1 → 1.0.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/Manifest.txt +1 -0
- data/README.md +119 -85
- data/lib/eventdb/database.rb +9 -1
- data/lib/eventdb/models.rb +28 -48
- data/lib/eventdb/reader.rb +42 -31
- data/lib/eventdb/version.rb +3 -3
- data/test/data/RUBY.md +22 -379
- data/test/templates/RUBY.md.erb +4 -4
- data/test/test_calendar.rb +5 -9
- data/test/test_database.rb +4 -8
- data/test/test_parser.rb +83 -0
- data/test/test_reader.rb +12 -15
- metadata +3 -2
data/test/templates/RUBY.md.erb
CHANGED
@@ -7,18 +7,18 @@ on the [awesome-events](README.md) page. Anything missing? Contributions welcome
|
|
7
7
|
|
8
8
|
[2016](#2016) • [2015](#2015) • [2014](#2014) • [2013](#2013)
|
9
9
|
|
10
|
-
<% events.each do |ev,
|
11
|
-
<% if
|
10
|
+
<% events.each do |ev,q| %>
|
11
|
+
<% if q.new_year? %>
|
12
12
|
|
13
13
|
## <%= ev.start_date.year %>
|
14
14
|
|
15
15
|
<% end %>
|
16
|
-
<% if
|
16
|
+
<% if q.new_month? %>
|
17
17
|
|
18
18
|
**<%= Date::MONTHNAMES[ev.start_date.month] %>**
|
19
19
|
|
20
20
|
<% end %>
|
21
21
|
|
22
|
-
<%= ev.
|
22
|
+
<%= ev.date_fmt( 'short' ) %> • [**<%= ev.title %>**](<%= ev.link %>) @ <%= ev.place %>
|
23
23
|
|
24
24
|
<% end %>
|
data/test/test_calendar.rb
CHANGED
@@ -10,18 +10,14 @@ require 'helper'
|
|
10
10
|
class TestCalendar < MiniTest::Test
|
11
11
|
|
12
12
|
def test_ruby
|
13
|
-
|
14
|
-
r = EventDb::EventReader.from_file( "#{EventDb.root}/test/data/RUBY.md" )
|
15
|
-
events = r.read
|
16
|
-
|
17
13
|
db = EventDb::Memory.new
|
18
|
-
db.
|
14
|
+
db.read( "#{EventDb.root}/test/data/RUBY.md" )
|
19
15
|
|
20
16
|
cal = EventDb::EventCalendar.new
|
21
17
|
buf = cal.render( template: "#{EventDb.root}/test/templates/RUBY.md.erb" )
|
22
|
-
|
18
|
+
puts buf
|
23
19
|
|
24
|
-
start_buf =<<
|
20
|
+
start_buf =<<TXT
|
25
21
|
# Ruby Conference Calendar
|
26
22
|
|
27
23
|
NOTE: This page gets auto-generated from the [awesome-events](README.md) page @ Planet Ruby.
|
@@ -38,13 +34,13 @@ on the [awesome-events](README.md) page. Anything missing? Contributions welcome
|
|
38
34
|
**May**
|
39
35
|
|
40
36
|
|
41
|
-
May/4-6 • [**RailsConf**](http://railsconf.com) @ Kansas City, Missouri
|
37
|
+
May/4-6 • [**RailsConf**](http://railsconf.com) @ Kansas City, Missouri, United States, North America, America
|
42
38
|
|
43
39
|
## 2015
|
44
40
|
|
45
41
|
|
46
42
|
**December**
|
47
|
-
|
43
|
+
TXT
|
48
44
|
|
49
45
|
assert_equal start_buf, buf[0...start_buf.size]
|
50
46
|
|
data/test/test_database.rb
CHANGED
@@ -10,22 +10,18 @@ require 'helper'
|
|
10
10
|
class TestDatabase < MiniTest::Test
|
11
11
|
|
12
12
|
def test_ruby
|
13
|
-
|
14
|
-
r = EventDb::EventReader.from_file( "#{EventDb.root}/test/data/RUBY.md" )
|
15
|
-
|
16
|
-
events = r.read
|
17
|
-
|
18
13
|
db = EventDb::Memory.new
|
19
|
-
db.
|
14
|
+
db.read( "#{EventDb.root}/test/data/RUBY.md" )
|
20
15
|
|
21
16
|
## get next 17 events
|
22
|
-
|
17
|
+
today = Date.new( 2015, 1, 1 )
|
18
|
+
up = EventDb::Model::Event.limit( 17 ).upcoming( today )
|
23
19
|
pp up.to_sql
|
24
20
|
pp up
|
25
21
|
|
26
22
|
puts "Upcoming Ruby Conferences:"
|
27
23
|
up.each do |e|
|
28
|
-
puts " #{e.
|
24
|
+
puts " #{e.date_fmt('short')} | #{e.date_fmt} - #{e.title} @ #{e.place}"
|
29
25
|
end
|
30
26
|
|
31
27
|
assert true # assume ok if we get here
|
data/test/test_parser.rb
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
###
|
4
|
+
# to run use
|
5
|
+
# ruby -I ./lib -I ./test test/test_parser.rb
|
6
|
+
|
7
|
+
|
8
|
+
require 'helper'
|
9
|
+
|
10
|
+
class TestParser < MiniTest::Test
|
11
|
+
|
12
|
+
def test_ruby_markdown
|
13
|
+
txt =<<TXT
|
14
|
+
# Awesome Events
|
15
|
+
|
16
|
+
## Online
|
17
|
+
|
18
|
+
<!-- try classic format -->
|
19
|
+
|
20
|
+
- [Rails Rumble](https://railsrumble.com)
|
21
|
+
- 2014 @ Intertubes; Oct/18+19
|
22
|
+
|
23
|
+
<!-- try modern format -->
|
24
|
+
|
25
|
+
- **JekyllConf** (web: [jekyllconf.com](http://jekyllconf.com))
|
26
|
+
- 2015 @ Intertubes; May/2
|
27
|
+
TXT
|
28
|
+
|
29
|
+
events = EventDb::EventReader::MarkdownParser.parse( txt )
|
30
|
+
|
31
|
+
## pp events
|
32
|
+
ev = events[0]
|
33
|
+
|
34
|
+
assert_equal 'Rails Rumble', ev.title
|
35
|
+
assert_equal 'https://railsrumble.com', ev.link
|
36
|
+
assert_equal 'Intertubes, Online', ev.place
|
37
|
+
assert_equal Date.new(2014,10,18), ev.start_date
|
38
|
+
assert_equal Date.new(2014,10,19), ev.end_date
|
39
|
+
|
40
|
+
ev = events[1]
|
41
|
+
|
42
|
+
assert_equal 'JekyllConf', ev.title
|
43
|
+
assert_equal 'http://jekyllconf.com', ev.link
|
44
|
+
assert_equal 'Intertubes, Online', ev.place
|
45
|
+
assert_equal Date.new(2015,5,2), ev.start_date
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_ruby_yaml
|
49
|
+
txt =<<TXT
|
50
|
+
# Awesome Events
|
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
|
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
|
+
end # class TestParser
|
data/test/test_reader.rb
CHANGED
@@ -11,27 +11,24 @@ class TestReader < MiniTest::Test
|
|
11
11
|
|
12
12
|
def test_ruby
|
13
13
|
|
14
|
-
|
15
|
-
events = r.read
|
14
|
+
events = EventDb::EventReader.read( "#{EventDb.root}/test/data/RUBY.md" )
|
16
15
|
|
17
16
|
## pp events
|
18
|
-
|
17
|
+
ev = events[0]
|
19
18
|
|
20
|
-
assert_equal 'Rails Rumble',
|
21
|
-
assert_equal 'https://railsrumble.com',
|
22
|
-
assert_equal 'Intertubes
|
23
|
-
|
24
|
-
assert_equal Date.new(2014,10,
|
25
|
-
assert_equal Date.new(2014,10,19), ev1.end_date
|
19
|
+
assert_equal 'Rails Rumble', ev.title
|
20
|
+
assert_equal 'https://railsrumble.com', ev.link
|
21
|
+
assert_equal 'Intertubes, Online', ev.place
|
22
|
+
assert_equal Date.new(2014,10,18), ev.start_date
|
23
|
+
assert_equal Date.new(2014,10,19), ev.end_date
|
26
24
|
|
27
25
|
|
28
|
-
|
26
|
+
ev = events[1]
|
29
27
|
|
30
|
-
assert_equal 'JekyllConf',
|
31
|
-
assert_equal 'http://jekyllconf.com',
|
32
|
-
assert_equal 'Intertubes
|
33
|
-
|
34
|
-
assert_equal Date.new(2015,5,2), ev2.start_date
|
28
|
+
assert_equal 'JekyllConf', ev.title
|
29
|
+
assert_equal 'http://jekyllconf.com', ev.link
|
30
|
+
assert_equal 'Intertubes, Online', ev.place
|
31
|
+
assert_equal Date.new(2015,5,2), ev.start_date
|
35
32
|
end
|
36
33
|
|
37
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: 1.0.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-
|
11
|
+
date: 2019-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: props
|
@@ -135,6 +135,7 @@ files:
|
|
135
135
|
- test/templates/RUBY.md.erb
|
136
136
|
- test/test_calendar.rb
|
137
137
|
- test/test_database.rb
|
138
|
+
- test/test_parser.rb
|
138
139
|
- test/test_reader.rb
|
139
140
|
- test/test_version.rb
|
140
141
|
homepage: https://github.com/textkit/event.db
|