whatson 1.0.0 → 1.1.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: e518bb473a98dc200733a06c3c5e98a8051b5644
4
- data.tar.gz: dc05244c9247518c2ba4da1b69f370ac7ac87018
3
+ metadata.gz: a6abc83c8d8d6c91192467a99bbb91286f55ffea
4
+ data.tar.gz: 9c08e7885c14a439fd12cf6cad76d72bbaea246b
5
5
  SHA512:
6
- metadata.gz: 9319373b1f942620a00e4250c9b1e937dc38fed5a80c3981f15e0283a624ece0f6c8f7a201bd215aad5ceb10a519c6ee60bbc3a2b35dc1529e71b5905afd8d86
7
- data.tar.gz: 9b816f0aebee5a5e464247bcf847d342dc59ca994c30ae6815d3da2dd10eccfc75c996c8516a6f86c0ebdb0ff0e8fe87ee4315e2b900df75521eb9df8e5b1854
6
+ metadata.gz: bbd1bb7600bf0cf0810d9accc7f3af945ffa09bb22e116fef08de457eb9ed91481a891129e1792f68cd103e2895b59dfb71ad6db99243c8c5380a592416db231
7
+ data.tar.gz: 33cebafca9da5fad2f5582074290e77a1da28ae1f9bffc619dfd3ecceb059491b6536943bcd8e58f431c286cd2853356aae50a913b4c0b43caa36cb43809019a
@@ -4,12 +4,17 @@ README.md
4
4
  Rakefile
5
5
  bin/beerfest
6
6
  bin/kickoff
7
+ bin/pycon
7
8
  bin/rubyconf
9
+ bin/whatson
8
10
  lib/whatson.rb
9
11
  lib/whatson/beerfest.rb
10
12
  lib/whatson/football.rb
13
+ lib/whatson/pycon.rb
11
14
  lib/whatson/rubyconf.rb
15
+ lib/whatson/tool.rb
12
16
  lib/whatson/version.rb
17
+ lib/whatson/whatson.rb
13
18
  test/helper.rb
14
19
  test/test_beerfest.rb
15
20
  test/test_kickoff.rb
