eventdb 0.7.0 → 0.7.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: 6ce9835b60dc43f40f40dbead99151906d27deae
4
- data.tar.gz: ec81011031ec13b0ee2954b82566e512c543ff66
3
+ metadata.gz: c92b20bf06bb3d5a56fd77f5c0503db488782500
4
+ data.tar.gz: 5e62e9a5d2941b1e14e3de5180c1674ba4150c54
5
5
  SHA512:
6
- metadata.gz: a7c4f46d4b8b832388b2f16597bdadda3e228266b8ea7827767394dbd6679b46d0b22281472c2f240411d7caad0fa9ec7198b22a16cd8489655af6eb5f343c71
7
- data.tar.gz: 3ff8eaebf5e775fd87dd454e259e1d36b3300109e4566c85774e0c2742dec9b020ff7923c7928f438358f89c5f1e46d848ec4b98d6bfdeefe608a795da64cc14
6
+ metadata.gz: 7b37cea05c931afe5bc64b64701e28464ef0ce9b1145b8a523ceb76b85852c731183463bb0aeee6ba88c0cca68f672a4976640c7fccb863a08d33fc27b79c751
7
+ data.tar.gz: c1c3edf3764dd977709729f05c9521f55c12820e31bccb0865a3bf05f89fd02b9d96dbecddbec036d25bd3fed860cadf503b1975d33c45e171fe577276f3e05b
File without changes
@@ -1,18 +1,20 @@
1
- HISTORY.md
2
- Manifest.txt
3
- README.md
4
- Rakefile
5
- lib/eventdb.rb
6
- lib/eventdb/calendar.rb
7
- lib/eventdb/database.rb
8
- lib/eventdb/models.rb
9
- lib/eventdb/reader.rb
10
- lib/eventdb/schema.rb
11
- lib/eventdb/version.rb
12
- test/data/RUBY.md
13
- test/helper.rb
14
- test/templates/RUBY.md.erb
15
- test/test_calendar.rb
16
- test/test_database.rb
17
- test/test_reader.rb
18
- test/test_version.rb
1
+ CHANGELOG.md
2
+ Manifest.txt
3
+ README.md
4
+ Rakefile
5
+ lib/eventdb.rb
6
+ lib/eventdb/calendar.rb
7
+ lib/eventdb/database.rb
8
+ lib/eventdb/models.rb
9
+ lib/eventdb/outline_reader.rb
10
+ lib/eventdb/reader.rb
11
+ lib/eventdb/schema.rb
12
+ lib/eventdb/version.rb
13
+ test/data/RUBY.md
14
+ test/data/conferences.yml
15
+ test/helper.rb
16
+ test/templates/RUBY.md.erb
17
+ test/test_calendar.rb
18
+ test/test_database.rb
19
+ test/test_reader.rb
20
+ test/test_version.rb
data/Rakefile CHANGED
@@ -15,12 +15,11 @@ Hoe.spec 'eventdb' do
15
15
 
16
16
  # switch extension to .markdown for gihub formatting
17
17
  self.readme_file = 'README.md'
18
- self.history_file = 'HISTORY.md'
18
+ self.history_file = 'CHANGELOG.md'
19
19
 
20
20
  self.extra_deps = [
21
- ['props', '>= 1.1.2'], # settings / prop(ertie)s / env / INI
21
+ ['props', '>= 1.2.0'], # settings / prop(ertie)s / env / INI
22
22
  ['logutils', '>= 0.6.1'], # logging
23
- ['textutils', '>= 1.3.1'],
24
23
 
25
24
  ## 3rd party
26
25
  ['activerecord'], # NB: will include activesupport,etc.
@@ -28,14 +27,14 @@ Hoe.spec 'eventdb' do
28
27
  ## more activerecord utils/addons
29
28
  ## ['tagutils', '>= 0.3.0'], # tags n categories for activerecord
30
29
  ## ['activerecord-utils', '>= 0.4.0'],
31
- ['props-activerecord', '>= 0.1.0'],
30
+ ['props-activerecord', '>= 0.2.0'],
32
31
  ['logutils-activerecord', '>= 0.2.1'],
33
32
  ]
34
33
 
35
34
  self.licenses = ['Public Domain']
36
35
 
37
36
  self.spec_extras = {
38
- required_ruby_version: '>= 1.9.2'
37
+ required_ruby_version: '>= 2.2.2'
39
38
  }
40
39
 
41
40
  end
@@ -4,12 +4,12 @@
4
4
  require 'pp'
5
5
  require 'date'
6
6
  require 'strscan' ## StringScanner lib
7
+ require 'yaml'
7
8
  require 'erb'
8
9
 
9
10
  # 3rd party libs (gems)
10
11
  require 'props'
11
12
  require 'logutils'
12
- require 'textutils'
13
13
 
14
14
  require 'props/activerecord'
15
15
  require 'logutils/activerecord'
@@ -22,6 +22,7 @@ require 'eventdb/version' ## let version always go first
22
22
  require 'eventdb/schema'
23
23
  require 'eventdb/models'
24
24
 
25
+ require 'eventdb/outline_reader'
25
26
  require 'eventdb/reader'
26
27
  require 'eventdb/calendar' # note: depends (requires) models (first)
27
28
  require 'eventdb/database'
@@ -29,4 +30,4 @@ require 'eventdb/database'
29
30
 
