orlando_events 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/Gemfile +4 -0
- data/README.md +33 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/orlando_events +7 -0
- data/bin/setup +8 -0
- data/lib/orlando_events.rb +10 -0
- data/lib/orlando_events/cli.rb +84 -0
- data/lib/orlando_events/event.rb +38 -0
- data/lib/orlando_events/month_events.rb +22 -0
- data/lib/orlando_events/scraper.rb +33 -0
- data/lib/orlando_events/version.rb +3 -0
- data/orlando_events.gemspec +38 -0
- data/spec.md +6 -0
- metadata +130 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6f9c5c91e46195364e55e9ad4da4d5b33d9e348b
|
4
|
+
data.tar.gz: d6a96459a682491d03d2bd729e2deea89d4775a3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 78769421c71954927835f86cceb2c5cf4e0be15751b6b1a247359fcf44909f345788d5b10ced78494bbcc32d31487799f0eaff756efcd18b5c07ccd1cb0a1b7d
|
7
|
+
data.tar.gz: a9aaa2c082f98d74b9aa449198aada5f364bd146868ce2286b7e6124f618afbb8fc2a971a84122de2e331da9e6cb48ed00559681590bafec0e177514b1eb8c71
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# OrlandoEvents
|
2
|
+
|
3
|
+
Welcome to the OrlandoEvents gem! With this gem you will be able to print out the latest available event information from Downtown Orlando's website. You can visit it here: http://www.downtownorlando.com/future/events/
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'orlando_events'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install orlando_events
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Run 'orlando_events' after installing the gem.s
|
24
|
+
|
25
|
+
## Development
|
26
|
+
|
27
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
28
|
+
|
29
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
30
|
+
|
31
|
+
## Contributing
|
32
|
+
|
33
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/FreeBreadsticks/erika-cli-app.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "orlando_events"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/orlando_events
ADDED
data/bin/setup
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
require 'pry'
|
3
|
+
require 'open-uri'
|
4
|
+
require 'colorize'
|
5
|
+
|
6
|
+
require_relative "orlando_events/version"
|
7
|
+
require_relative './orlando_events/cli'
|
8
|
+
require_relative './orlando_events/event'
|
9
|
+
require_relative './orlando_events/scraper'
|
10
|
+
require_relative './orlando_events/month_events'
|
@@ -0,0 +1,84 @@
|
|
1
|
+
#CLI Controller
|
2
|
+
class OrlandoEvents::CLI
|
3
|
+
|
4
|
+
def call
|
5
|
+
puts "Loading Events..."
|
6
|
+
puts "."
|
7
|
+
make_months
|
8
|
+
puts ".."
|
9
|
+
add_attributes_to_months
|
10
|
+
puts "..."
|
11
|
+
list_dates
|
12
|
+
menu
|
13
|
+
goodbye
|
14
|
+
end
|
15
|
+
|
16
|
+
def make_months
|
17
|
+
months_array = OrlandoEvents::Scraper.scrape_dates("http://www.downtownorlando.com/future/events/")
|
18
|
+
OrlandoEvents::Event.create_from_collection(months_array)
|
19
|
+
end
|
20
|
+
|
21
|
+
def add_attributes_to_months
|
22
|
+
OrlandoEvents::Event.all.each do |month|
|
23
|
+
events = OrlandoEvents::Scraper.scrape_event_info(month.month_url)
|
24
|
+
month.add_event_details(events)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def list_dates
|
29
|
+
puts "***************************************************".colorize(:green)
|
30
|
+
puts "* *".colorize(:green)
|
31
|
+
puts "* Welcome to the Orlando Event Tracker! *".colorize(:green)
|
32
|
+
puts "* *".colorize(:green)
|
33
|
+
puts "***************************************************".colorize(:green)
|
34
|
+
puts ""
|
35
|
+
puts "Downtown has so much to offer everyone, who lives, works and plays in Central Florida. Check out what's going on in and around Downtown Orlando!"
|
36
|
+
puts ""
|
37
|
+
puts "**********************************".colorize(:yellow)
|
38
|
+
@dates = OrlandoEvents::Event.all
|
39
|
+
@dates.each.with_index(1) do |date, i|
|
40
|
+
puts "#{i}. #{date.name}".colorize(:light_cyan)
|
41
|
+
end
|
42
|
+
puts "**********************************".colorize(:yellow)
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
def menu
|
47
|
+
input = nil
|
48
|
+
while input != "exit"
|
49
|
+
puts "Which month's events would you like to see? Enter" + " number".colorize(:green) + " associated with month:"
|
50
|
+
puts "Enter " + "list".colorize(:green) + " to see months again or enter " + "exit".colorize(:green) + " to quit program."
|
51
|
+
input = gets.strip
|
52
|
+
if input.to_i > 0 && input.to_i <= @dates.length
|
53
|
+
puts "**** Events for#{@dates[input.to_i-1].name} ****".colorize(:yellow)
|
54
|
+
puts ""
|
55
|
+
@dates[input.to_i-1].events.each.with_index(1) do |event, i|
|
56
|
+
puts "#{i}. Event: #{event.event_title}".colorize(:light_green)
|
57
|
+
puts " Date: #{event.date}".colorize(:light_blue)
|
58
|
+
puts " Location: #{event.event_location}".colorize(:light_red)
|
59
|
+
puts "------------------------------------------".colorize(:yellow)
|
60
|
+
end
|
61
|
+
puts "**** Events for#{@dates[input.to_i-1].name} ****".colorize(:yellow)
|
62
|
+
puts ""
|
63
|
+
elsif input == "list"
|
64
|
+
list_dates
|
65
|
+
else
|
66
|
+
if input != "exit"
|
67
|
+
puts ""
|
68
|
+
puts "DOES NOT COMPUTE. Enter " + "number".colorize(:green) + " of month," + " 'list' ".colorize(:green) + "or " + "exit".colorize(:green)
|
69
|
+
puts ""
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def goodbye
|
76
|
+
puts ""
|
77
|
+
puts "**********************************".colorize(:yellow)
|
78
|
+
puts "Have a nice day!"
|
79
|
+
puts "Be sure to come back soon for more fun events!"
|
80
|
+
puts "**********************************".colorize(:yellow)
|
81
|
+
puts ""
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
class OrlandoEvents::Event
|
2
|
+
attr_accessor :name, :events, :month_url
|
3
|
+
|
4
|
+
@@all = []
|
5
|
+
|
6
|
+
def initialize(month_hash)
|
7
|
+
@events = []
|
8
|
+
month_hash.each do |k,v|
|
9
|
+
self.send "#{k}=", v
|
10
|
+
end
|
11
|
+
@@all << self
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.create_from_collection(months_array)
|
15
|
+
months_array.each do |month|
|
16
|
+
self.new(month)
|
17
|
+
# binding.pry
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def add_event_details(events_array)
|
22
|
+
events_array.each do |event_hash|
|
23
|
+
OrlandoEvents::MonthEvents.new(event_hash, self)
|
24
|
+
end
|
25
|
+
self
|
26
|
+
end
|
27
|
+
|
28
|
+
def add_events(month_events)
|
29
|
+
month_events.month = self if !month_events.month
|
30
|
+
@events << month_events
|
31
|
+
# binding.pry
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.all
|
35
|
+
@@all
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class OrlandoEvents::MonthEvents
|
2
|
+
attr_accessor :date, :event_title, :event_location, :month
|
3
|
+
@@all = []
|
4
|
+
|
5
|
+
def initialize(months_hash, month)
|
6
|
+
months_hash.each do |k, v|
|
7
|
+
self.send "#{k}=", v
|
8
|
+
end
|
9
|
+
self.month = month
|
10
|
+
@@all << self
|
11
|
+
end
|
12
|
+
|
13
|
+
def month=(month)
|
14
|
+
@month = month
|
15
|
+
month.add_events(self)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.all
|
19
|
+
@@all
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class OrlandoEvents::Scraper
|
2
|
+
|
3
|
+
def self.scrape_events
|
4
|
+
events = []
|
5
|
+
events << self.scrape_dates
|
6
|
+
events
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.scrape_dates(date_page)
|
10
|
+
months = []
|
11
|
+
doc = Nokogiri::HTML(open(date_page))
|
12
|
+
doc.css("div#left_nav li").each do |month|
|
13
|
+
link = month.css("a").map {|link| link['href']}
|
14
|
+
month_info = {:name => month.css("a").text.gsub(" ", ""), :month_url => "http://www.downtownorlando.com/future#{link[0]}"}
|
15
|
+
months << month_info
|
16
|
+
end
|
17
|
+
months
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.scrape_event_info(month_page)
|
21
|
+
doc = Nokogiri::HTML(open(month_page))
|
22
|
+
events = []
|
23
|
+
doc.css(".view-content .row-fluid").each do |event|
|
24
|
+
date = event.css("strong").text.gsub("\n ","") #gets date
|
25
|
+
event_detail = {:date => date.gsub(" ",""), :event_title => event.css(".event_title a").text, :event_location => event.css(".location").text}
|
26
|
+
events << event_detail
|
27
|
+
|
28
|
+
end
|
29
|
+
# binding.pry
|
30
|
+
events
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'orlando_events/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "orlando_events"
|
8
|
+
spec.version = OrlandoEvents::VERSION
|
9
|
+
spec.authors = ["'Erika Hughes'"]
|
10
|
+
spec.email = ["'ehughes@knights.ucf.edu'"]
|
11
|
+
|
12
|
+
spec.summary = %q{Information for events in Downtown Orlando Florida}
|
13
|
+
spec.homepage = "https://github.com/FreeBreadsticks/erika-cli-app"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
+
# if spec.respond_to?(:metadata)
|
19
|
+
# spec.metadata['allowed_push_host'] = "Set to 'http://rubygems.org/gems/orlando_events'"
|
20
|
+
# else
|
21
|
+
# raise "RubyGems 2.0 or newer is required to protect against " \
|
22
|
+
# "public gem pushes."
|
23
|
+
# end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
26
|
+
f.match(%r{^(test|spec|features)/})
|
27
|
+
end
|
28
|
+
|
29
|
+
spec.executables = ["orlando_events"]
|
30
|
+
spec.require_paths = ["lib"]
|
31
|
+
|
32
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
33
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
34
|
+
spec.add_development_dependency "pry"
|
35
|
+
spec.add_dependency "nokogiri"
|
36
|
+
spec.add_dependency "colorize"
|
37
|
+
|
38
|
+
end
|
data/spec.md
ADDED
metadata
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: orlando_events
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- "'Erika Hughes'"
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-03-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.14'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.14'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: nokogiri
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: colorize
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
- "'ehughes@knights.ucf.edu'"
|
86
|
+
executables:
|
87
|
+
- orlando_events
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- Gemfile
|
93
|
+
- README.md
|
94
|
+
- Rakefile
|
95
|
+
- bin/console
|
96
|
+
- bin/orlando_events
|
97
|
+
- bin/setup
|
98
|
+
- lib/orlando_events.rb
|
99
|
+
- lib/orlando_events/cli.rb
|
100
|
+
- lib/orlando_events/event.rb
|
101
|
+
- lib/orlando_events/month_events.rb
|
102
|
+
- lib/orlando_events/scraper.rb
|
103
|
+
- lib/orlando_events/version.rb
|
104
|
+
- orlando_events.gemspec
|
105
|
+
- spec.md
|
106
|
+
homepage: https://github.com/FreeBreadsticks/erika-cli-app
|
107
|
+
licenses:
|
108
|
+
- MIT
|
109
|
+
metadata: {}
|
110
|
+
post_install_message:
|
111
|
+
rdoc_options: []
|
112
|
+
require_paths:
|
113
|
+
- lib
|
114
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
requirements: []
|
125
|
+
rubyforge_project:
|
126
|
+
rubygems_version: 2.6.11
|
127
|
+
signing_key:
|
128
|
+
specification_version: 4
|
129
|
+
summary: Information for events in Downtown Orlando Florida
|
130
|
+
test_files: []
|