the-exhibitionist 0.1.2
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 +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/Notes.md +52 -0
- data/README.md +41 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/exhibitionist +6 -0
- data/bin/setup +8 -0
- data/exhibitionist.gemspec +32 -0
- data/lib/exhibitionist/cli.rb +131 -0
- data/lib/exhibitionist/museums.rb +31 -0
- data/lib/exhibitionist/shows.rb +225 -0
- data/lib/exhibitionist/version.rb +3 -0
- data/lib/exhibitionist.rb +17 -0
- metadata +134 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 6f71f521ab003bc55cb9e5a5595648e447751678
|
|
4
|
+
data.tar.gz: afeade108d8beb7a88b7828df96830ba2847b981
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 8cd541ab8d8030e90a9861733a1682b14751b01f5dfefc98c442accc636790cd53b751e6816d2febe899e215cab8bf4a8bea45a37cd4f4a2f1043589275e3841
|
|
7
|
+
data.tar.gz: 444607885bf2af96fe2cd81eb958d89e007d4f9b8ccd67f71a77ed729a648876523273f2a7c8190e6458d41edbe5288e98448e085e530eaeccb4942545f55dc4
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Contributor Code of Conduct
|
|
2
|
+
|
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
|
7
|
+
|
|
8
|
+
We are committed to making participation in this project a harassment-free
|
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
|
12
|
+
|
|
13
|
+
Examples of unacceptable behavior by participants include:
|
|
14
|
+
|
|
15
|
+
* The use of sexualized language or imagery
|
|
16
|
+
* Personal attacks
|
|
17
|
+
* Trolling or insulting/derogatory comments
|
|
18
|
+
* Public or private harassment
|
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
|
20
|
+
addresses, without explicit permission
|
|
21
|
+
* Other unethical or unprofessional conduct
|
|
22
|
+
|
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
27
|
+
threatening, offensive, or harmful.
|
|
28
|
+
|
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
|
32
|
+
Conduct may be permanently removed from the project team.
|
|
33
|
+
|
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
|
35
|
+
when an individual is representing the project or its community.
|
|
36
|
+
|
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
38
|
+
reported by contacting a project maintainer at kevinromoser@gmail.com. All
|
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
|
42
|
+
incident.
|
|
43
|
+
|
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
45
|
+
version 1.3.0, available at
|
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
|
47
|
+
|
|
48
|
+
[homepage]: http://contributor-covenant.org
|
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 kromoser
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/Notes.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
Notes
|
|
2
|
+
|
|
3
|
+
Interface:
|
|
4
|
+
|
|
5
|
+
1. Greets user:
|
|
6
|
+
|
|
7
|
+
"Welcome to the Exhbitionist."
|
|
8
|
+
|
|
9
|
+
2. Prints list of shows, sorted by closing date:
|
|
10
|
+
|
|
11
|
+
"These shows are closing soon!"
|
|
12
|
+
"1. Show Title #1"
|
|
13
|
+
"2. Another Show"
|
|
14
|
+
"3. Art show #3"
|
|
15
|
+
"4. Show Title"
|
|
16
|
+
"5. Show Title"
|
|
17
|
+
"6. Show Title"
|
|
18
|
+
"7. Show Title"
|
|
19
|
+
"8. Show Title"
|
|
20
|
+
"9. Art Show"
|
|
21
|
+
"10. Art Show"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
3. Asks user for input:
|
|
26
|
+
|
|
27
|
+
"Which show are you interested in?"
|
|
28
|
+
|
|
29
|
+
4. User gives input, and details of show are listed. Also, other shows at the same museum are listed:
|
|
30
|
+
|
|
31
|
+
"Nasreen Mohamedi"
|
|
32
|
+
"Where: The Metropolitan Museum of Art"
|
|
33
|
+
"10 days until close!"
|
|
34
|
+
"Other current exhibits at at this museum:"
|
|
35
|
+
"Show Title 1 until Date"
|
|
36
|
+
"Show Title 2 until Date"
|
|
37
|
+
"Show Title 3 until Date"
|
|
38
|
+
|
|
39
|
+
5. Commands:
|
|
40
|
+
|
|
41
|
+
"ending soon" should go to master list
|
|
42
|
+
"exit" should exit
|
|
43
|
+
"all shows" or "all exhibitions" should list all shows and their museums:
|
|
44
|
+
"1. Metropolitcan Museum of Art - Nasreen Mohamedi"
|
|
45
|
+
"2. Metropolitan Museum of Art - Show 2 Title"
|
|
46
|
+
"3. MoMA - Show 1 Title"
|
|
47
|
+
"4. Brooklyn Museum - Show 1 Title"
|
|
48
|
+
...
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
data/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Exhibitionist
|
|
2
|
+
|
|
3
|
+
The Exhibitionist is an easy way to see what art exhibtions are currently showing in NYC at a handful of major museums, all from the privacy of your terminal. It defaults to sorting current shows by how soon they're closing, so that you don't miss that show you've been meaning to see.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'the-exhibitionist'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
And then execute:
|
|
14
|
+
|
|
15
|
+
$ bundle
|
|
16
|
+
|
|
17
|
+
Or install it yourself as:
|
|
18
|
+
|
|
19
|
+
$ gem install the-exhibitionist
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
After installing, type 'exhibitionist' to start the program.
|
|
24
|
+
|
|
25
|
+
Follow the prompts to select which show you'd like to get more details about. Selecting an exhibition lists where it is located and when it's closing, as well as other shows you might want to see at the same museum. You can also view shows by instituion, if you're interested in going to a particular museum.
|
|
26
|
+
|
|
27
|
+
## Development
|
|
28
|
+
|
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
30
|
+
|
|
31
|
+
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).
|
|
32
|
+
|
|
33
|
+
## Contributing
|
|
34
|
+
|
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/exhibitionist. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## License
|
|
39
|
+
|
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
|
41
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "exhibitionist"
|
|
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
|
data/bin/exhibitionist
ADDED
data/bin/setup
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'exhibitionist/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "the-exhibitionist"
|
|
8
|
+
spec.version = Exhibitionist::VERSION
|
|
9
|
+
spec.authors = ["kromoser"]
|
|
10
|
+
spec.email = ["kevinromoser@gmail.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{Current art exhibitions in NYC}
|
|
13
|
+
spec.description = %q{A list of some of the current show in NYC, organized by closing date, so you never miss that must-see show.}
|
|
14
|
+
spec.homepage = "https://github.com/kromoser/exhibitionist"
|
|
15
|
+
spec.license = "MIT"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
20
|
+
spec.bindir = "bin"
|
|
21
|
+
#spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
22
|
+
spec.executables = ["exhibitionist"]
|
|
23
|
+
spec.require_paths = ["lib"]
|
|
24
|
+
|
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
27
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
28
|
+
spec.add_development_dependency "pry"
|
|
29
|
+
spec.add_dependency "nokogiri"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
end
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
class Exhibitionist::CLI
|
|
2
|
+
|
|
3
|
+
def initialize
|
|
4
|
+
|
|
5
|
+
puts "Welcome to The Exhibitionist.\n"
|
|
6
|
+
puts "Finding shows...\n\n"
|
|
7
|
+
Exhibitionist::Shows.scrape_all
|
|
8
|
+
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def call
|
|
12
|
+
display_shows
|
|
13
|
+
choose_exhibition
|
|
14
|
+
|
|
15
|
+
#exit
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def display_shows
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
Exhibitionist::Shows.sort_by_closing_date.first(10).each.with_index(1) do |show, index|
|
|
24
|
+
puts "#{index}. #{show.title}"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
puts "\nHere are 10 shows closing soon, listed by which is closing soonest.\n\n"
|
|
28
|
+
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def choose_exhibition
|
|
33
|
+
|
|
34
|
+
puts "Pick a show you're interested in, or type 'all' to see a list of every exhibition."
|
|
35
|
+
puts "You can also type 'museums' to see a list of museums currently represented."
|
|
36
|
+
|
|
37
|
+
input = gets.strip.downcase
|
|
38
|
+
|
|
39
|
+
if input.to_i > 0
|
|
40
|
+
input = input.to_i - 1
|
|
41
|
+
|
|
42
|
+
exhibit = Exhibitionist::Shows.sort_by_closing_date[input]
|
|
43
|
+
puts "\n\n#{exhibit.title}\n\n"
|
|
44
|
+
puts "at the #{exhibit.museum.name}\n\n"
|
|
45
|
+
|
|
46
|
+
exhibit.closing_info
|
|
47
|
+
#puts "Closes on #{exhibit.closing_date}\n\n"
|
|
48
|
+
|
|
49
|
+
#puts "#{exhibit.closing_soon_alert}#{exhibit.days_left} days left to see this show!\n\n"
|
|
50
|
+
|
|
51
|
+
puts "\n\nOther shows at this museum:\n\n"
|
|
52
|
+
|
|
53
|
+
Exhibitionist::Shows.all.each.with_index(1) do |show, index|
|
|
54
|
+
if show.museum.name == exhibit.museum.name && show.title != exhibit.title
|
|
55
|
+
puts show.title
|
|
56
|
+
show.on_view_through
|
|
57
|
+
else
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
choose_again
|
|
62
|
+
|
|
63
|
+
elsif input == "museums"
|
|
64
|
+
puts "The following museums are currently represented:\n\n"
|
|
65
|
+
choose_by_museum
|
|
66
|
+
elsif input == "all"
|
|
67
|
+
all_shows
|
|
68
|
+
elsif input == "exit"
|
|
69
|
+
exit
|
|
70
|
+
else
|
|
71
|
+
puts "I couldn't understand that."
|
|
72
|
+
choose_exhibition
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def choose_again
|
|
78
|
+
puts "Would you like to learn about another show? (Y/N)"
|
|
79
|
+
input = gets.strip.downcase
|
|
80
|
+
if input == "y"
|
|
81
|
+
call
|
|
82
|
+
elsif input == "n" or input == "exit"
|
|
83
|
+
exit
|
|
84
|
+
else
|
|
85
|
+
puts "I couldn't understand that. Please enter Y or N."
|
|
86
|
+
choose_again
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def exit
|
|
92
|
+
puts "Goodbye! Check back soon for updated shows."
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def all_shows
|
|
96
|
+
puts "All Current Exhibitions:"
|
|
97
|
+
Exhibitionist::Shows.sort_by_closing_date.each.with_index(1) do |show, index|
|
|
98
|
+
puts "#{index}. #{show.title}"
|
|
99
|
+
end
|
|
100
|
+
choose_exhibition
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def choose_by_museum
|
|
104
|
+
Exhibitionist::Museums.all.each.with_index(1) do |museum, index|
|
|
105
|
+
puts "#{index}. #{museum.name}"
|
|
106
|
+
end
|
|
107
|
+
puts "\nWhich museum would you like to view? Or type 'back' to see the master exhibition list."
|
|
108
|
+
input = gets.strip.downcase
|
|
109
|
+
|
|
110
|
+
if input.to_i > 0
|
|
111
|
+
input = input.to_i - 1
|
|
112
|
+
|
|
113
|
+
puts "\n\nShows at the #{Exhibitionist::Museums.all[input].name}:\n\n"
|
|
114
|
+
|
|
115
|
+
Exhibitionist::Shows.sort_by_closing_date.each.with_index(1) do |show, index|
|
|
116
|
+
if show.museum.name == Exhibitionist::Museums.all[input].name
|
|
117
|
+
puts show.title
|
|
118
|
+
show.on_view_through
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
choose_again
|
|
122
|
+
elsif input == "back"
|
|
123
|
+
display_shows
|
|
124
|
+
else
|
|
125
|
+
puts "I could't understand that."
|
|
126
|
+
choose_again
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
class Exhibitionist::Museums
|
|
2
|
+
attr_accessor :name
|
|
3
|
+
|
|
4
|
+
@@all = []
|
|
5
|
+
|
|
6
|
+
def self.all
|
|
7
|
+
@@all
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def initialize(name)
|
|
11
|
+
@name = name
|
|
12
|
+
@@all << self
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.create(name)
|
|
16
|
+
self.new(name)
|
|
17
|
+
self.all << self
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.find_by_name(name)
|
|
21
|
+
self.all.find do |object|
|
|
22
|
+
object.name == name
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def self.find_or_create(name)
|
|
27
|
+
self.find_by_name(name) ? self.find_by_name(name) : self.new(name)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
end
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
class Exhibitionist::Shows
|
|
4
|
+
attr_accessor :title, :dates, :museum, :closing_date, :days_left
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@@all_shows = []
|
|
8
|
+
|
|
9
|
+
def self.all
|
|
10
|
+
@@all_shows
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.met_scraper
|
|
14
|
+
|
|
15
|
+
met_shows = []
|
|
16
|
+
|
|
17
|
+
html = open("http://www.metmuseum.org/press/exhibitions/2016/current-major-exhibitions")
|
|
18
|
+
current_shows_page = Nokogiri::HTML(html)
|
|
19
|
+
current_shows = current_shows_page.css("div.general-content p strong em a")
|
|
20
|
+
current_shows.each do |show|
|
|
21
|
+
new_show = self.new
|
|
22
|
+
met_shows << new_show
|
|
23
|
+
self.all << new_show
|
|
24
|
+
new_show.title = show.text
|
|
25
|
+
new_show.museum = Exhibitionist::Museums.find_or_create("Metropolitan Museum of Art")
|
|
26
|
+
new_show.dates = show.parent.parent.next.next
|
|
27
|
+
closing_date_object = Date.parse(new_show.dates.text.gsub(/^\n.+\–/, ""))
|
|
28
|
+
new_show.closing_date = closing_date_object.strftime("%B %-d, %Y")
|
|
29
|
+
today = Date.today
|
|
30
|
+
new_show.days_left = (closing_date_object - today).to_i
|
|
31
|
+
if new_show.days_left < 0
|
|
32
|
+
self.all.delete(new_show)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
met_shows
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def self.moma_scraper
|
|
39
|
+
|
|
40
|
+
moma_shows = []
|
|
41
|
+
|
|
42
|
+
html = open("http://www.moma.org/calendar/exhibitions")
|
|
43
|
+
current_shows_page = Nokogiri::HTML(html)
|
|
44
|
+
current_shows = current_shows_page.css("ul.calendar-tile-list__section--featured li.calendar-tile")
|
|
45
|
+
current_shows.each do |show|
|
|
46
|
+
new_show = self.new
|
|
47
|
+
moma_shows << new_show
|
|
48
|
+
self.all << new_show
|
|
49
|
+
new_show.title = show.css("h3").text.strip
|
|
50
|
+
new_show.museum = Exhibitionist::Museums.find_or_create("MoMA")
|
|
51
|
+
if show.css("p").text.strip.downcase != "ongoing"
|
|
52
|
+
closing_date_object = Date.parse(show.css("p").text.gsub(/^(.+?),\s/, "").strip)
|
|
53
|
+
new_show.closing_date = closing_date_object.strftime("%B %-d, %Y")
|
|
54
|
+
new_show.days_left = (closing_date_object - Date.today).to_i
|
|
55
|
+
else
|
|
56
|
+
new_show.closing_date = "Ongoing"
|
|
57
|
+
new_show.days_left = 9999
|
|
58
|
+
end
|
|
59
|
+
if new_show.days_left < 0
|
|
60
|
+
self.all.delete(new_show)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
moma_shows
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def self.whitney_scraper
|
|
67
|
+
|
|
68
|
+
whitney_shows = []
|
|
69
|
+
|
|
70
|
+
html = open("http://whitney.org/Exhibitions")
|
|
71
|
+
current_shows_page = Nokogiri::HTML(html)
|
|
72
|
+
current_shows = current_shows_page.css("div.exhibitions div.image")
|
|
73
|
+
current_shows.each do |show|
|
|
74
|
+
new_show = self.new
|
|
75
|
+
whitney_shows << new_show
|
|
76
|
+
self.all << new_show
|
|
77
|
+
new_show.title = show.css("h3 a")[0].text.gsub("â", "'").strip
|
|
78
|
+
new_show.museum = Exhibitionist::Museums.find_or_create("Whitney")
|
|
79
|
+
new_show.dates = show.css("h3 span")
|
|
80
|
+
closing_date_object = Date.parse(new_show.dates.text.gsub(/^.+\–/, ""))
|
|
81
|
+
new_show.closing_date = closing_date_object.strftime("%B %-d, %Y")
|
|
82
|
+
new_show.days_left = (closing_date_object - Date.today).to_i
|
|
83
|
+
if new_show.days_left < 0
|
|
84
|
+
self.all.delete(new_show)
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
whitney_shows
|
|
89
|
+
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def self.brooklyn_scraper
|
|
93
|
+
|
|
94
|
+
brooklyn_shows = []
|
|
95
|
+
|
|
96
|
+
html = open("https://www.brooklynmuseum.org/exhibitions")
|
|
97
|
+
current_shows_page = Nokogiri::HTML(html)
|
|
98
|
+
|
|
99
|
+
current_shows = current_shows_page.css("div.exhibitions").xpath("//h1[1]/following-sibling::div").css("div.image-card h2")
|
|
100
|
+
|
|
101
|
+
current_shows.each do |show|
|
|
102
|
+
new_show = self.new
|
|
103
|
+
brooklyn_shows << new_show
|
|
104
|
+
self.all << new_show
|
|
105
|
+
new_show.title = show.text
|
|
106
|
+
new_show.museum = Exhibitionist::Museums.find_or_create("Brooklyn Museum")
|
|
107
|
+
new_show.dates = show.parent.css("h4")
|
|
108
|
+
closing_date_object = Date.parse(new_show.dates.text.strip.gsub(/^.+\–/, ""))
|
|
109
|
+
new_show.closing_date = closing_date_object.strftime("%B %-d, %Y")
|
|
110
|
+
new_show.days_left = (closing_date_object - Date.today).to_i
|
|
111
|
+
if new_show.days_left < 0
|
|
112
|
+
self.all.delete(new_show)
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
brooklyn_shows
|
|
117
|
+
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def self.new_museum_scraper
|
|
121
|
+
|
|
122
|
+
new_museum_shows = []
|
|
123
|
+
|
|
124
|
+
html = open("http://www.newmuseum.org/exhibitions")
|
|
125
|
+
current_shows_page = Nokogiri::HTML(html)
|
|
126
|
+
current_shows = current_shows_page.css("div.columns div.exh a")
|
|
127
|
+
current_shows.each do |show|
|
|
128
|
+
new_show = self.new
|
|
129
|
+
new_museum_shows << new_show
|
|
130
|
+
self.all << new_show
|
|
131
|
+
new_show.title = show.css("span.title").text
|
|
132
|
+
new_show.museum = Exhibitionist::Museums.find_or_create("New Museum")
|
|
133
|
+
new_show.dates = show.css("span.date-range")
|
|
134
|
+
closing_date_object = Date.strptime("#{new_show.dates.text.gsub("Ending Soon", "").strip.gsub(/^.+\-/, "")}", "%m/%d/%y")
|
|
135
|
+
new_show.closing_date = closing_date_object.strftime("%B %-d, %Y")
|
|
136
|
+
new_show.days_left = (closing_date_object - Date.today).to_i
|
|
137
|
+
if new_show.days_left < 0
|
|
138
|
+
self.all.delete(new_show)
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
new_museum_shows
|
|
143
|
+
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def self.sort_by_closing_date
|
|
148
|
+
self.all.sort_by { |show| show.days_left }
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def closing_soon_alert
|
|
153
|
+
if self.days_left < 8
|
|
154
|
+
puts "CLOSING SOON!!! Hurry up, there are only"
|
|
155
|
+
else
|
|
156
|
+
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def closing_info
|
|
162
|
+
|
|
163
|
+
if self.days_left == 0
|
|
164
|
+
puts "Hurry up! This show closes today!!"
|
|
165
|
+
elsif self.days_left == 1
|
|
166
|
+
puts "Hurry Up! This show closes tomorrow!!"
|
|
167
|
+
elsif self.days_left < 8
|
|
168
|
+
puts "Hurry up! This show closes in #{self.days_left} days!! It closes on #{self.closing_date}."
|
|
169
|
+
elsif self.closing_date == "Ongoing"
|
|
170
|
+
puts "This show is ongoing. You've got plenty of time."
|
|
171
|
+
else
|
|
172
|
+
puts "This show closes in #{self.days_left} days, on #{self.closing_date}."
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
def on_view_through
|
|
178
|
+
|
|
179
|
+
if self.closing_date == "Ongoing"
|
|
180
|
+
puts "This show is ongoing.\n\n"
|
|
181
|
+
else
|
|
182
|
+
puts "On view through #{self.closing_date}.\n\n"
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
def self.scrape_all
|
|
187
|
+
|
|
188
|
+
begin
|
|
189
|
+
self.met_scraper
|
|
190
|
+
rescue
|
|
191
|
+
self.all.delete_if { |show| show.museum.name == "Metropolitan Museum of Art"}
|
|
192
|
+
puts "There was a problem scraping the Met's website. Finding other shows... \n\n"
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
begin
|
|
196
|
+
self.moma_scraper
|
|
197
|
+
rescue
|
|
198
|
+
self.all.delete_if { |show| show.museum.name == "MoMA"}
|
|
199
|
+
puts "There was a problem scraping the MoMA's website... \n\n"
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
begin
|
|
203
|
+
self.whitney_scraper
|
|
204
|
+
rescue
|
|
205
|
+
self.all.delete_if { |show| show.museum.name == "Whitney"}
|
|
206
|
+
puts "There was a problem scraping the Whitney's website... \n\n"
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
begin
|
|
210
|
+
self.brooklyn_scraper
|
|
211
|
+
rescue
|
|
212
|
+
self.all.delete_if { |show| show.museum.name == "Brooklyn Museum"}
|
|
213
|
+
puts "There was a problem scraping the Brooklyn Museum's website... \n\n"
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
begin
|
|
217
|
+
self.new_museum_scraper
|
|
218
|
+
rescue
|
|
219
|
+
self.all.delete_if { |show| show.museum.name == "New Museum"}
|
|
220
|
+
puts "There was a problem scraping the New Museum's website... \n\n"
|
|
221
|
+
end
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
require "nokogiri"
|
|
3
|
+
require "open-uri"
|
|
4
|
+
require "pry"
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
require "exhibitionist/version"
|
|
8
|
+
|
|
9
|
+
require_relative "./exhibitionist/cli"
|
|
10
|
+
require_relative "./exhibitionist/museums"
|
|
11
|
+
require_relative "./exhibitionist/shows"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
#module Exhibitionist
|
|
16
|
+
# Your code goes here...
|
|
17
|
+
#end
|
metadata
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: the-exhibitionist
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.2
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- kromoser
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2016-06-07 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.11'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.11'
|
|
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: rspec
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '3.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '3.0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: pry
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :development
|
|
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: nokogiri
|
|
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: A list of some of the current show in NYC, organized by closing date,
|
|
84
|
+
so you never miss that must-see show.
|
|
85
|
+
email:
|
|
86
|
+
- kevinromoser@gmail.com
|
|
87
|
+
executables:
|
|
88
|
+
- exhibitionist
|
|
89
|
+
extensions: []
|
|
90
|
+
extra_rdoc_files: []
|
|
91
|
+
files:
|
|
92
|
+
- ".gitignore"
|
|
93
|
+
- ".rspec"
|
|
94
|
+
- ".travis.yml"
|
|
95
|
+
- CODE_OF_CONDUCT.md
|
|
96
|
+
- Gemfile
|
|
97
|
+
- LICENSE.txt
|
|
98
|
+
- Notes.md
|
|
99
|
+
- README.md
|
|
100
|
+
- Rakefile
|
|
101
|
+
- bin/console
|
|
102
|
+
- bin/exhibitionist
|
|
103
|
+
- bin/setup
|
|
104
|
+
- exhibitionist.gemspec
|
|
105
|
+
- lib/exhibitionist.rb
|
|
106
|
+
- lib/exhibitionist/cli.rb
|
|
107
|
+
- lib/exhibitionist/museums.rb
|
|
108
|
+
- lib/exhibitionist/shows.rb
|
|
109
|
+
- lib/exhibitionist/version.rb
|
|
110
|
+
homepage: https://github.com/kromoser/exhibitionist
|
|
111
|
+
licenses:
|
|
112
|
+
- MIT
|
|
113
|
+
metadata: {}
|
|
114
|
+
post_install_message:
|
|
115
|
+
rdoc_options: []
|
|
116
|
+
require_paths:
|
|
117
|
+
- lib
|
|
118
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
119
|
+
requirements:
|
|
120
|
+
- - ">="
|
|
121
|
+
- !ruby/object:Gem::Version
|
|
122
|
+
version: '0'
|
|
123
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
|
+
requirements:
|
|
125
|
+
- - ">="
|
|
126
|
+
- !ruby/object:Gem::Version
|
|
127
|
+
version: '0'
|
|
128
|
+
requirements: []
|
|
129
|
+
rubyforge_project:
|
|
130
|
+
rubygems_version: 2.4.5.1
|
|
131
|
+
signing_key:
|
|
132
|
+
specification_version: 4
|
|
133
|
+
summary: Current art exhibitions in NYC
|
|
134
|
+
test_files: []
|