mealtime 0.0.1 → 0.0.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.
- data/Gemfile +2 -1
- data/Gemfile.lock +2 -0
- data/bin/mealtime +6 -0
- data/lib/mealtime.rb +32 -2
- data/mealtime.gemspec +1 -1
- metadata +4 -4
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/bin/mealtime
CHANGED
@@ -6,11 +6,17 @@ require 'mealtime'
|
|
6
6
|
if ARGV.length == 0
|
7
7
|
# GET ALL THE PLACES!
|
8
8
|
MealTime.get_naked_lunch
|
9
|
+
MealTime.get_cheeseboard
|
10
|
+
MealTime.get_arizmendi
|
9
11
|
else
|
10
12
|
puts "Processing the select restaurants..."
|
11
13
|
# For now, we'll handle --naked for Naked Lunch, plan accordingly for the future
|
12
14
|
case ARGV.first
|
13
15
|
when "--naked"
|
14
16
|
MealTime.get_naked_lunch
|
17
|
+
when "--cheeseboard"
|
18
|
+
MealTime.get_cheeseboard
|
19
|
+
when "--arizmendi"
|
20
|
+
MealTime.get_arizmendi
|
15
21
|
end
|
16
22
|
end
|
data/lib/mealtime.rb
CHANGED
@@ -1,9 +1,15 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'nokogiri'
|
3
3
|
require 'open-uri'
|
4
|
+
require 'term/ansicolor'
|
5
|
+
|
6
|
+
include Term::ANSIColor
|
4
7
|
|
5
8
|
class MealTime
|
9
|
+
DAYS = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
|
10
|
+
|
6
11
|
def self.get_naked_lunch
|
12
|
+
puts 'Naked Lunch'.green.bold
|
7
13
|
sandwiches = []
|
8
14
|
html_body = get_nokogiri_object_from_url("http://sites.google.com/site/nakedlunchsf/")
|
9
15
|
[
|
@@ -16,10 +22,34 @@ class MealTime
|
|
16
22
|
sandwiches << node.content.split("\302").first
|
17
23
|
end
|
18
24
|
end
|
19
|
-
puts
|
20
|
-
|
25
|
+
sandwiches.each {|sandwich| puts " #{sandwich}"}
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.get_cheeseboard
|
29
|
+
puts "Cheeseboard".green.bold
|
30
|
+
# The conditional is a weird way of finding whether its Monday through Saturday
|
31
|
+
if (2..6).include?(Time.now.wday)
|
32
|
+
pizzas = []
|
33
|
+
html_body = get_nokogiri_object_from_url("http://cheeseboardcollective.coop/pizza")
|
34
|
+
html_body.css("div.column")[0].css("p").each do |node|
|
35
|
+
pizzas << node.content
|
36
|
+
end
|
37
|
+
pizzas.slice!(5..pizzas.length)
|
38
|
+
puts " #{DAYS[Time.now.wday]}".blue + ": #{pizzas[Time.now.wday-2]}"
|
39
|
+
else
|
40
|
+
puts " Closed!".red
|
41
|
+
end
|
21
42
|
end
|
22
43
|
|
44
|
+
def self.get_arizmendi
|
45
|
+
puts "Arizmendi Bakery/Pizzeria".green.bold
|
46
|
+
html_body = get_nokogiri_object_from_url("http://www.arizmendibakery.org/pizza")
|
47
|
+
html_body.css("td.active p.yasp-item").each do |node|
|
48
|
+
puts " #{DAYS[Time.now.wday]}".blue + ": #{node.content}"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
|
23
53
|
private
|
24
54
|
def self.get_nokogiri_object_from_url(url)
|
25
55
|
html = open(url)
|
data/mealtime.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mealtime
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matthew DuVall
|
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
62
|
requirements: []
|
63
63
|
|
64
64
|
rubyforge_project:
|
65
|
-
rubygems_version: 1.8.
|
65
|
+
rubygems_version: 1.8.24
|
66
66
|
signing_key:
|
67
67
|
specification_version: 3
|
68
68
|
summary: "mealtime: A gem for lunch"
|