atx_live_music 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b4a7d7c3d607d27c754bb044aa61a1795e84727a
4
+ data.tar.gz: 0c583ac57af03d5d9b7585414b44504a08b0f487
5
+ SHA512:
6
+ metadata.gz: a4824904e93146bfb21db4b6547d667c38467d7059f9045d480485c3eab2f400066d3fbe673268dac16db344d37b277d7b13359d849e9c7a397958f6c493ff07
7
+ data.tar.gz: e831aad8302ed8fa300dcbe60fee41bf556354962468a17aaa0fdaadb4dd86a8b66fe6dc7cba2227b3e63ce834af85efc667cb33f9e10942a899b15047d55535
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ .DS_Store
2
+ /.bundle/
3
+ /.yardoc
4
+ /Gemfile.lock
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in atx_live_music.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 wedesignstudios
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/NOTES.md ADDED
@@ -0,0 +1,51 @@
1
+ #ATX-Live-Music Gem
2
+ https://github.com/wedesignstudios/atx-live-music
3
+
4
+ A CLI that lists all live music events in Austin, TX by date. Content is scraped from Austin Chronicle website (http://www.austinchronicle.com/calendar/music/)
5
+
6
+ ##User types a command to start gem
7
+
8
+ atx-live-music
9
+
10
+ ##User is presented with a week's worth of days:
11
+
12
+ 1. Today
13
+ 2. June 2
14
+ 3. June 3
15
+ 4. June 4
16
+ 5. June 5
17
+ 6. June 6
18
+ 7. June 7
19
+
20
+ ##User is asked which day they would like to see details on live music events:
21
+
22
+ Select the date you want to rock on: (1 - 7)
23
+
24
+ ##User is shown the live music listings for that date.
25
+
26
+ Austin Live Music for `Date`
27
+
28
+ Performer(s):
29
+ Time:
30
+ Venue:
31
+ Location:
32
+
33
+ ##User is asked if they want to choose another date:
34
+
35
+ Want to check out shows on a different night? (Y or N)
36
+
37
+ If Y -> display week list again.
38
+ If N -> exit
39
+
40
+ To get the listings for each day I need a different URL
41
+ - Separate method for each day?
42
+ - How can I populate URL with the right date to retrieve the correct show listings?
43
+
44
+ Should it be a ShowDate class?
45
+ - The class instances are the individual dates
46
+ - i.e. day1 = ShowDate.new
47
+
48
+
49
+ show_today_array = [
50
+ {:performer => "Beemer Weems", :time => "9:00pm", :venue => "Buzz Mill", :location => "123 Main St."}, {:performer => "Beemer Weems", :time => "9:00pm", :venue => "Buzz Mill", :location => "123 Main St."}, {:performer => "Beemer Weems", :time => "9:00pm", :venue => "Buzz Mill", :location => "123 Main St."}
51
+ ]
data/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # ATXLiveMusic
2
+
3
+ A CLI that lists live music events in Austin, TX for the next seven days. Content is scraped from Austin Chronicle website (http://www.austinchronicle.com/calendar/music/)
4
+
5
+ ## Installation
6
+
7
+ $ gem install atx_live_music
8
+
9
+ ## Usage
10
+
11
+ Type the below and follow the on screen prompts.
12
+
13
+ $ atx-live-music
14
+
15
+ ## Development
16
+
17
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
18
+
19
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
20
+
21
+ ## Contributing
22
+
23
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/atx_live_music.
24
+
25
+
26
+ ## License
27
+
28
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'atx_live_music/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "atx_live_music"
8
+ spec.version = AtxLiveMusic::VERSION
9
+ spec.authors = ["wedesignstudios"]
10
+ spec.email = ["deelden@gmail.com"]
11
+ spec.date = '2016-06-03'
12
+ spec.summary = "Live Music in Austin, Texas"
13
+ spec.description = "Displays live music listings in Austin, Texas."
14
+ spec.homepage = "https://github.com/wedesignstudios/atx-live-music"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ #spec.bindir = "exe"
19
+ #spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.executables = ["atx-live-music"]
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.11"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "pry", "~> 0.10.0"
26
+
27
+ spec.add_dependency "nokogiri", "~> 1.6"
28
+ end
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ require "bundler/setup"
3
+ require "atx_live_music"
4
+
5
+ AtxLiveMusic::CLI.new.call
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "atx_live_music"
5
+ require "nokogiri"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ require "pry"
12
+ #Pry.start
13
+
14
+ require "irb"
15
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,67 @@
1
+ class AtxLiveMusic::CLI
2
+
3
+ def call
4
+ puts "Please wait while the roadies load in the shows...\n"
5
+ AtxLiveMusic::Shows.create_shows
6
+ list_dates
7
+ cta
8
+ end
9
+
10
+ def list_dates
11
+ puts "\n***** ATX Live Music *****\n\n"
12
+ AtxLiveMusic::Shows.string_days.each_with_index do |day, i|
13
+ i == 0 ? (puts "#{i+1}. Today") : (puts "#{i+1}. #{day}")
14
+ end
15
+ end
16
+
17
+ def cta
18
+ puts "\nSelect the date you want to rock on: [1 - 7 or 'exit']\n\n"
19
+ input = gets.strip
20
+
21
+ if input.to_i > 0
22
+ i = input.to_i
23
+ i == 1 ? (puts "\nToday\n#{divider}") : (puts "\n#{AtxLiveMusic::Shows.string_days[i-1]}\n#{divider}")
24
+ display_listings(AtxLiveMusic::Shows.all[i-1].listings)
25
+ another_date?
26
+ elsif input == "exit"
27
+ exit
28
+ else
29
+ puts "Which date did you want?"
30
+ cta
31
+ end
32
+
33
+ end
34
+
35
+ def display_listings(listings_arr)
36
+ listings_arr.each do |listing|
37
+ listing.each do |key, value|
38
+ key.to_s == "location" ? (puts "#{key.upcase}: #{value} \n\n") : (puts "#{key.upcase}: #{value}")
39
+ end
40
+ end
41
+ end
42
+
43
+ def divider
44
+ "=========================="
45
+ end
46
+
47
+ def another_date?
48
+ puts "\nWant to check out another date's listings? [Y or N]"
49
+ input = gets.strip.upcase
50
+ case input
51
+ when "Y"
52
+ list_dates
53
+ cta
54
+ when "N"
55
+ exit
56
+ else
57
+ puts "Huh?\n"
58
+ another_date?
59
+ end
60
+ end
61
+
62
+ def exit
63
+ puts "\nEnjoy the music! And remember...Keep Austin Weird."
64
+ puts "**************************************************\n\n"
65
+ end
66
+
67
+ end
@@ -0,0 +1,77 @@
1
+ class AtxLiveMusic::Shows
2
+
3
+ attr_accessor :listings
4
+ attr_reader :date
5
+
6
+ URL = "http://www.austinchronicle.com/calendar/music/"
7
+ @@all = []
8
+
9
+ def initialize(date="")
10
+ @date = date
11
+ @listings = []
12
+ @@all << self
13
+ end
14
+
15
+ def self.all
16
+ @@all
17
+ end
18
+
19
+ def self.get_days
20
+ @days = []
21
+ i = 0
22
+ @days << Time::now
23
+ while i < 6
24
+ day = @days.last + 86400
25
+ @days << day
26
+ i += 1
27
+ end
28
+ @days
29
+ end
30
+
31
+ def self.string_days
32
+ string_days = []
33
+ get_days.each {|day| string_days << day.strftime("%B%e")}
34
+ string_days
35
+ end
36
+
37
+ def self.num_days
38
+ num_days = []
39
+ get_days.each {|day| num_days << day.strftime("%Y-%m-%d")}
40
+ num_days
41
+ end
42
+
43
+ def self.create_shows
44
+ AtxLiveMusic::Shows.num_days.each do |day|
45
+ shows = AtxLiveMusic::Shows.new(day)
46
+ shows.create_listings
47
+ end
48
+ end
49
+
50
+ def create_listings
51
+
52
+ arr = self.doc.css("#AllListings")
53
+ arr.each do |listing|
54
+ i = 0
55
+ while i < listing.css("h2").count
56
+ event = {}
57
+ event[:show] = listing.css("h2 a")[i].text
58
+ event[:venue] = listing.css("h3 a")[i].text
59
+ event[:location] = listing.css("h3 span")[i].text
60
+ @listings << event
61
+ i += 1
62
+ end
63
+
64
+ end
65
+ end
66
+
67
+ def doc
68
+ @doc = Nokogiri::HTML(open(URL+self.date))
69
+ end
70
+
71
+ end
72
+
73
+
74
+
75
+
76
+
77
+
@@ -0,0 +1,3 @@
1
+ module AtxLiveMusic
2
+ VERSION = "0.1.1"
3
+ end
@@ -0,0 +1,6 @@
1
+ require "open-uri"
2
+ require "nokogiri"
3
+
4
+ require_relative "./atx_live_music/version"
5
+ require_relative "./atx_live_music/cli"
6
+ require_relative "./atx_live_music/shows"
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: atx_live_music
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - wedesignstudios
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-06-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.11'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.11'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.10.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.10.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: nokogiri
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.6'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.6'
69
+ description: Displays live music listings in Austin, Texas.
70
+ email:
71
+ - deelden@gmail.com
72
+ executables:
73
+ - atx-live-music
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - NOTES.md
81
+ - README.md
82
+ - Rakefile
83
+ - atx_live_music.gemspec
84
+ - bin/atx-live-music
85
+ - bin/console
86
+ - bin/setup
87
+ - lib/atx_live_music.rb
88
+ - lib/atx_live_music/cli.rb
89
+ - lib/atx_live_music/shows.rb
90
+ - lib/atx_live_music/version.rb
91
+ homepage: https://github.com/wedesignstudios/atx-live-music
92
+ licenses:
93
+ - MIT
94
+ metadata: {}
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ requirements: []
110
+ rubyforge_project:
111
+ rubygems_version: 2.4.5.1
112
+ signing_key:
113
+ specification_version: 4
114
+ summary: Live Music in Austin, Texas
115
+ test_files: []