mealtime 0.0.1

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 ADDED
@@ -0,0 +1,2 @@
1
+ source 'http://rubygems.org'
2
+ gem 'nokogiri'
data/Gemfile.lock ADDED
@@ -0,0 +1,10 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ nokogiri (1.5.2)
5
+
6
+ PLATFORMS
7
+ ruby
8
+
9
+ DEPENDENCIES
10
+ nokogiri
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ mealtime
2
+ ========
3
+
4
+ Scraping the interwebz for your favorite daily restaurants.
data/bin/mealtime ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.expand_path("../../lib", __FILE__)
4
+ require 'mealtime'
5
+
6
+ if ARGV.length == 0
7
+ # GET ALL THE PLACES!
8
+ MealTime.get_naked_lunch
9
+ else
10
+ puts "Processing the select restaurants..."
11
+ # For now, we'll handle --naked for Naked Lunch, plan accordingly for the future
12
+ case ARGV.first
13
+ when "--naked"
14
+ MealTime.get_naked_lunch
15
+ end
16
+ end
data/lib/mealtime.rb ADDED
@@ -0,0 +1,29 @@
1
+ require 'rubygems'
2
+ require 'nokogiri'
3
+ require 'open-uri'
4
+
5
+ class MealTime
6
+ def self.get_naked_lunch
7
+ sandwiches = []
8
+ html_body = get_nokogiri_object_from_url("http://sites.google.com/site/nakedlunchsf/")
9
+ [
10
+ '//*[@id="sites-canvas-main-content"]/div/table/tbody/tr/td[2]/div/div/div[2]/div[5]/font/span/b',
11
+ '//*[@id="sites-canvas-main-content"]/div/table/tbody/tr/td[2]/div/div/div[2]/div[9]/font/span/b',
12
+ '//*[@id="sites-canvas-main-content"]/div/table/tbody/tr/td[2]/div/div/div[2]/div[13]/font/span/b',
13
+ '//*[@id="sites-canvas-main-content"]/div/table/tbody/tr/td[2]/div/div/div[2]/div[17]/font/span/b'
14
+ ].each do |sandwich_xpath|
15
+ html_body.xpath(sandwich_xpath).each do |node|
16
+ sandwiches << node.content.split("\302").first
17
+ end
18
+ end
19
+ puts 'Naked Lunch'
20
+ sandwiches.each {|sandwich| puts "\t#{sandwich}"}
21
+ end
22
+
23
+ private
24
+ def self.get_nokogiri_object_from_url(url)
25
+ html = open(url)
26
+ doc = Nokogiri::HTML(html.read)
27
+ doc
28
+ end
29
+ end
data/mealtime.gemspec ADDED
@@ -0,0 +1,13 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'mealtime'
3
+ s.version = '0.0.1'
4
+ s.date = '2012-05-11'
5
+ s.summary = "mealtime: A gem for lunch"
6
+ s.description = "Finding that tasty lunchtime spot"
7
+ s.authors = ["Matthew DuVall"]
8
+ s.email = 'mduvall89@gmail.com'
9
+ s.files = `git ls-files`.split("\n")
10
+ s.require_path = 'lib'
11
+ s.homepage = 'http://www.mattduvall.com'
12
+ s.executables << "mealtime"
13
+ end
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mealtime
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Matthew DuVall
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-05-11 00:00:00 Z
19
+ dependencies: []
20
+
21
+ description: Finding that tasty lunchtime spot
22
+ email: mduvall89@gmail.com
23
+ executables:
24
+ - mealtime
25
+ extensions: []
26
+
27
+ extra_rdoc_files: []
28
+
29
+ files:
30
+ - Gemfile
31
+ - Gemfile.lock
32
+ - README.md
33
+ - bin/mealtime
34
+ - lib/mealtime.rb
35
+ - mealtime.gemspec
36
+ homepage: http://www.mattduvall.com
37
+ licenses: []
38
+
39
+ post_install_message:
40
+ rdoc_options: []
41
+
42
+ require_paths:
43
+ - lib
44
+ required_ruby_version: !ruby/object:Gem::Requirement
45
+ none: false
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ hash: 3
50
+ segments:
51
+ - 0
52
+ version: "0"
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ hash: 3
59
+ segments:
60
+ - 0
61
+ version: "0"
62
+ requirements: []
63
+
64
+ rubyforge_project:
65
+ rubygems_version: 1.8.23
66
+ signing_key:
67
+ specification_version: 3
68
+ summary: "mealtime: A gem for lunch"
69
+ test_files: []
70
+