the_boards 0.1.0

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b80e0eeb544e6b0f9e481ef7b201e137c2a8b22f
4
+ data.tar.gz: 8c6e6721f9a67fbdd34915580a0917952258194b
5
+ SHA512:
6
+ metadata.gz: e0b5caf8904d0f586bfe182e2353fca43abf34b66c9032e6d154928455a9c3a6391dee46a1c74a2320cb08d9a198c9d3671354d759bb668021d6a09022cdc4d8
7
+ data.tar.gz: 98103383ae5a3ab92d606e5be4c7174d140fc45184b04274eb99f2b873e6c22940e6b40c2c5cf964fbc1f766754cfb07cf7c4e7035e4f02c451daface250bd99
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in hot_songs.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 ThisIsTyDell
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,27 @@
1
+ Billboard CLI
2
+
3
+ - A command line interface for the Billboard charts, starting with list of genres
4
+
5
+ user types in hot-songs
6
+
7
+ Show a list of genres
8
+
9
+ 1. Pop
10
+ 2. HipHop
11
+ 3. Country
12
+ 4. EDM
13
+ ...
14
+
15
+ Which genre do you want to see the hottest songs?
16
+
17
+ 1
18
+ 2
19
+ 3
20
+
21
+ What is a song?
22
+
23
+ A song has a name
24
+ A song has an artist
25
+ A song has a genre
26
+ A song has a rank
27
+ A song has a URL
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # TheBoards
2
+
3
+ This is TheBoards. The Ruby Cli Gem that pulls in the top songs of the US Billboard charts.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'the_boards'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install the_boards
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Development
26
+
27
+ 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.
28
+
29
+ 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).
30
+
31
+ ## Contributing
32
+
33
+ Bug reports and pull requests are welcome on GitHub at https://github.com/thisistydell/the-boards-cli-gem.
34
+
35
+
36
+ ## License
37
+
38
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
39
+
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "the-boards"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ require "irb"
10
+ 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
data/bin/the-boards ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/the_boards'
4
+
5
+ TheBoards::CLI.new.call
@@ -0,0 +1,40 @@
1
+ class TheBoards::CLI
2
+
3
+ def call
4
+ list_songs
5
+ menu
6
+ goodbye
7
+ end
8
+
9
+ def list_songs
10
+ puts "Today's Hottest Songs:"
11
+ @songs = TheBoards::Songs.today
12
+ @songs.each.with_index(1) do |genre, i|
13
+ puts "#{i}. #{genre.name}"
14
+ end
15
+
16
+ end
17
+
18
+ def menu
19
+ input = nil
20
+ while input != "exit"
21
+ puts "Enter the number of the song you'd like to see or type list to see the list again or type exit:"
22
+ input = gets.strip.downcase
23
+
24
+ if input.to_i > 0
25
+ the_song = @songs[input.to_i-1]
26
+ puts "'#{the_song.name}' by #{the_song.artist} is currently ##{the_song.rank} on the charts."
27
+ puts "#{the_song.prev_rank}"
28
+ elsif input == "list"
29
+ list_songs
30
+ else
31
+ puts "Not sure what you want, type list or exit."
32
+ end
33
+ end
34
+ end
35
+
36
+ def goodbye
37
+ puts "See you next week for more songs!!!"
38
+ end
39
+
40
+ end
@@ -0,0 +1,21 @@
1
+ class TheBoards::Songs
2
+ attr_accessor :name, :artist, :rank, :prev_rank
3
+ def self.today
4
+ # Scrape Billboard and then return list of songs based on that data
5
+ self.scrape_billboard
6
+ end
7
+
8
+ def self.scrape_billboard
9
+ songs = []
10
+ doc = Nokogiri::HTML(open("http://www.billboard.com/charts/hot-100"))
11
+ doc.css("div.chart-row__main-display").collect do |title|
12
+ song = self.new
13
+ song.name = title.css("h2").text
14
+ song.artist = title.css("a.chart-row__artist").text.strip
15
+ song.rank = title.css("span.chart-row__current-week").text.strip
16
+ song.prev_rank = title.css("span.chart-row__last-week").text.strip
17
+ songs << song
18
+ end
19
+ songs
20
+ end
21
+ end
@@ -0,0 +1,3 @@
1
+ module TheBoards
2
+ VERSION = "0.1.0"
3
+ end
data/lib/the_boards.rb ADDED
@@ -0,0 +1,7 @@
1
+ require "open-uri"
2
+ require "nokogiri"
3
+ require "pry"
4
+
5
+ require_relative "./the_boards/version"
6
+ require_relative "./the_boards/songs"
7
+ require_relative './the_boards/cli'
@@ -0,0 +1,33 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'the_boards/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "the_boards"
8
+ spec.version = TheBoards::VERSION
9
+ spec.authors = ["ThisIsTyDell"]
10
+ spec.email = ["milleb94@gmail.com"]
11
+ spec.executables = ["the-boards"]
12
+ spec.summary = "The Hottest Songs of This Week"
13
+ spec.description = "A simple gem that pulls the hottest songs from the Billboard Charts Hot 100"
14
+ spec.homepage = "https://github.com/ThisIsTyDell/the-boards-cli-gem"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
+ # delete this section to allow pushing this gem to any host.
19
+ #if spec.respond_to?(:metadata)
20
+ # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
21
+ #else
22
+ # raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
+ #end
24
+
25
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ spec.require_paths = ["lib", "lib/the_boards"]
27
+
28
+ spec.add_development_dependency "bundler", "~> 1.11"
29
+ spec.add_development_dependency "rake", "~> 10.0"
30
+ spec.add_development_dependency "pry"
31
+
32
+ spec.add_dependency "nokogiri"
33
+ end
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: the_boards
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - ThisIsTyDell
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-08-02 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'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '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: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: A simple gem that pulls the hottest songs from the Billboard Charts Hot
70
+ 100
71
+ email:
72
+ - milleb94@gmail.com
73
+ executables:
74
+ - the-boards
75
+ extensions: []
76
+ extra_rdoc_files: []
77
+ files:
78
+ - ".gitignore"
79
+ - Gemfile
80
+ - LICENSE.txt
81
+ - NOTES.md
82
+ - README.md
83
+ - Rakefile
84
+ - bin/console
85
+ - bin/setup
86
+ - bin/the-boards
87
+ - lib/the_boards.rb
88
+ - lib/the_boards/cli.rb
89
+ - lib/the_boards/songs.rb
90
+ - lib/the_boards/version.rb
91
+ - the_boards.gemspec
92
+ homepage: https://github.com/ThisIsTyDell/the-boards-cli-gem
93
+ licenses:
94
+ - MIT
95
+ metadata: {}
96
+ post_install_message:
97
+ rdoc_options: []
98
+ require_paths:
99
+ - lib
100
+ - lib/the_boards
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ requirements: []
112
+ rubyforge_project:
113
+ rubygems_version: 2.4.5.1
114
+ signing_key:
115
+ specification_version: 4
116
+ summary: The Hottest Songs of This Week
117
+ test_files: []