30
31
 
31
32
  # say hello
32
- puts EventDb.banner if defined?($RUBYLIBS_DEBUG) && $RUBYLIBS_DEBUG
33
+ puts EventDb.banner if defined?($RUBYCOCO_DEBUG) && $RUBYCOCO_DEBUG
@@ -62,12 +62,12 @@ class EventCalendar
62
62
 
63
63
  def render( opts={} )
64
64
  tmpl_path = opts[:template] || './templates/CALENDAR.md.erb'
65
- tmpl = File.read_utf8( tmpl_path )
65
+ tmpl = File.open( tmpl_path, 'r:utf-8' ).read
66
66
 
67
67
  ERB.new( tmpl, nil, '<>' ).result( binding ) # <> omit newline for lines starting with <% and ending in %>
68
68
  end
69
69
 
70
- # def save( path = './CALENDAR.md' ) ## use (rename to) save_as - why? why not??
70
+ # def save( path = './CALENDAR.md' ) ## use (rename to) save_as - why? why not??
71
71
  # File.open( path, 'w' ) do |f|
72
72
  # f.write( render )
73
73
  # end
@@ -3,7 +3,7 @@
3
3
  module EventDb
4
4
 
5
5
 
6
- class DatabaseBase ## fix: rename to Database (see below)
6
+ class Database
7
7
  def initialize( config={} )
8
8
  @config = config
9
9
  end
@@ -16,50 +16,22 @@ class DatabaseBase ## fix: rename to Database (see below)
16
16
  CreateDb.new.up
17
17
  ConfDb::Model::Prop.create!( key: 'db.schema.event.version', value: VERSION )
18
18
  end
19
-
19
+
20
20
  def create_all
21
21
  LogDb.create # add logs table
22
- ConfDb.create
22
+ ConfDb.create
23
23
  create
24
24
  end
25
25
 
26
26
  def add( events )
27
- events.each do |ev|
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
39
- title = $1
40
- puts " adding (old/classic format) => #{title} #{ev.start_date.year}, #{ev.date}"
41
- else
42
- puts "*** warn: cannot find event title in #{ev.title}"
43
- next # skip record; todo: issue error
44
- end
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
-
27
+ ## todo/fix: add check if Array and also allow single event
28
+ ## change arg to event_or_events
56
29
 
