guestlistapp 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/bin/guestlistapp +61 -0
  2. metadata +95 -0
data/bin/guestlistapp ADDED
@@ -0,0 +1,61 @@
1
+ require 'nokogiri'
2
+ require 'open-uri'
3
+
4
+ $url = url = ARGV.first
5
+ puts $url
6
+ $attendees = []
7
+ while url
8
+ html = open(url).read
9
+ uri = URI.parse(url)
10
+ base = "http://#{uri.host}"
11
+ doc = Nokogiri::HTML(html)
12
+ $event_name ||= doc.at('.event-name').inner_text
13
+ $event_subtitle ||= doc.at('.event-subtitle').inner_text
14
+ doc.search(".attendee").each do |x|
15
+ $attendees << {
16
+ name: x.inner_text, img: x.at('img')['data-src']
17
+ }
18
+ end
19
+ nextpage = doc.at("a[@data-next-page]/@data-next-page")
20
+ break unless nextpage
21
+ url = base + nextpage
22
+ puts "Getting #{url}"
23
+ end
24
+
25
+ require 'sinatra'
26
+ require 'haml'
27
+
28
+ class GuestList < Sinatra::Base
29
+ template :index do
30
+ <<END
31
+ %html
32
+ %head
33
+ %title= $event_anme
34
+ :css
35
+ body { font-family: Helvetica }
36
+ img { width: 80px; height:80px }
37
+ .person { float: left; height: 120px; width: 100px; padding: 10px }
38
+ %body
39
+ %h2= $event_name
40
+ %h3= $event_subtitle
41
+ %p
42
+ %a{href:$url} Original Event Page
43
+ - $attendees.each do |x|
44
+ .person
45
+ %img{src:x[:img]}
46
+ = x[:name]
47
+
48
+ END
49
+ end
50
+
51
+ get '/' do
52
+ haml :index
53
+ end
54
+
55
+
56
+ browsercmd = RUBY_PLATFORM =~ /darwin/ ? 'open' : %w(gnome-open firefox open).detect {|x| `which #{x}` =~ /#{x}/}
57
+ fork do
58
+ `sleep 1 && #{browsercmd} http://localhost:4567`
59
+ end
60
+ run!
61
+ end
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: guestlistapp
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Daniel Choi
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-06-11 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: haml
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: nokogiri
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: sinatra
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ description: Stitch together all the attendees of a guestlistapp.com event
63
+ email:
64
+ - dhchoi@gmail.com
65
+ executables:
66
+ - guestlistapp
67
+ extensions: []
68
+ extra_rdoc_files: []
69
+ files:
70
+ - bin/guestlistapp
71
+ homepage: http://github.com/danchoi/guestlistapp
72
+ licenses: []
73
+ post_install_message:
74
+ rdoc_options: []
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: 1.9.0
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubyforge_project: guestlistapp
91
+ rubygems_version: 1.8.23
92
+ signing_key:
93
+ specification_version: 3
94
+ summary: Stitch together all the attendees of a guestlistapp.com event
95
+ test_files: []