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 CHANGED
@@ -1,2 +1,3 @@
1
1
  source 'http://rubygems.org'
2
- gem 'nokogiri'
2
+ gem 'nokogiri'
3
+ gem 'term-ansicolor'
@@ -2,9 +2,11 @@ GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
4
  nokogiri (1.5.2)
5
+ term-ansicolor (1.0.7)
5
6
 
6
7
  PLATFORMS
7
8
  ruby
8
9
 
9
10
  DEPENDENCIES
10
11
  nokogiri
12
+ term-ansicolor
@@ -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
@@ -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 'Naked Lunch'
20
- sandwiches.each {|sandwich| puts "\t#{sandwich}"}
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)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'mealtime'
3
- s.version = '0.0.1'
3
+ s.version = '0.0.2'
4
4
  s.date = '2012-05-11'
5
5
  s.summary = "mealtime: A gem for lunch"
6
6
  s.description = "Finding that tasty lunchtime spot"
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: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
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.23
65
+ rubygems_version: 1.8.24
66
66
  signing_key:
67
67
  specification_version: 3
68
68
  summary: "mealtime: A gem for lunch"