badslava_import 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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5101054ec53c2aad0bc1c2f71bd66748b5b48b5a
4
+ data.tar.gz: 8126d78748617cfe7bb865fba3e43e22112f7859
5
+ SHA512:
6
+ metadata.gz: b31448ea03896b1850d4742c2de9a3d007bcd3de98ca935dd984662c221e39a53b5c5bbe3779dfb4c92ddb83ce5e0e22bc3f76c95c58c75afdd8dad90720854e
7
+ data.tar.gz: 9d50f1419cd6de4ce5d58b04631f2cdc847d631e8c2beb8c26af1c11cdf21d642c45b07ba83528935d70894e92170e3220b86dc53a3c9db70833f82c1b267cf2
Binary file
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source "https://rubygems.org"
2
+
3
+ ruby "2.2.4"
4
+
5
+ group :development do
6
+ gem "bundler", "~> 1.0"
7
+ gem "juwelier", "~> 2.1.0"
8
+ gem "pry"
9
+ end
10
+
11
+ gem "nokogiri", "~> 1.6.8.1"
@@ -0,0 +1,68 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ addressable (2.4.0)
5
+ builder (3.2.3)
6
+ coderay (1.1.1)
7
+ descendants_tracker (0.0.4)
8
+ thread_safe (~> 0.3, >= 0.3.1)
9
+ faraday (0.9.2)
10
+ multipart-post (>= 1.2, < 3)
11
+ git (1.3.0)
12
+ github_api (0.14.5)
13
+ addressable (~> 2.4.0)
14
+ descendants_tracker (~> 0.0.4)
15
+ faraday (~> 0.8, < 0.10)
16
+ hashie (>= 3.4)
17
+ oauth2 (~> 1.0)
18
+ hashie (3.4.6)
19
+ highline (1.7.8)
20
+ juwelier (2.1.3)
21
+ builder
22
+ bundler (>= 1.13)
23
+ git (>= 1.2.5)
24
+ github_api
25
+ highline (>= 1.6.15)
26
+ nokogiri (>= 1.5.10)
27
+ rake
28
+ rdoc
29
+ semver
30
+ jwt (1.5.6)
31
+ method_source (0.8.2)
32
+ mini_portile2 (2.1.0)
33
+ multi_json (1.12.1)
34
+ multi_xml (0.6.0)
35
+ multipart-post (2.0.0)
36
+ nokogiri (1.6.8.1)
37
+ mini_portile2 (~> 2.1.0)
38
+ oauth2 (1.3.0)
39
+ faraday (>= 0.8, < 0.11)
40
+ jwt (~> 1.0)
41
+ multi_json (~> 1.3)
42
+ multi_xml (~> 0.5)
43
+ rack (>= 1.2, < 3)
44
+ pry (0.10.4)
45
+ coderay (~> 1.1.0)
46
+ method_source (~> 0.8.1)
47
+ slop (~> 3.4)
48
+ rack (2.0.1)
49
+ rake (12.0.0)
50
+ rdoc (5.0.0)
51
+ semver (1.0.1)
52
+ slop (3.6.0)
53
+ thread_safe (0.3.5)
54
+
55
+ PLATFORMS
56
+ ruby
57
+
58
+ DEPENDENCIES
59
+ bundler (~> 1.0)
60
+ juwelier (~> 2.1.0)
61
+ nokogiri (~> 1.6.8.1)
62
+ pry
63
+
64
+ RUBY VERSION
65
+ ruby 2.2.4p230
66
+
67
+ BUNDLED WITH
68
+ 1.13.6
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2017 brettshollenberger
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,14 @@
1
+ 1) Download Events as CSV
2
+
3
+ ```bash
4
+ git clone git@github.com:brettshollenberger/badslava2csv.git
5
+ ./bin/badslava2csv "San Francisco"
6
+ ```
7
+
8
+ 2) Import Events to Google Calendar
9
+
10
+ * Open Google Calendar on a computer. Note: You can only import from a computer, not a phone or tablet.
11
+ * In the top right, click Settings Settings > Settings.
12
+ * Open the Calendars tab.
13
+ * Click Import calendars between the "My calendars" and "Other Calendars" sections.
14
+ * Click Choose File and select the file you exported. Upload the file from Step 1
@@ -0,0 +1,52 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'juwelier'
15
+ Juwelier::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
17
+ gem.name = "badslava_import"
18
+ gem.homepage = "http://github.com/brettshollenberger/badslava_import"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Import Badslava events to Google Calendar}
21
+ gem.description = %Q{Import Badslava events to Google Calendar}
22
+ gem.email = "brett.shollenberger@gmail.com"
23
+ gem.authors = ["brettshollenberger"]
24
+
25
+ # dependencies defined in Gemfile
26
+ end
27
+ Juwelier::RubygemsDotOrgTasks.new
28
+
29
+ require 'rake/testtask'
30
+ Rake::TestTask.new(:test) do |test|
31
+ test.libs << 'lib' << 'test'
32
+ test.pattern = 'test/**/test_*.rb'
33
+ test.verbose = true
34
+ end
35
+
36
+ desc "Code coverage detail"
37
+ task :simplecov do
38
+ ENV['COVERAGE'] = "true"
39
+ Rake::Task['test'].execute
40
+ end
41
+
42
+ task :default => :test
43
+
44
+ require 'rdoc/task'
45
+ Rake::RDocTask.new do |rdoc|
46
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
47
+
48
+ rdoc.rdoc_dir = 'rdoc'
49
+ rdoc.title = "badslava_import #{version}"
50
+ rdoc.rdoc_files.include('README*')
51
+ rdoc.rdoc_files.include('lib/**/*.rb')
52
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,61 @@
1
+ # Generated by juwelier
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+ # stub: badslava_import 0.0.1 ruby lib
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "badslava_import"
9
+ s.version = "0.0.1"
10
+
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
13
+ s.authors = ["brettshollenberger"]
14
+ s.date = "2017-01-14"
15
+ s.description = "Import Badslava events to Google Calendar"
16
+ s.email = "brett.shollenberger@gmail.com"
17
+ s.executables = ["badslava2csv"]
18
+ s.extra_rdoc_files = [
19
+ "LICENSE.txt",
20
+ "README.md"
21
+ ]
22
+ s.files = [
23
+ ".DS_Store",
24
+ ".document",
25
+ "Gemfile",
26
+ "Gemfile.lock",
27
+ "LICENSE.txt",
28
+ "README.md",
29
+ "Rakefile",
30
+ "VERSION",
31
+ "badslava_import.gemspec",
32
+ "bin/badslava2csv",
33
+ "data/google.csv"
34
+ ]
35
+ s.homepage = "http://github.com/brettshollenberger/badslava_import"
36
+ s.licenses = ["MIT"]
37
+ s.rubygems_version = "2.4.5.1"
38
+ s.summary = "Import Badslava events to Google Calendar"
39
+
40
+ if s.respond_to? :specification_version then
41
+ s.specification_version = 4
42
+
43
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
44
+ s.add_runtime_dependency(%q<nokogiri>, ["~> 1.6.8.1"])
45
+ s.add_development_dependency(%q<bundler>, ["~> 1.0"])
46
+ s.add_development_dependency(%q<juwelier>, ["~> 2.1.0"])
47
+ s.add_development_dependency(%q<pry>, [">= 0"])
48
+ else
49
+ s.add_dependency(%q<nokogiri>, ["~> 1.6.8.1"])
50
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
51
+ s.add_dependency(%q<juwelier>, ["~> 2.1.0"])
52
+ s.add_dependency(%q<pry>, [">= 0"])
53
+ end
54
+ else
55
+ s.add_dependency(%q<nokogiri>, ["~> 1.6.8.1"])
56
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
57
+ s.add_dependency(%q<juwelier>, ["~> 2.1.0"])
58
+ s.add_dependency(%q<pry>, [">= 0"])
59
+ end
60
+ end
61
+
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "pry"
4
+ require "nokogiri"
5
+ require "open-uri"
6
+ require "csv"
7
+ require "pathname"
8
+ require "rake"
9
+
10
+ city = ARGV[0] || "San Francisco"
11
+
12
+ puts "Listing events for #{city}"
13
+
14
+ url = "http://badslava.com/open-mics.php?city=#{URI.encode(city)}&state=CA&type=Comedy"
15
+ output_path = Pathname.new(File.expand_path("./data"))
16
+
17
+ FileUtils.mkdir_p(output_path)
18
+
19
+ doc = Nokogiri::HTML(open(url))
20
+
21
+ days = doc.css("#demo [color=red]").map { |day| day.children.text }.reject! { |x| x == "Monthly" }
22
+
23
+ days.reverse!
24
+
25
+ data = doc.css("table").map do |table|
26
+ headers = table.css("thead").css("tr").first.css("th").map do |table_header|
27
+ table_header.children.first.text.downcase.split(" ").join("_")
28
+ end
29
+
30
+ rows = table.css("tbody").map do |tbody|
31
+ tbody.css("td").map do |table_division|
32
+ table_division.children.text
33
+ end
34
+ end
35
+
36
+ row_hashes = rows.map do |row|
37
+ headers.zip(row).to_h
38
+ end
39
+
40
+ day = days.pop
41
+
42
+ row_hashes.map do |row|
43
+ start_time = row["time"].upcase.gsub(/(AM|PM)/) { |m| " #{m}" }
44
+ end_time = (Time.parse(start_time) + (3600 * 2)).strftime("%l:%M %p").strip
45
+ {
46
+ "Subject" => row["name"],
47
+ "Start Date" => day.split(" ").last,
48
+ "Start Time" => start_time,
49
+ "End Time" => end_time,
50
+ "All Day Event" => "False",
51
+ "Private" => "True",
52
+ "Description" => row["phone"],
53
+ "Location" => "#{row["venue"]} #{row["address"]}, #{row["city"]}, #{row["state"]}"
54
+ }
55
+ end
56
+ end
57
+
58
+ data.flatten!
59
+
60
+ filename = "google.csv"
61
+ path = output_path.join(filename)
62
+
63
+ CSV.open(path, "wb") do |csv|
64
+ csv << data.first.keys
65
+
66
+ data.map(&:values).each do |row|
67
+ csv << row
68
+ end
69
+ end
70
+
71
+ puts path
@@ -0,0 +1,19 @@
1
+ Subject,Start Date,Start Time,End Time,All Day Event,Private,Description,Location
2
+ Open Mic,01/14/17,6:00 PM,8:00 PM,False,True,(415) 431-6290,"Two Jacks Seafood 401 Haight St, San Francisco, CA"
3
+ Paradigm Rhymes,01/14/17,8:00 PM,10:00 PM,False,True,(424) 260-3650,"The Urban Center 732 Bryant St, San Francisco, CA"
4
+ Godfrey's Reality Check,01/14/17,8:00 PM,10:00 PM,False,True,(415) 751-0200,"Ray's Hearth 4701 Geary Blvd., San Francisco, CA"
5
+ Open Mic,01/16/17,7:00 PM,9:00 PM,False,True,(415) 861-3663,"BrainWash Cafe 1122 Folsom Street, San Francisco, CA"
6
+ Monday Happy Hour Comedy,01/16/17,7:00 PM,9:00 PM,False,True,(415) 441-4099,"Cafe Royale 800 Post St, San Francisco, CA"
7
+ Open Mic,01/16/17,7:30 PM,9:30 PM,False,True,(415) 546-6300,"Hotel Utah 500 Fourth Street, San Francisco, CA"
8
+ Open Mic,01/16/17,8:00 PM,10:00 PM,False,True,(415) 586-3733,"Bird And Beckett Books 653 Chenery, San Francisco, CA"
9
+ Open Mic,01/16/17,9:00 PM,11:00 PM,False,True,(415) 731-1208,"Portals Tavern 179 West Portal Avenue, San Francisco, CA"
10
+ Open Mic,01/17/17,8:00 PM,10:00 PM,False,True,(415) 861-3663,"BrainWash Cafe 1122 Folsom Street, San Francisco, CA"
11
+ Overnight Sensation,01/17/17,9:30 PM,11:30 PM,False,True,(415) 503-0684,"Showdown 10 6th St., San Francisco, CA"
12
+ Open Mic,01/17/17,10:00 PM,12:00 AM,False,True,(415) 674-1266,"La Roccas Corner 957 Columbus Ave, San Francisco, CA"
13
+ Open Mic,01/18/17,7:00 PM,9:00 PM,False,True,(415) 387-3859,"Sacred Grounds Cafe 2095 Hayes St., San Francisco, CA"
14
+ Free Feature Salon,01/18/17,7:00 PM,9:00 PM,False,True,(415) 387-6343,"Neck Of The Woods 406 Clement, San Francisco, CA"
15
+ Open Mike,01/19/17,7:00 PM,9:00 PM,False,True,(415) 831-5620,"Bazaar Cafe 5927 California St., San Francisco, CA"
16
+ Open Mic,01/19/17,7:00 PM,9:00 PM,False,True,(415) 397-3859,"Sacred Grounds Cafe 2059 Hayes St, San Francisco, CA"
17
+ Open Mic,01/19/17,8:00 PM,10:00 PM,False,True,(408) 258-1427,"Game On Sports 1631 North Capitol Avenue, San Francisco, CA"
18
+ Open Mic,01/20/17,6:00 PM,8:00 PM,False,True,(415) 296-7942,"Caffe Roma 526 Columbus Avenue , San Francisco, CA"
19
+ Open Mic,01/20/17,7:30 PM,9:30 PM,False,True,(415) 552-7390,"Cafe International 508 Haight St., San Francisco, CA"
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: badslava_import
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - brettshollenberger
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-01-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: nokogiri
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.6.8.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.6.8.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: juwelier
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 2.1.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 2.1.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
+ description: Import Badslava events to Google Calendar
70
+ email: brett.shollenberger@gmail.com
71
+ executables:
72
+ - badslava2csv
73
+ extensions: []
74
+ extra_rdoc_files:
75
+ - LICENSE.txt
76
+ - README.md
77
+ files:
78
+ - ".DS_Store"
79
+ - ".document"
80
+ - Gemfile
81
+ - Gemfile.lock
82
+ - LICENSE.txt
83
+ - README.md
84
+ - Rakefile
85
+ - VERSION
86
+ - badslava_import.gemspec
87
+ - bin/badslava2csv
88
+ - data/google.csv
89
+ homepage: http://github.com/brettshollenberger/badslava_import
90
+ licenses:
91
+ - MIT
92
+ metadata: {}
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 2.4.5.1
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: Import Badslava events to Google Calendar
113
+ test_files: []