30
+ events.each do |ev|
57
31
  Model::Event.create!(
58
- title: title,
59
- link: link,
60
- text: ev.title, ### "full" title - incl. markdown links
32
+ title: ev.title,
33
+ link: ev.link,
61
34
  place: ev.place,
62
- date: ev.date,
63
35
  start_date: ev.start_date,
64
36
  end_date: ev.end_date,
65
37
  ## note: (pre)calculate duration in days
@@ -74,8 +46,7 @@ end ## class DatabaseBase
74
46
 
75
47
 
76
48
  ## convenience class for in-memory (SQLite3) database
77
-
78
- class Database < DatabaseBase ## fix: rename to MemDatabase or MemoryDatabase
49
+ class MemoryDatabase < Database
79
50
 
80
51
  def initialize
81
52
  ## -- default to sqlite3 in-memory database
@@ -90,7 +61,7 @@ class Database < DatabaseBase ## fix: rename to MemDatabase or MemoryDatabase
90
61
 
91
62
  end # class Database
92
63
 
93
- MemDatabase = Database ## note: start using MemDatabase today (will get renamed!)
64
+ MemDatabase = MemoryDatabase
65
+ Memory = MemoryDatabase
94
66
 
95
67
  end # module EventDb
96
-
@@ -9,13 +9,48 @@ class Event < ActiveRecord::Base
9
9
  ## move order('start_date') into its own scope ??
10
10
 
11
11
  scope :upcoming, ->(today) { order('start_date').where( 'start_date > ?', today ) }
12
-
12
+
13
13
  ## rename to now_on/on_now/now_playing/running/etc. - why? why not??
14
14
  scope :live, ->(today) { order('start_date').where( 'start_date <= ? AND end_date >= ?', today, today ) }
15
15
 
16
16
 
17
- def date_str # date pretty printed (pre-formatted) as string
18
-
17
+
18
+ ## todo/fix: unify / merge date and date_str !!! - add formt: or something
19
+ def date # date pretty printed as string (no weeknames)
20
+ if days == 1
21
+ buf = ''
22
+ buf << Date::ABBR_MONTHNAMES[start_date.month]
23
+ buf << '/'
24
+ buf << start_date.day.to_s
25
+ elsif days == 2
26
+ buf = ''
27
+ buf << Date::ABBR_MONTHNAMES[start_date.month]
28
+ buf << '/'
29
+ buf << start_date.day.to_s
30
+ buf << '+'
31
+ if start_date.month != end_date.month
32
+ buf << Date::ABBR_MONTHNAMES[end_date.month]
33
+ buf << '/'
34
+ end
35
+ buf << end_date.day.to_s
36
+ else ## assume multi day
37
+ buf = ''
38
+ buf << Date::ABBR_MONTHNAMES[start_date.month]
39
+ buf << '/'
40
+ buf << start_date.day.to_s
41
+ buf << '-'
42
+ if start_date.month != end_date.month
43
+ buf << Date::ABBR_MONTHNAMES[end_date.month]
44
+ buf << '/'
45
+ end
46
+ buf << end_date.day.to_s
47
+ end
48
+
49
+ buf
50
+ end
51
+
52
+ def date_str # date pretty printed (pre-formatted) as string (with weeknames)
53
+
19
54
  ## note: wday - (0-6, Sunday is zero).
20
55
  if days == 1
21
56
  buf = ''
@@ -63,7 +98,6 @@ class Event < ActiveRecord::Base
63
98
  end # class Event
64
99
 
65
100
  end # module Model
66
-
101
+
67
102
  Models = Model ## note: add conveniene shortcut for models
68
103
  end # module EventDb
69
-
@@ -0,0 +1,65 @@
1
+ # encoding: utf-8
2
+
3
+ module EventDb
4
+
5
+ class OutlineReader
6
+
7
+ def self.read( path ) ## use - rename to read_file or from_file etc. - why? why not?
8
+ txt = File.open( path, 'r:utf-8' ).read
9
+ parse( txt )
10
+ end
11
+
12
+
13
+ HEADING_RE = /^(\#{1,}) ## leading ####
14
+ ([^#]+?) ## text - note: use non-greedy e.g. +?
15
+ \#* ## (optional) trailing ##
16
+ $/x
17
+
18
+ LISTITEM_RE = /^ \s*
19
+ -\s+ ## space required after dash (-)
20
+ (.+) ## text
21
+ $/x
22
+
23
+
24
+
25
+ def self.parse( txt )
26
+ outline=[] ## outline structure
27
+
28
+ # note: cut out; remove all html comments e.g. <!-- -->
29
+ # supports multi-line comments too (e.g. uses /m - make dot match newlines)
30
+ txt = txt.gsub( /<!--
31
+ .+?
32
+ -->/xm, '' ) ## todo/fix: track/log cut out comments!!!
33
+
34
+
35
+ txt.each_line do |line|
36
+ line = line.strip ## todo/fix: keep leading and trailing spaces - why? why not?
37
+
38
+ next if line.empty? ## todo/fix: keep blank line nodes e.g. just remove comments and process headings?! - why? why not?
39
+ break if line == '__END__'
40
+
41
+ pp line
42
+
43
+ ## note: all optional trailing ### too
44
+ if HEADING_RE.match( line )
45
+ heading_marker = $1
46
+ heading_level = $1.length ## count number of = for heading level
47
+ heading = $2.strip
48
+
49
+ puts "heading #{heading_level} >#{heading}<"
50
+ outline << [:"h#{heading_level}", heading]
51
+ elsif LISTITEM_RE.match( line )
52
+ item = $1.strip
53
+
54
+ puts "list item >#{item}<"
55
+ outline << [:li, item]
56
+ else
57
+ ## assume it's a (plain/regular) text line
58
+ outline << [:l, line]
59
+ end
60
+ end
61
+ outline
62
+ end # method read
63
+ end # class OutlineReader
64
+
65
+ end # module EventDb
@@ -6,25 +6,69 @@ module EventDb
6
6
 
7
7
  class EventReader
8
8
 
9
- include LogUtils::Logging
10
-
9
+ Event = Struct.new( :title, :link,
10
+ :place,
11
+ :start_date, :end_date )
11
12
 
12
- Event = Struct.new( :title, :place, :date, :start_date, :end_date, :days)
13
13
 
14
14
  def self.from_url( src ) # note: src assumed a string
15
15
  worker = Fetcher::Worker.new
16
- self.from_string( worker.read_utf8!( src ) )
16
+ txt = worker.read_utf8!( src )
17
+
18
+ if src.end_with?( '.yml') ||
19
+ src.end_with?( '.yaml')
20
+ YamlReader.new( txt )
21
+ else
22
+ MarkdownReader.new( txt )
23
+ end
17
24
  end
18
25
 
19
26
  def self.from_file( path )
20
- self.from_string( File.read_utf8( path ) )
27
+ txt = File.open( path, 'r:utf-8' ).read
28
+
29
+ if path.end_with?( '.yml') ||
30
+ path.end_with?( '.yaml')
31
+ YamlReader.new( txt )
32
+ else
33
+ MarkdownReader.new( txt )
34
+ end
21
35
  end
22
36
 
23
- def self.from_string( text )
24
- self.new( text )
37
+
38
+
39
+ class YamlReader ## fix/change: rename to YamlParser - why? why not?
40
+ include LogUtils::Logging
41
+
42
+ def initialize( text )
43
+ @text = text
44
+ end
45
+
46
+ def read
47
+ events = []
48
+ recs = YAML.load( @text )
49
+ recs.each do |rec|
50
+ title = rec['name']
51
+ link = rec['url']
52
+ place = rec['location']
53
+ start_date = rec['start'] # note: already parsed into a date (NOT string) by yaml parser!!
54
+ end_date = rec['end'] # note: already parsed into a date (NOT string) by yaml parser!!
55
+
56
+ event = Event.new( title, link,
57
+ place,
58
+ start_date, end_date )
59
+ ## pp event
60
+
61
+ events << event
62
+ end
63
+
64
+ events
25
65
  end
66
+ end # class YamlReader
26
67
 
27
68
 
69
+ class MarkdownReader ## fix/change: rename to MarkdownParser - why? why not?
70
+ include LogUtils::Logging
71
+
28
72
  def initialize( text )
29
73
  @text = text
30
74
  end
@@ -50,8 +94,7 @@ class EventReader
50
94
  ## - 2015 @ Brussels / Brussel / Bruxelles; Jan/31+Feb/1
51
95
  ## - 2014 @ Porto de Galinhas, Pernambuco; Apr/24-27 (formerly: Abril Pro Ruby)
52
96
 
53
- DATE_ENTRY_REGEX = /\s+
54
- (?<year>20\d\d) ## year
97
+ DATE_ENTRY_RE = /(?<year>20\d\d) ## year
55
98
  \s+
56
99
  @ ## at location
57
100
  \s+
@@ -75,8 +118,7 @@ class EventReader
75
118
  ## example:
76
119
  ## - [RubyWorld Conference - rubyworldconf](http://www.rubyworld-conf.org/en)
77
120
 
78
- LINK_ENTRY_REGEX = /\s+
79
- \[
121
+ LINK_ENTRY_RE = /\[
80
122
  [^\]]+
81
123
  \]
82
124
  \(
@@ -85,48 +127,31 @@ class EventReader
85
127
  /x
86
128
 
87
129
 
88
- def read
89
130
 
131
+ def read
90
132
  events = []
91
133
  stack = [] ## header/heading stack; note: last_stack is stack.size; starts w/ 0
92
134
 
93
135
  last_link_entry = nil
94
136
 
95
- # note: cut out; remove all html comments e.g. <!-- -->
96
- # supports multi-line comments too (e.g. uses /m - make dot match newlines)
97
- text = @text.gsub( /<!--.+?-->/m, '' ) ## todo/fix: track/log cut out comments!!!
98
-
99
- text.each_line do |line|
100
137
 
101
- logger.debug "line: >#{line}<" ## todo/check: line can contain newline??
102
- line = line.rstrip ## remove (possible) trailing newline
138
+ nodes = OutlineReader.parse( @text )
139
+ nodes.each do |node|
103
140
 
104
- next if line =~ /^\s*$/ # skip blank lines
141
+ if [:h1,:h2,:h3,:h4,:h5,:h6].include?( node[0] )
142
+ heading = node[1]
143
+ # stop when hitting >## More< or <Calendar> or <Thanks> etc. section
144
+ # note: must escape # e.g. #{2,} must be escaped to \#{2,}
145
+ break if heading =~ /^(More|Calendar|Thanks|Meta)\b/
105
146
 
106
- ### hack:
107
- ## todo - make more configurable ??
108
- ## skip_headings ?? end_markers/blocks ?? etc. - why, why not??
147
+ # skip "pseudo" headings (for contribs etc.)
148
+ ## e.g. #### _Contributions welcome. Anything missing? Send in a pull request. Thanks._
149
+ next if heading =~ /Contributions welcome\.|Anything Missing\?/
109
150
 
110
- # stop when hitting >## More< or <Calendar> or <Thanks> etc. section
111
- # note: must escape # e.g. #{2,} must be escaped to \#{2,}
112
- break if line =~ /^\#{2,} (More|Calendar|Thanks|Meta)\b/
113
151
 
152
+ level = node[0][1].to_i
114
153
 
115
- # skip "pseudo" headings (for contribs etc.)
116
- ## e.g. #### _Contributions welcome. Anything missing? Send in a pull request. Thanks._
117
- next if line =~ /Contributions welcome\.|Anything Missing\?/
118
-
119
-
120
- m = nil
121
- if line =~ /^[ ]*(#+)[ ]+/ ## heading/headers - note: must escpape #
122
- s = StringScanner.new( line )
123
- s.skip( /[ ]*/ ) ## skip whitespaces
124
- markers = s.scan( /#+/)
125
- level = markers.size
126
- s.skip( /[ ]*/ ) ## skip whitespaces
127
- title = s.rest.rstrip
128
-
129
- logger.debug " heading level: #{level}, title: >#{title}<"
154
+ logger.debug " heading level: #{level}, title: >#{heading}<"
130
155
 
131
156
  level_diff = level - stack.size
132
157
 
@@ -144,19 +169,19 @@ class EventReader
144
169
  ## same level
145
170
  stack.pop
146
171
  end
147
- stack.push( [level,title] )
172
+ stack.push( [level, heading] )
148
173
  logger.debug " stack: #{stack.inspect}"
149
174
 
150
- elsif line =~ /^[ ]*-[ ]+/ ## list item
151
- if( m=LINK_ENTRY_REGEX.match( line ) )
175
+ elsif [:li].include?( node[0] ) ## list item
176
+ line = node[1]
177
+
178
+ if LINK_ENTRY_RE.match( line )
152
179
  logger.debug " link entry: #{line}"
153
180
 
154
- s = StringScanner.new( line )
155
- s.skip( /[ ]*-[ ]*/ ) ## skip leading list
156
- last_link_entry = s.rest.rstrip ## remove trailing spaces to
157
- elsif( m=DATE_ENTRY_REGEX.match( line ) )
181
+ last_link_entry = line
182
+ elsif m=DATE_ENTRY_RE.match( line )
158
183
  year = m[:year]
159
-
184
+
160
185
  start_month_en = m[:start_month_en]
161
186
  start_day = m[:start_day]
162
187
 
@@ -181,38 +206,78 @@ class EventReader
181
206
 
182
207
 
183
208
  s = StringScanner.new( line )
184
- s.skip( /[ ]*-[ ]*/ ) ## skip leading list
185
209
  s.skip_until( /@/ )
186
210
 
187
211
  place = s.scan( /[^;]+/ ) ## get place (everything until ; (separator))
188
- place = place.strip
212
+ place = place.strip
189
213
  logger.debug " place: #{place}, rest: >#{s.rest}<"
190
214
 
191
- ## note: cut of heading 1 (e.g. awesome-events title)
215
+ ## todo/fix: make place uniform e.g. change
216
+ ## Vienna, Austria =>
217
+ ## Vienna › Austria - why? why not?
218
+
219
+ ## note: cut of heading 1 (e.g. page title)
192
220
  more_places = stack[1..-1].reverse.map {|it| it[1] }.join(' › ')
193
221
  place = "#{place} › #{more_places}"
194
222
  logger.debug " place: #{place}"
195
223
 
196
- s.skip( /;/ )
197
- s.skip( /[ ]*/ ) ## skip whitespaces
198
- date = s.scan( /[^ ]+/ ) # e.g. everything untils first space (or end-of-line)
199
224
 
200
- title = last_link_entry
225
+ title, link = find_title_and_link( last_link_entry )
226
+
201
227
 
202
- event = Event.new( title, place, date, start_date, end_date )
228
+ event = Event.new( title, link,
229
+ place,
230
+ start_date, end_date )
203
231
  ## pp event
232
+
204
233
  events << event
205
234
  else
206
235
  logger.debug " *** skip list item line: #{line}"
207
236
  end
208
237
  else
209
- logger.debug " *** skip line: #{line}"
238
+ logger.debug " *** skip node:"
239
+ pp node
210
240
  end
211
241
  end
212
-
242
+
213
243
  events
214
244
  end
215
245
 
246
+ ### helper
247
+ def find_title_and_link( line )
248
+ title = nil
249
+ link = nil
250
+
251
+ ## note: extract title and link from line
252
+
253
+ ### 1) try "new" format first e.g.
254
+ ## - **European Ruby Konference - EuRuKo** (web: [euruko.org](http://euruko.org), t: [euruko](https://twitter.com/euruko)) - _since 2003_
255
+ if m = (line =~ /^\*{2}([^*]+)\*{2}/) ## note: **title** must start line
256
+ title = $1
257
+ puts " adding (new/modern format) => #{title}"
258
+ ## 2) try "old" classic format - get title from first (markdown) link e.g.
259
+ ## - [Oktoberfest ("Die Wiesn")](http://www.muenchen.de/veranstaltungen/oktoberfest.html)
260
+ elsif m = (line =~ /^\[([^\]]+)\]/) ## note: [title](link) must start line
261
+ title = $1
262
+ puts " adding (old/classic format) => #{title}"
263
+ else
264
+ puts "*** !! ERROR !!: cannot find event title in #{line}"
265
+ exit 1
266
+ end
267
+
268
+ ## try extract link - use first (markdown) link
269
+ ## todo/fix: use shared markdown link regex!!!!!
270
+ if m = (line =~ /\[[^\]]+\]\(([^\)]+)\)/)
271
+ link = $1
272
+ puts " => @ #{link}"
273
+ else
274
+ link = nil
275
+ puts "*** !! WARN !!: cannot find event link in #{line}"
276
+ end
277
+
278
+ [title,link]
279
+ end # method find_title_and_link
280
+ end # class MarkdownReader
216
281
  end # class EventReader
217
282
 
218
283
  end # module EventDb
@@ -10,9 +10,7 @@ def up
10
10
  create_table :events do |t|
11
11
  t.string :title, null: false ## title (just the first link text)
12
12
  t.string :link ## for now optional - why? why not??
13
- t.string :text, null: false ## -- "full" title - incl. markdown link(s)
14
13
  t.string :place, null: false
15
- t.string :date, null: false # note: full date range (start to end) for now as *string*
16
14
  t.date :start_date, null: false ## use (rename) to start_at - why? why not?
17
15
  t.date :end_date, null: false ## use (rename) to end_at - why? why not?
18
16
  t.integer :days, null: false
@@ -4,7 +4,7 @@ module EventDb
4
4
 
5
5
  MAJOR = 0 ## todo: namespace inside version or something - why? why not??
6
6
  MINOR = 7
7
- PATCH = 0
7
+ PATCH = 1
8
8
  VERSION = [MAJOR,MINOR,PATCH].join('.')
9
9
 
10
10
  def self.version
@@ -1,78 +1,10 @@
1
- # awesome-events
1
+ # Awesome Events
2
2
 
3
- A collection of awesome Ruby events (meetups, conferences, camps, etc.) from around the world
4
-
5
- ---
6
3
 
7
- [ANNOUNCEMENT] Looking for awesome Ruby Gems? See the [Ruby Gems of the Week Series @ Planet Ruby](http://planetruby.github.io/gems).
8
-
9
- ---
4
+ A collection of awesome Ruby events (meetups, conferences, camps, etc.) from around the world
10
5
 
11
6
  #### _Contributions welcome. Anything missing? Send in a pull request. Thanks._
12
7
 
13
- NOTE: A calendar page ([CALENDAR.md](CALENDAR.md)) gets auto-generated from this page listing conferences sorted by year and month.
14
-
15
-
16
- - [World](#world)
17
- - [Online](#online)
18
- - [Europe](#europe)
19
- - [Central Europe](#central-europe)
20
- - [Austria / Österreich](#austria--%C3%96sterreich-at)
21
- - [Switzerland / Schweiz / Suisse](#switzerland--schweiz--suisse--confoederatio-helvetica-ch)
22
- - [Germany / Deutschland](#germany--deutschland-de)
23
- - [Slovakia](#slovakia-sk)
24
- - [Slovenia](#slovenia-si)
25
- - [Czech Republic](#czech-republic-cz)
26
- - [Poland](#poland-pl)
27
- - [Hungary](#hungary-hu)
28
- - [Western Europe](#western-europe)
29
- - [England](#england-en)
30
- - [Scotland](#scotland)
31
- - [Ireland / Éire](#ireland--%C3%89ire-ie)
32
- - [France](#france-fr)
33
- - [Belgium / België / Belgique](#belgium--belgi%C3%AB--belgique-be)
34
- - [Netherlands](#netherlands-nl)
35
- - [Southern Europe](#southern-europe)
36
- - [Spain / España](#spain--espa%C3%B1a-es)
37
- - [Portugal](#portugal-pt)
38
- - [Italy](#italy-it)
39
- - [Croatia / Hrvatska](#croatia--hrvatska-hr)
40
- - [Northern Europe](#northern-europe)
41
- - [Denmark / Danmark](#denmark--danmark-dk)
42
- - [Sweden / Sverige](#sweden--sverige-se)
43
- - [Finland / Suomi](#finland--suomi-fi)
44
- - [Norway / Norge](#norway--norge-no)
45
- - [Lithuania / Lietuva](#lithuania--lietuva-lt)
46
- - [Eastern Europe](#eastern-europe)
47
- - [Belarus / Беларусь](#belarus--%D0%91%D0%B5%D0%BB%D0%B0%D1%80%D1%83%D1%81%D1%8C-by)
48
- - [Russia / Россия](#russia--%D0%A0%D0%BE%D1%81%D1%81%D0%B8%D1%8F-ru)
49
- - [Ukraine / Україна / Украина](#ukraine--%D0%A3%D0%BA%D1%80%D0%B0%D1%97%D0%BD%D0%B0--%D0%A3%D0%BA%D1%80%D0%B0%D0%B8%D0%BD%D0%B0-ua)
50
- - [America](#america)
51
- - [North America](#north-america)
52
- - [Canada](#canada-ca)
53
- - [United States](#united-states-us)
54
- - [Mexico / México](#mexico--m%C3%A9xico-mx)
55
- - [South America](#south-america)
56
- - [Brazil / Brasil](#brazil--brasil-br)
57
- - [Colombia](#colombia-co)
58
- - [Peru / Perú](#peru--per%C3%BA-pe)
59
- - [Uruguay](#uruguay-uy)
60
- - [Argentina](#argentina-ar)
61
- - [Asia](#asia)
62
- - [Japan](#japan-jp)
63
- - [Taiwan](#taiwan-tw)
64
- - [Singapore](#singapore-sg)
65
- - [Philippines / Pilipinas](#philippines--pilipinas-ph)
66
- - [Vietnam](#vietnam-vn)
67
- - [India](#india-in)
68
- - [Africa](#africa)
69
- - [Kenya](#kenya-ke)
70
- - [South Africa](#south-africa-za)
71
- - [Pacific / Oceania](#pacific--oceania)
72
- - [Australia](#australia-au)
73
- - [More](#more)
74
- - [Friends & Family](#friends--family)
75
- - [Meta](#meta)
76
8
 
77
9
  ## World
78
10
 
@@ -237,7 +169,7 @@ NOTE: A calendar page ([CALENDAR.md](CALENDAR.md)) gets auto-generated from this
237
169
 
238
170
  - @ Amsterdam, Noord-Holland
239
171
  - [Amsterdam.rb](http://amsrb.org) - [:octocat:](https://github.com/amsrb)
240
- - @ Rotterdam, Zuid-Holland
172
+ - @ Rotterdam, Zuid-Holland
241
173
  - [Rotterdam.rb](http://rtmrb.org)
242
174
 
243
175
 
@@ -567,7 +499,7 @@ NOTE: A calendar page ([CALENDAR.md](CALENDAR.md)) gets auto-generated from this
567
499
  - @ Singapore
568
500
  - [Ruby Singapore](http://ruby.sg) - [:octocat:](https://github.com/rubysg)
569
501
 
570
- ### Philippines / Pilipinas (ph)
502
+ ### Philippines / Pilipinas (ph)
571
503
 
572
504
  - [RubyConf Philippines](http://rubyconf.ph)
573
505
  - 2015 @ Boracy Island; Mar/27-28
@@ -0,0 +1,140 @@
1
+ #############################
2
+ # ruby event news in 2020
3
+
4
+ - name: Rubyfuza
5
+ location: Cape Town, South Africa
6
+ start: 2020-02-06 # February 6-8, 2020
7
+ end: 2020-02-08
8
+ days: 3
9
+ month: 2
10
+ url: http://www.rubyfuza.org
11
+ twitter: rubyfuza
12
+ updated: 2019-12-03 ## note: used for feed.xml|json
13
+
14
+ - name: ParisRB Conf
15
+ location: Paris, France
16
+ start: 2020-02-18 # February 18-19, 2020
17
+ end: 2020-02-19
18
+ days: 2
19
+ month: 2
20
+ url: https://2020.rubyparis.org
21
+ twitter: parisrb
22
+ updated: 2019-12-03 ## note: used for feed.xml|json
23
+
24
+ - name: RubyConf Australia
25
+ location: Melbourne, Victoria, Australia
26
+ start: 2020-02-20
27
+ end: 2020-02-21
28
+ days: 2
29
+ month: 2
30
+ url: https://www.rubyconf.org.au/2020
31
+ twitter: rubyconf_au
32
+ updated: 2019-12-03 ## note: used for feed.xml|json
33
+
34
+
35
+ - name: Wrocław <3 Ruby (wroclove.rb)
36
+ location: Wrocław, Poland
37
+ start: 2020-03-20 # 20-22th March, 2020
38
+ end: 2020-03-22
39
+ days: 3
40
+ month: 3
41
+ url: https://wrocloverb.com
42
+ twitter: wrocloverb
43
+
44
+
45
+ - name: RubyDay Italy
46
+ location: Verona, Veneto, Italy
47
+ start: 2020-04-02
48
+ end: 2020-04-02
49
+ days: 1
50
+ month: 4
51
+ url: https://2020.rubyday.it
52
+ twitter: rubydayit
53
+
54
+ # RubyKaigi 2020: April 9th - 11th, 2020 @ Matsumoto, Nagano, Japan https://rubykaigi.org/2020
55
+ - name: RubyKaigi
56
+ location: Nagano, Japan
57
+ start: 2020-04-09
58
+ end: 2020-04-11
59
+ days: 3
60
+ month: 4
61
+ url: https://rubykaigi.org/2020
62
+ twitter: rubykaigi
63
+
64
+ - name: RubyConf India
65
+ location: Goa, India
66
+ start: 2020-04-25 # April 25-26 2020
67
+ end: 2020-04-26
68
+ days: 2
69
+ month: 4
70
+ url: http://rubyconfindia.org
71
+ twitter: rubyconfindia
72
+
73
+
74
+ # RailsConf 2020 will be in Portland, OR from May 5-7
75
+ - name: RailsConf (United States)
76
+ location: Portland, Oregon, United States
77
+ start: 2020-05-05
78
+ end: 2020-05-07
79
+ days: 3
80
+ month: 5
81
+ url: https://railsconf.com
82
+ twitter: railsconf
83
+
84
+ - name: Balkan Ruby
85
+ location: Sofia, Bulgaria
86
+ start: 2020-05-15
87
+ end: 2020-05-16
88
+ days: 2
89
+ month: 5
90
+ url: https://balkanruby.com
91
+ twitter: balkanruby
92
+
93
+
94
+ - name: Ruby Unconf Hamburg
95
+ location: Hamburg, Germany
96
+ start: 2020-06-06 ## June 6th & 7th 2020
97
+ end: 2020-06-07
98
+ days: 2
99
+ month: 6
100
+ url: http://2020.rubyunconf.eu
101
+ twitter: rubyunconfeu
102
+
103
+
104
+ - name: Brighton RubyConf
105
+ location: Brighton, Sussex, England, United Kingdom
106
+ start: 2020-07-03
107
+ end: 2020-07-03
108
+ days: 1
109
+ month: 7
110
+ url: https://brightonruby.com
111
+ twitter: brightonruby
112
+
113
+ - name: RubyConf Kenya
114
+ location: Nairobi, Kenya
115
+ start: 2020-07-23
116
+ end: 2020-07-25
117
+ days: 3
118
+ month: 7
119
+ url: http://rubyconf.nairuby.org/2020
120
+ twitter: nairubyke
121
+
122
+
123
+ - name: European Ruby Konference (EuRuKo)
124
+ location: Helsinki, Finnland
125
+ start: 2020-08-21 # 21–22.8.2020
126
+ end: 2020-08-22
127
+ days: 2
128
+ month: 8
129
+ url: https://euruko2020.org
130
+ twitter: euruko
131
+
132
+
133
+ - name: RubyConf (United States)
134
+ location: Houston, Texas, United States
135
+ start: 2020-11-17
136
+ end: 2020-11-19
137
+ days: 3
138
+ month: 11
139
+ url: https://rubyconf.org
140
+ twitter: rubyconf
@@ -19,6 +19,6 @@ on the [awesome-events](README.md) page. Anything missing? Contributions welcome
19
19
 
20
20
  <% end %>
21
21
 
22
- <%= ev.date %> • **<%= ev.text %>** @ <%= ev.place %>
22
+ <%= ev.date %> • [**<%= ev.title %>**](<%= ev.link %>) @ <%= ev.place %>
23
23
 
24
24
  <% end %>
@@ -14,7 +14,7 @@ class TestCalendar < MiniTest::Test
14
14
  r = EventDb::EventReader.from_file( "#{EventDb.root}/test/data/RUBY.md" )
15
15
  events = r.read
16
16
 
17
- db = EventDb::Database.new
17
+ db = EventDb::Memory.new
18
18
  db.add( events )
19
19
 
20
20
  cal = EventDb::EventCalendar.new
@@ -38,7 +38,7 @@ on the [awesome-events](README.md) page. Anything missing? Contributions welcome
38
38
  **May**
39
39
 
40
40
 
41
- May/4-6 • **[RailsConf](http://railsconf.com)** @ Kansas City, Missouri › United States (us) › North America › America
41
+ May/4-6 • [**RailsConf**](http://railsconf.com) @ Kansas City, Missouri › United States (us) › North America › America
42
42
 
43
43
  ## 2015
44
44
 
@@ -10,12 +10,12 @@ require 'helper'
10
10
  class TestDatabase < MiniTest::Test
11
11
 
12
12
  def test_ruby
13
-
13
+
14
14
  r = EventDb::EventReader.from_file( "#{EventDb.root}/test/data/RUBY.md" )
15
15
 
16
16
  events = r.read
17
17
 
18
- db = EventDb::Database.new
18
+ db = EventDb::Memory.new
19
19
  db.add( events )
20
20
 
21
21
  ## get next 17 events
@@ -10,25 +10,28 @@ require 'helper'
10
10
  class TestReader < MiniTest::Test
11
11
 
12
12
  def test_ruby
13
-
13
+
14
14
  r = EventDb::EventReader.from_file( "#{EventDb.root}/test/data/RUBY.md" )
15
15
  events = r.read
16
16
 
17
17
  ## pp events
18
18
  ev1 = events[0]
19
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
20
+ assert_equal 'Rails Rumble', ev1.title
21
+ assert_equal 'https://railsrumble.com', ev1.link
22
+ assert_equal 'Intertubes › Online', ev1.place
23
+ # assert_equal 'Oct/18+19', ev1.date
24
+ assert_equal Date.new(2014,10,18), ev1.start_date
25
+ assert_equal Date.new(2014,10,19), ev1.end_date
24
26
 
25
- ev2 = events[1]
26
27
 
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
28
+ ev2 = events[1]
31
29
 
30
+ assert_equal 'JekyllConf', ev2.title
31
+ assert_equal 'http://jekyllconf.com', ev2.link
32
+ assert_equal 'Intertubes › Online', ev2.place
33
+ # assert_equal 'May/2', ev2.date
34
+ assert_equal Date.new(2015,5,2), ev2.start_date
32
35
  end
33
36
 
34
37
  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.7.0
4
+ version: 0.7.1
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-12 00:00:00.000000000 Z
11
+ date: 2019-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: props
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.1.2
19
+ version: 1.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 1.1.2
26
+ version: 1.2.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: logutils
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.6.1
41
- - !ruby/object:Gem::Dependency
42
- name: textutils
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: 1.3.1
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: 1.3.1
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: activerecord
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +58,14 @@ dependencies:
72
58
  requirements:
73
59
  - - ">="
74
60
  - !ruby/object:Gem::Version
75
- version: 0.1.0
61
+ version: 0.2.0
76
62
  type: :runtime
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
66
  - - ">="
81
67
  - !ruby/object:Gem::Version
82
- version: 0.1.0
68
+ version: 0.2.0
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: logutils-activerecord
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -114,25 +100,24 @@ dependencies:
114
100
  requirements:
115
101
  - - "~>"
116
102
  - !ruby/object:Gem::Version
117
- version: '3.13'
103
+ version: '3.16'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
107
  requirements:
122
108
  - - "~>"
123
109
  - !ruby/object:Gem::Version
124
- version: '3.13'
110
+ version: '3.16'
125
111
  description: eventdb - event.db schema 'n' models for easy (re)use
126
112
  email: ruby-talk@ruby-lang.org
127
113
  executables: []
128
114
  extensions: []
129
115
  extra_rdoc_files:
130
- - HISTORY.md
116
+ - CHANGELOG.md
131
117
  - Manifest.txt
132
118
  - README.md
133
119
  files:
134
- - ".gemtest"
135
- - HISTORY.md
120
+ - CHANGELOG.md
136
121
  - Manifest.txt
137
122
  - README.md
138
123
  - Rakefile
@@ -140,10 +125,12 @@ files:
140
125
  - lib/eventdb/calendar.rb
141
126
  - lib/eventdb/database.rb
142
127
  - lib/eventdb/models.rb
128
+ - lib/eventdb/outline_reader.rb
143
129
  - lib/eventdb/reader.rb
144
130
  - lib/eventdb/schema.rb
145
131
  - lib/eventdb/version.rb
146
132
  - test/data/RUBY.md
133
+ - test/data/conferences.yml
147
134
  - test/helper.rb
148
135
  - test/templates/RUBY.md.erb
149
136
  - test/test_calendar.rb
@@ -164,7 +151,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
164
151
  requirements:
165
152
  - - ">="
166
153
  - !ruby/object:Gem::Version
167
- version: 1.9.2
154
+ version: 2.2.2
168
155
  required_rubygems_version: !ruby/object:Gem::Requirement
169
156
  requirements:
170
157
  - - ">="
@@ -172,12 +159,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
159
  version: '0'
173
160
  requirements: []
174
161
  rubyforge_project:
175
- rubygems_version: 2.4.2
162
+ rubygems_version: 2.5.2
176
163
  signing_key:
177
164
  specification_version: 4
178
165
  summary: eventdb - event.db schema 'n' models for easy (re)use
179
- test_files:
180
- - test/test_calendar.rb
181
- - test/test_database.rb
182
- - test/test_version.rb
183
- - test/test_reader.rb
166
+ test_files: []
data/.gemtest DELETED
File without changes