data/README.md CHANGED
@@ -9,14 +9,11 @@ what's on now command line tool (using the event.db machinery)
9
9
  * forum :: [ruby-talk@ruby-lang.org](http://www.ruby-lang.org/en/community/mailing-lists)
10
10
 
11
11
 
12
- ## Command-Line Tools - `rubyconf`, `kickoff`, `beerfest`
12
+ ## Command Line Tools - `rubyconf`, `pycon`, `kickoff`, `beerfest`
13
13
 
14
- The whatson gem includes command-line tools
15
- to list upcoming events (ruby conferences, football tournaments, beer festivals. etc.).
16
-
17
- [Upcoming Ruby Conferences](#upcoming-ruby-conferences) •
18
- [Upcoming Football Tournaments](#upcoming-football-tournaments) •
19
- [Upcoming Beerfests](#upcoming-beerfests)
14
+ The whatson package includes command line tools
15
+ to list upcoming events (ruby conferences, python conferences,
16
+ football tournaments, beer festivals. etc.).
20
17
 
21
18
 
22
19
  ### Upcoming Ruby Conferences
@@ -74,6 +71,34 @@ Upcoming Ruby Conferences:
74
71
 
75
72
 
76
73
 
74
+ ### Upcoming Python Conferences
75
+
76
+ Use
77
+
78
+ ```
79
+ $ pycon
80
+ ```
81
+
82
+ to list upcoming Python (un)conferences from around the world. Will print in 2020:
83
+
84
+ ```
85
+ Upcoming Python Conferences:
86
+
87
+ in 62d PyCascades, Sat+Sun Feb/8+9 (2d) @ Portland, Oregon, United States of America
88
+ in 72d PyCon Namibia, Tue-Thu Feb/18-20 (3d) @ Windhoek, Namibia
89
+ in 90d PyTennessee, Sat+Sun Mar/7+8 (2d) @ Nashville, Tennessee, United States of America
90
+ in 110d Moscow Python Conf ++ 2020, Fri Mar/27 (1d) @ Moscow, Russia
91
+ in 116d PyCon Italy, Thu-Sun Apr/2-5 (4d) @ Florence, Italy
92
+ in 129d PyCon US, Wed-Thu Apr/15-23 (9d) @ Pittsburgh, Pennsylvania, United States of America
93
+ in 160d PyTexas, Sat+Sun May/16+17 (2d) @ Austin, Texas, United States of America
94
+ in 225d EuroPython, Mon-Sun Jul/20-26 (7d) @ Dublin, Ireland
95
+ in 230d PyOhio, Sat+Sun Jul/25+26 (2d) @ Columbus, Ohio, United States of America
96
+ in 232d EuroSciPy, Mon-Fri Jul/27-31 (5d) @ Bilbao, Spain
97
+ in 232d GeoPython, Mon-Fri Jul/27-31 (5d) @ Bilbao, Spain
98
+ in 311d PyConDE & PyData Berlin 2020, Wed-Fri Oct/14-16 (3d) @ Berlin, Germany
99
+ ```
100
+
101
+
77
102
  ### Upcoming Football Tournaments
78
103
 
79
104
  Use
@@ -122,6 +147,44 @@ Upcoming Beerfests:
122
147
 
123
148
 
124
149
 
150
+ ## Do-It-Yourself (DIY) - Use Your Own Datasets
151
+
152
+ Note: You can pass in local or remote datafiles in the markdown, yaml or csv formats
153
+ instead of using the built-in / pre-configured datafiles.
154
+ Example:
155
+
156
+ ```
157
+ $ rubyconf https://github.com/planetruby/calendar/raw/master/_data/conferences2020.yml
158
+ # - or -
159
+ $ rubyconf conferences2020.yml # note: assumes a saved (local) copy in the working dir (./)
160
+
161
+ $ pycon https://github.com/python-organizers/conferences/raw/master/2020.csv
162
+ # - or
163
+ $ pycon 2020.csv # note: assumes a saved (local) copy in the working dir (./)
164
+
165
+ $ kickoff https://github.com/footballbook/calendar/raw/master/README.md
166
+ # - or -
167
+ $ kickoff README.md # note: assumes a saved (local) copy in the working dir (./)
168
+ ```
169
+
170
+
171
+
172
+ ## `whatson` Command Line Tool
173
+
174
+ Use the `whatson` command line tool as a "generic catch-all" to print any type of event.
175
+ Example:
176
+
177
+ ```
178
+ $ whatson https://github.com/planetruby/calendar/raw/master/_data/conferences2020.yml \
179
+ https://github.com/python-organizers/conferences/raw/master/2020.csv
180
+ ```
181
+
182
+ Note: `whatson` is pre-configured (that is, if you do not pass along any datafiles)
183
+ to print ongoing and upcoming ruby and python conferences.
184
+
185
+
186
+
187
+
125
188
  ## Public Event Datasets
126
189
 
127
190
  - [Calendar @ Planet Ruby](https://github.com/planetruby/calendar) - a collection of awesome Ruby events (meetups, conferences, camps, etc.) from around the world
data/Rakefile CHANGED
@@ -18,7 +18,7 @@ Hoe.spec 'whatson' do
18
18
  self.history_file = 'CHANGELOG.md'
19
19
 
20
20
  self.extra_deps = [
21
- ['eventdb', '>= 1.0.0'],
21
+ ['eventdb', '>= 1.1.0'],
22
22
  ## 3rd party
23
23
  ['fetcher', '>= 0.4.5'],
24
24
  ['sqlite3']
@@ -14,5 +14,4 @@
14
14
 
15
15
  require 'whatson'
16
16
 
17
- WhatsOn::BeerFest.new.print
18
-
17
+ WhatsOn::BeerFest.main
@@ -14,5 +14,4 @@
14
14
 
15
15
  require 'whatson'
16
16
 
17
- WhatsOn::Football.new.print
18
-
17
+ WhatsOn::Football.main
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ ###################
4
+ # == DEV TIPS:
5
+ #
6
+ # For local testing run like:
7
+ #
8
+ # ruby -Ilib bin/pycon
9
+ #
10
+ # Set the executable bit in Linux. Example:
11
+ #
12
+ # % chmod a+x bin/pycon
13
+ #
14
+
15
+ require 'whatson'
16
+
17
+ WhatsOn::PyCon.main
@@ -14,4 +14,4 @@
14
14
 
15
15
  require 'whatson'
16
16
 
17
- WhatsOn::RubyConf.new.print
17
+ WhatsOn::RubyConf.main
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ ###################
4
+ # == DEV TIPS:
5
+ #
6
+ # For local testing run like:
7
+ #
8
+ # ruby -Ilib bin/whatson
9
+ #
10
+ # Set the executable bit in Linux. Example:
11
+ #
12
+ # % chmod a+x bin/whatson
13
+ #
14
+
15
+ require 'whatson'
16
+
17
+ WhatsOn::WhatsOn.main
@@ -11,14 +11,15 @@ require 'fetcher'
11
11
  require 'whatson/version' ## let version always go first
12
12
 
13
13
 
14
+ require 'whatson/tool'
14
15
  require 'whatson/beerfest' ## used by beerfest bin(ary) tool
16
+ require 'whatson/pycon' ## used by pyocn bin(ary) tool
15
17
  require 'whatson/rubyconf' ## used by rubyconf bin(ary) tool
16
18
  require 'whatson/football' ## used by kickoff bin(ary) tool
17
-
19
+ require 'whatson/whatson' ## used by whatson bin(ary) tool
18
20
 
19
21
 
20
22
 
21
23
 
22
24
  # say hello
23
- puts WhatsOn.banner if defined?($RUBYLIBS_DEBUG) && $RUBYLIBS_DEBUG
24
-
25
+ puts WhatsOn.banner if defined?($RUBYCOCO_DEBUG) && $RUBYCOCO_DEBUG
@@ -2,46 +2,19 @@
2
2
 
3
3
  module WhatsOn
4
4
 
5
- class BeerFest
5
+ class BeerFest < Tool
6
6
 
7
- def initialize
8
- ## turn down logger (default :debug?)
9
- LogUtils::Logger.root.level = :info
7
+ def self.main() new( ARGV ).list; end
10
8
 
11
- @db = EventDb::Memory.new ## note: use in-memory SQLite database
12
- @db.read( "https://github.com/beerbook/calendar/raw/master/README.md" )
13
- end
14
-
15
- def print
16
- ## get next 17 events
17
-
18
- today = Date.today
19
-
20
- up = EventDb::Model::Event.limit( 17 ).upcoming( today )
21
9
 
22
- ## pp up.to_sql
23
- ## pp up
10
+ def initialize( args=ARGV )
11
+ args = ['https://github.com/beerbook/calendar/raw/master/README.md'] if args.empty?
24
12
 
25
- puts ''
26
- puts ''
27
- puts "Upcoming Beerfests:"
28
- puts ''
29
-
30
- on = EventDb::Model::Event.live( today )
31
- on.each do |e|
32
- puts " NOW ON #{e.current_day(today)}d #{e.title}, #{e.date_fmt} (#{e.days}d) @ #{e.place}"
33
- end
34
-
35
- puts '' if on.any?
36
-
37
- up.each do |e|
38
- puts " in #{e.diff_days(today)}d #{e.title}, #{e.date_fmt} (#{e.days}d) @ #{e.place}"
39
- end
40
- puts ''
41
- puts " More @ github.com/beerbook/calendar"
42
- puts ''
13
+ super( args,
14
+ title: 'Upcoming Beerfests',
15
+ more_link: 'github.com/beerbook/calendar'
16
+ )
43
17
  end
44
-
45
18
  end # class BeerFest
46
19
 
47
20
  end # module WhatsOn
@@ -2,46 +2,20 @@
2
2
 
3
3
  module WhatsOn
4
4
 
5
- class Football
5
+ class Football < Tool
6
6
 
7
- def initialize
8
- ## turn down logger (default :debug?)
9
- LogUtils::Logger.root.level = :info
7
+ def self.main() new( ARGV ).list; end
10
8
 
11
- @db = EventDb::Memory.new ## note: use in-memory SQLite database
12
- @db.read( "https://github.com/footballbook/calendar/raw/master/README.md" )
13
- end
14
-
15
- def print
16
- ## get next 17 events
17
-
18
- today = Date.today
19
-
20
- up = EventDb::Model::Event.limit( 17 ).upcoming( today )
21
- ## pp up.to_sql
22
- ## pp up
23
9
 
10
+ def initialize( args=ARGV )
11
+ args = ['https://github.com/footballbook/calendar/raw/master/README.md'] if args.empty?
24
12
 
25
- puts ''
26
- puts ''
27
- puts "Upcoming Football Tournaments:"
28
- puts ''
29
-
30
- on = EventDb::Model::Event.live( today )
31
- on.each do |e|
32
- puts " NOW ON #{e.current_day(today)}d #{e.title} #{e.start_date.year}, #{e.date_fmt} (#{e.days}d) @ #{e.place}"
33
- end
34
-
35
- puts '' if on.any?
36
-
37
- up.each do |e|
38
- puts " in #{e.diff_days(today)}d #{e.title} #{e.start_date.year}, #{e.date_fmt} (#{e.days}d) @ #{e.place}"
39
- end
40
- puts ''
41
- puts " More @ github.com/footballbook/calendar"
42
- puts ''
13
+ super( args,
14
+ title: 'Upcoming Football Tournaments',
15
+ more_link: 'github.com/footballbook/calendar',
16
+ show_year: true ## e.g. World Cup 2020 etc.
17
+ )
43
18
  end
44
-
45
19
  end # class Football
46
20
 
47
21
  end # module WhatsOn
@@ -0,0 +1,20 @@
1
+ # encoding: utf-8
2
+
3
+ module WhatsOn
4
+
5
+ class PyCon < Tool
6
+
7
+ def self.main() new( ARGV ).list; end
8
+
9
+
10
+ def initialize( args=ARGV )
11
+ args = ['https://github.com/python-organizers/conferences/raw/master/2020.csv'] if args.empty?
12
+
13
+ super( args,
14
+ title: 'Upcoming Python Conferences',
15
+ more_link: 'github.com/python-organizers/conferences'
16
+ )
17
+ end
18
+ end # class PyCon
19
+
20
+ end # module WhatsOn
@@ -2,45 +2,19 @@
2
2
 
3
3
  module WhatsOn
4
4
 
5
- class RubyConf
5
+ class RubyConf < Tool
6
6
 
7
- def initialize
8
- ## turn down logger (default :debug?)
9
- LogUtils::Logger.root.level = :info
7
+ def self.main() new( ARGV ).list; end
10
8
 
11
- @db = EventDb::Memory.new ## note: use in-memory SQLite database
12
- @db.read( "https://github.com/planetruby/calendar/raw/master/_data/conferences2020.yml" )
13
- end
14
-
15
- def print
16
- ## get next 17 events
17
-
18
- today = Date.today
19
-
20
- up = EventDb::Model::Event.limit( 17 ).upcoming( today )
21
- ## pp up.to_sql
22
- ## pp up
23
9
 
24
- puts ''
25
- puts ''
26
- puts "Upcoming Ruby Conferences:"
27
- puts ''
10
+ def initialize( args=ARGV )
11
+ args = ['https://github.com/planetruby/calendar/raw/master/_data/conferences2020.yml'] if args.empty?
28
12
 
29
- on = EventDb::Model::Event.live( today )
30
- on.each do |e|
31
- puts " NOW ON #{e.current_day(today)}d #{e.title}, #{e.date_fmt} (#{e.days}d) @ #{e.place}"
32
- end
33
-
34
- puts '' if on.any?
35
-
36
- up.each do |e|
37
- puts " in #{e.diff_days(today)}d #{e.title}, #{e.date_fmt} (#{e.days}d) @ #{e.place}"
38
- end
39
- puts ''
40
- puts " More @ github.com/planetruby/calendar"
41
- puts ''
13
+ super( args,
14
+ title: 'Upcoming Ruby Conferences',
15
+ more_link: 'github.com/planetruby/calendar'
16
+ )
42
17
  end
43
-
44
18
  end # class RubyConf
45
19
 
46
20
  end # module WhatsOn
@@ -0,0 +1,83 @@
1
+ # encoding: utf-8
2
+
3
+ module WhatsOn
4
+
5
+
6
+ ## base (shared) tool class
7
+ class Tool
8
+
9
+ ## todo/fix: use header, footer instead of title, more_link - why? why not?
10
+
11
+ Config = Struct.new( :title, ## todo/change: find better names for config params - why? why not?
12
+ :more_link,
13
+ :show_year )
14
+
15
+ def initialize( args=ARGV,
16
+ title: 'Upcoming Events',
17
+ more_link: nil,
18
+ show_year: false
19
+ )
20
+ ## turn down logger (default :debug?)
21
+ LogUtils::Logger.root.level = :info
22
+
23
+ @config = Config.new( title,
24
+ more_link,
25
+ show_year )
26
+
27
+ @db = EventDb::Memory.new ## note: use in-memory SQLite database
28
+ args.each do |arg|
29
+ puts " reading >#{arg}<..."
30
+ @db.read( arg )
31
+ end
32
+ end
33
+
34
+
35
+ def list ## note: use list and NOT print (otherwise built-in call to print is recursive and will crash!!!)
36
+ today = Date.today
37
+
38
+ puts ''
39
+ puts ''
40
+ puts "#{@config.title}:"
41
+ puts ''
42
+
43
+ on = EventDb::Model::Event.live( today )
44
+ on.each do |e|
45
+ print " NOW ON #{e.current_day(today)}d "
46
+ print "#{e.title}"
47
+ print " #{e.start_date.year}" if @config.show_year
48
+ print ", "
49
+ print "#{e.date_fmt} (#{e.days}d) @ #{e.place}"
50
+ print "\n"
51
+ end
52
+
53
+ puts '' if on.any?
54
+
55
+ ## get next 17 events
56
+ up = EventDb::Model::Event.limit( 17 ).upcoming( today )
57
+ ## pp up.to_sql
58
+ ## pp up
59
+
60
+ if up.count > 0
61
+ up.each do |e|
62
+ print " in #{e.diff_days(today)}d "
63
+ print "#{e.title}"
64
+ print " #{e.start_date.year}" if @config.show_year
65
+ print ", "
66
+ print "#{e.date_fmt} (#{e.days}d) @ #{e.place}"
67
+ print "\n"
68
+ end
69
+ else
70
+ puts " -- No upcoming events found. #{EventDb::Model::Event.count} past event(s) in database. --"
71
+ end
72
+
73
+ puts ''
74
+
75
+ if @config.more_link
76
+ puts " More @ #{@config.more_link}"
77
+ puts ''
78
+ end
79
+ end
80
+
81
+ end # class Tool
82
+
83
+ end # module WhatsOn
@@ -3,7 +3,7 @@
3
3
  module WhatsOn
4
4
 
5
5
  MAJOR = 1 ## todo: namespace inside version or something - why? why not??
6
- MINOR = 0
6
+ MINOR = 1
7
7
  PATCH = 0
8
8
  VERSION = [MAJOR,MINOR,PATCH].join('.')
9
9
 
@@ -0,0 +1,21 @@
1
+ # encoding: utf-8
2
+
3
+ module WhatsOn
4
+
5
+ class WhatsOn < Tool
6
+
7
+ def self.main() new( ARGV ).list; end
8
+
9
+
10
+ def initialize( args=ARGV )
11
+ args = ['https://github.com/planetruby/calendar/raw/master/_data/conferences2020.yml',
12
+ 'https://github.com/python-organizers/conferences/raw/master/2020.csv',
13
+ ] if args.empty?
14
+
15
+ super( args,
16
+ title: 'Upcoming Events',
17
+ more_link: 'github.com/textkit/whatson#public-event-datasets'
18
+ )
19
+ end
20
+ end # class WhatsOn
21
+ end # module WhatsOn
@@ -9,11 +9,11 @@ require 'helper'
9
9
 
10
10
  class TestBeerFest < MiniTest::Test
11
11
 
12
- def test_print
12
+ def test_list
13
13
 
14
- r = WhatsOn::BeerFest.new
15
- r.print
16
- r.print
14
+ whatson = WhatsOn::BeerFest.new
15
+ whatson.list
16
+ whatson.list
17
17
 
18
18
  assert true # assume ok if we get here
19
19
  end
@@ -9,11 +9,11 @@ require 'helper'
9
9
 
10
10
  class TestKickOff < MiniTest::Test
11
11
 
12
- def test_print
12
+ def test_list
13
13
 
14
- r = WhatsOn::Football.new
15
- r.print
16
- r.print
14
+ whatson = WhatsOn::Football.new
15
+ whatson.list
16
+ whatson.list
17
17
 
18
18
  assert true # assume ok if we get here
19
19
  end
@@ -9,11 +9,11 @@ require 'helper'
9
9
 
10
10
  class TestRubyConf < MiniTest::Test
11
11
 
12
- def test_print
12
+ def test_list
13
13
 
14
- r = WhatsOn::RubyConf.new
15
- r.print
16
- r.print
14
+ whatson = WhatsOn::RubyConf.new
15
+ whatson.list
16
+ whatson.list
17
17
 
18
18
  assert true # assume ok if we get here
19
19
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whatson
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.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-06 00:00:00.000000000 Z
11
+ date: 2019-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eventdb
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.0
19
+ version: 1.1.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.0.0
26
+ version: 1.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: fetcher
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -85,7 +85,9 @@ email: ruby-talk@ruby-lang.org
85
85
  executables:
86
86
  - beerfest
87
87
  - kickoff
88
+ - pycon
88
89
  - rubyconf
90
+ - whatson
89
91
  extensions: []
90
92
  extra_rdoc_files:
91
93
  - CHANGELOG.md
@@ -98,12 +100,17 @@ files:
98
100
  - Rakefile
99
101
  - bin/beerfest
100
102
  - bin/kickoff
103
+ - bin/pycon
101
104
  - bin/rubyconf
105
+ - bin/whatson
102
106
  - lib/whatson.rb
103
107
  - lib/whatson/beerfest.rb
104
108
  - lib/whatson/football.rb
109
+ - lib/whatson/pycon.rb
105
110
  - lib/whatson/rubyconf.rb
111
+ - lib/whatson/tool.rb
106
112
  - lib/whatson/version.rb
113
+ - lib/whatson/whatson.rb
107
114
  - test/helper.rb
108
115
  - test/test_beerfest.rb
109
116
  - test/test_kickoff.rb