bnm 0.2.8 → 0.2.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 72b5d2b5bc2143cfb1c1c982707e07b4b61948b7
4
- data.tar.gz: 87cd9abb4593de64c1c6f2ad4200efe3d3f65c58
3
+ metadata.gz: aad71a33847f52ca3fe6bca022180803b35cbc30
4
+ data.tar.gz: 3048b15e7fa95e04454bbdd41b86ce0fddfdf424
5
5
  SHA512:
6
- metadata.gz: 5451b241c4fe29b722f7764cc253e3f281839809bfb230101f597fb76122f1183f98716e381dab8fcfcedccd979bf1e193d66153e2d176506d0fa7f6363fdfd1
7
- data.tar.gz: e30c1fd216f21cb481b3209544583f677d2c8a332ad47e5ba132b14d822107c370fdea83840ebfc2f9ebb3315ea976f7ebdbe79c0a6b64cde42a78ade1d9ceaf
6
+ metadata.gz: e37cc065a1f1c0e46ac457d42d1ad92e23a41f5069e3a36d249a34a81a05518deb57963555c49514201bb198a0d39ae00a783d757ab056add72db161650e3c6d
7
+ data.tar.gz: ddd3492ae044fca5c937c8bb3acf289425ba2423e01094570276d9df8ab7f5635ec90e4bbd69b9535b0920908030c81730a0b85c6655f893a237bb91c780b075
data/lib/bnm.rb CHANGED
@@ -3,3 +3,4 @@ require_relative "bnm/cli"
3
3
  require_relative "bnm/api"
4
4
  require_relative "bnm/init"
5
5
  require_relative "bnm/scrape"
6
+ require_relative "bnm/spinner"
@@ -1,22 +1,23 @@
1
+ require 'colorize'
2
+
1
3
  module Bnm::CLI
2
4
  ############## INIT. INTERFACE #############################
3
5
  def self.launch(artists)
4
- puts "---------------------------------------------------------------"
6
+ puts "---------------------------------------------------------------".yellow
5
7
  puts " WELCOME TO PITCHFORK'S 'BEST NEW MUSIC' SORTED BY SCORE. "
6
8
  puts " SELECT AN ARTIST BY NUMBER. NOW WITH APPLE MUSIC "
7
9
  puts " OR PRESS ANY LETTER TO EXIT "
8
- puts "---------------------------------------------------------------"
10
+ puts "---------------------------------------------------------------".yellow
9
11
  display_artist(artists)
10
12
 
11
13
  input = Integer(gets.chomp) rescue nil
12
14
 
13
- # input = gets.chomp.to_i
14
- # index = input - 1
15
-
16
15
  if input == nil
17
16
  exit
18
17
  elsif input < 1 || input > 24
19
- puts 'THAT IS NOT A VALID CHOICE! PLEASE CHOOSE AGAIN'
18
+ puts '###############################################'.yellow
19
+ puts 'THAT IS NOT A VALID CHOICE, PLEASE CHOOSE AGAIN'.red
20
+ puts '###############################################'.yellow
20
21
  launch(artists)
21
22
  else
22
23
  index = input - 1
@@ -28,21 +29,28 @@ module Bnm::CLI
28
29
  def self.display_artist(artists)
29
30
  counter = 1
30
31
  artists.each do |i|
31
- display = " #{i[:score]} #{i[:name]}, #{i[:album]}"
32
- printf("%2d. %5s\n", counter, display)
32
+ display = Array.new
33
+ display.push(" #{i[:score]}".red)
34
+ display.push(" #{i[:name]}".yellow)
35
+ display.push(" #{i[:album]}".green)
36
+ printf("%2d. %5s\n", counter, display.join(''))
33
37
  counter += 1
34
38
  end
35
- puts "-----------------------------------------------"
36
- puts 'Please chose an artist by typing the number'
37
- puts "-----------------------------------------------"
39
+ puts "--------------------------------".yellow
40
+ puts 'Please chose an artist by number'
41
+ puts "--------------------------------".yellow
38
42
  end
39
43
 
40
44
  #################DISPLAYS ARTIST PAGE####################
41
45
  def self.artist_page(input, index, artists)
42
46
  url = artists[index][:listen]
47
+ artist = Array.new
48
+ artist.push(" #{artists[index][:score]}".red)
49
+ artist.push(" #{artists[index][:name]}".yellow)
50
+ artist.push(" #{artists[index][:album]}".green)
43
51
 
44
- puts("ARTIST: #{artists[index][:name]} ALBUM: #{artists[index][:album]} SCORE: #{artists[index][:score]}")
45
- puts "---------------------------------------------------------------------"
52
+ puts artist.join('')
53
+ puts "--------------------------------------------------------".yellow
46
54
  puts "1 for Apple Music"
47
55
  puts "2 for article"
48
56
  puts "3 for Amoeba Music"
@@ -52,25 +60,25 @@ module Bnm::CLI
52
60
 
53
61
  if input == '1' && !artists[index][:itunes].nil?
54
62
  system('open', artists[index][:itunes])
55
- puts '########################################################'
63
+ puts '########################################################'.yellow
56
64
  artist_page(input, index, artists)
57
65
  elsif input == '1' && artists[index][:itunes].nil?
58
- puts '########################################################'
59
- puts 'There is no link available. Please choose another option'
60
- puts '########################################################'
66
+ puts '########################################################'.yellow
67
+ puts 'There is no link available. Please choose another option'.red
68
+ puts '########################################################'.yellow
61
69
  artist_page(input, index, artists)
62
70
  elsif input == '2'
63
71
  puts "#{artists[index][:editorial]}"
64
- puts '########################################################'
72
+ puts '########################################################'.yellow
65
73
  artist_page(input, index, artists)
66
74
  elsif input == '3' && !url.nil?
67
75
  system('open', url)
68
- puts '########################################################'
76
+ puts '########################################################'.yellow
69
77
  artist_page(input, index, artists)
70
78
  elsif input == '3' && url.nil?
71
- puts '########################################################'
72
- puts 'There is no link available. Please choose another option'
73
- puts '########################################################'
79
+ puts '########################################################'.yellow
80
+ puts 'There is no link available. Please choose another option'.red
81
+ puts '########################################################'.yellow
74
82
  artist_page(input, index, artists)
75
83
  elsif input == '4'
76
84
  launch(artists)
@@ -1,3 +1,5 @@
1
+ require 'thread'
2
+
1
3
  class Bnm::Init
2
4
  attr_accessor :artists
3
5
  @@url = "http://pitchfork.com/reviews/best/albums/"
@@ -6,11 +8,25 @@ class Bnm::Init
6
8
  @artists = Array.new
7
9
  end
8
10
 
9
- ################FIRST METHOD TO RUN######################
10
11
  def call
12
+
13
+ # INITIATES SPINNER
14
+ thr = Thread.new do
15
+ while true
16
+ Bnm::Spinner.loading
17
+ end
18
+ end
19
+
20
+ # SCRAPING URIS AND ARTISTS
11
21
  @artists = Bnm::Scrape.init_scrape(@@url)
12
22
  Bnm::Scrape.deep_scrape(@artists)
13
23
  Bnm::API.itunes(@artists)
24
+
25
+ # KILLS SPINNER AND CLEARS FROM SCREEN
26
+ Thread.kill(thr)
27
+ print "\r"
28
+
29
+ # PRINTS OUT DYNAMIC CLI
14
30
  Bnm::CLI.launch(@artists)
15
31
  end
16
32
  end
@@ -0,0 +1,11 @@
1
+ require 'colorize'
2
+
3
+ module Bnm::Spinner
4
+ ASCII = ['⣾', '⣽', '⣻', '⢿', '⡿', '⣟', '⣯', '⣷']
5
+ def self.loading
6
+ ASCII.each do |ascii|
7
+ print "\rLoading artists... #{ascii} ".yellow
8
+ sleep 0.2
9
+ end
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module Bnm
2
- VERSION = "0.2.8"
2
+ VERSION = "0.2.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bnm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - fiveinfinity
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-12 00:00:00.000000000 Z
11
+ date: 2016-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: colorize
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rspec
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -178,6 +192,20 @@ dependencies:
178
192
  - - ">="
179
193
  - !ruby/object:Gem::Version
180
194
  version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: colorize
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :runtime
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
181
209
  description:
182
210
  email:
183
211
  - jlachance1@gmail.com
@@ -192,6 +220,7 @@ files:
192
220
  - lib/bnm/cli.rb
193
221
  - lib/bnm/init.rb
194
222
  - lib/bnm/scrape.rb
223
+ - lib/bnm/spinner.rb
195
224
  - lib/bnm/version.rb
196
225
  homepage: https://github.com/fiveinfinity/bnm-cli-gem.git
197
226
  licenses: