bollywood 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ec954fa8a915b9e64522d11955b99a28903080f5
4
- data.tar.gz: 6d43e917d731eaa19fca6c77170edd6b4adbe275
2
+ SHA256:
3
+ metadata.gz: f439231ef9da9e5d9439e9b0cc73235e2d1e0a2e9d2d3e40140752923d35decd
4
+ data.tar.gz: 31908705a624919007eda6f42a082c5a82e3dbc2e876352d8d996ea6ddfdc53c
5
5
  SHA512:
6
- metadata.gz: 96f358a799d9ac15b66410cabd9250a7b01ddce11647e41d67b020e3fa7917728b35635a1f643ba1f87784326de02945339fce2d2638ef9d4a50ccba587c4943
7
- data.tar.gz: b60293f4b39ed407f533cc0e9bc89c50ed335e81540d11692357f30540881c49e1447e1ab7e0e27049bde6c1e8bdf0ad0557aa7abc55ba64aca522c6479b0e6c
6
+ metadata.gz: 35071967e4bc55fc9b74222ccf9c7b01244cc8152e1dc505f186fd8cc0d1dec4c2bc69eb76be9525dcc6b624f196561dfad40c7e04ba97bdeba97fc670d4d03f
7
+ data.tar.gz: 2c9ed15be784aa05f71bc232b78e3162be09ebe63b50ab4bc9a9c8fb95a7f3f6edecc50dae23ecce2a7b6187190a2a508aebc10b0de0f5aff4e11172fc15cca5
@@ -1,5 +1,5 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.2.1
5
- before_install: gem install bundler -v 1.12.3
4
+ - 2.7.0
5
+ before_install: gem install bundler -v 2.1.2
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2016 karuna24s
3
+ Copyright (c) 2020 karuna24s
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/NOTES.md CHANGED
@@ -9,16 +9,16 @@ Steps to Create A CLI GEM - Bollywood
9
9
  7. Discover objects
10
10
  8. Program
11
11
 
12
- - A command line interface for checking out more information about Bollywood movies such as the cast, release dates and synopsis.
13
-
14
- user types bollywood
15
-
16
- CLL welcomes the user and provides a list of Upcoming Movie Releases for the user:
17
-
18
- User will receive a prompt asking -> Which movie would you like to learn more about?
19
-
20
- User selects the number
21
-
22
- Then the name of the movie, cast, and release date should appear. Some movies may have a synopsis and if it doesn't have a synposis. Then we a prompt will let the user know that there is no synopsis.
23
-
24
- User will receive an option, to review the list, or exit.
12
+ Mission -> A command line interface for checking out more information about Bollywood movies
13
+ such as the cast, release dates and synopsis.
14
+
15
+ What should Bollywood CLI do:
16
+
17
+ 1. User runs the gem.
18
+ 2. CLI welcomes the user and provides a list of Upcoming Movie Releases for the user:
19
+ 3. User will receive a prompt asking -> Which movie would you like to learn more about?
20
+ 4. User selects the number
21
+ 5. Then the name of the movie, cast, and release date should appear.
22
+ 6. Some movies may have a synopsis and if it doesn't have a synposis.
23
+ Then we have a prompt will let the user know that there is no synopsis.
24
+ 7. User will receive an option, to review the list, or exit.
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Bollywood
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/bollywood`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ Welcome to my Bollywood CLI gem! This gem will scrape a list of Upcoming Movies from Bollywoodmdb and you will be able to choose the movie learn more about that particular film including cast, release-date and synopsis. I built this gem as a project for the Flatiron School's Learn Verified Full Stack Web Development online program and I hope you enjoy it!
6
4
 
7
5
  ## Installation
8
6
 
@@ -38,4 +36,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERN
38
36
  ## License
39
37
 
40
38
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
-
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # require "bundler/setup"
3
3
  # require "bollywood"
4
- require "./lib/bollywood"
4
+ require_relative "../lib/bollywood"
5
5
 
6
6
  #binding.pry
7
- CLI.new.call
7
+ Bollywood::CLI.new.call
Binary file
@@ -27,9 +27,9 @@ Gem::Specification.new do |spec|
27
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ["lib"]
29
29
 
30
- spec.add_development_dependency "bundler", "~> 1.12"
31
- spec.add_development_dependency "rake", "~> 10.0"
32
- spec.add_development_dependency "rspec", "~> 3.0"
30
+ spec.add_development_dependency "bundler"
31
+ spec.add_development_dependency "rake", "~> 10.5.0"
32
+ spec.add_development_dependency "rspec", "~> 3.9.0"
33
33
  spec.add_development_dependency "pry"
34
34
  spec.add_dependency "nokogiri"
35
35
  end
@@ -6,3 +6,4 @@ require "pry"
6
6
  require_relative "./bollywood/version"
7
7
  require_relative "./bollywood/cli"
8
8
  require_relative "./bollywood/movie"
9
+ require_relative "./bollywood/scraper"
@@ -1,5 +1,4 @@
1
- class CLI
2
-
1
+ class Bollywood::CLI
3
2
  def call
4
3
  welcome
5
4
  list_movies
@@ -9,13 +8,13 @@ class CLI
9
8
 
10
9
  def welcome
11
10
  puts ""
12
- puts "************* Welcome to the Bollywood CLI Gem Where You Can Learn About the Upcoming Movies! *************"
11
+ puts "********** Welcome to the Bollywood CLI Gem Where You Can Learn About the Upcoming Movies! **********"
13
12
  puts ""
14
13
  end
15
14
 
16
15
  def list_movies
17
- Movie.scrape_data
18
- Movie.all.each.with_index(1) do |movie, i|
16
+ Bollywood::Scraper.scrape_data
17
+ Bollywood::Movie.all.each.with_index(1) do |movie, i|
19
18
  if i <= 20
20
19
  puts "#{i}. #{movie.name}"
21
20
  end
@@ -42,7 +41,7 @@ class CLI
42
41
  puts "Type menu to see the list of movies again, or type exit to end the program."
43
42
  input = gets.strip.downcase
44
43
  if input.to_i > 0
45
- if movie = Movie.find(input.to_i)
44
+ if movie = Bollywood::Movie.find(input.to_i)
46
45
  print_movie(movie)
47
46
  end
48
47
  elsif input == "menu"
@@ -56,5 +55,4 @@ class CLI
56
55
  def phir_milenge
57
56
  puts "Phir Milenge -> See You Soon!"
58
57
  end
59
-
60
58
  end
@@ -1,4 +1,4 @@
1
- class Movie
1
+ class Bollywood::Movie
2
2
  attr_accessor :name, :cast, :release_date, :synopsis
3
3
 
4
4
  @@all = []
@@ -17,35 +17,6 @@ class Movie
17
17
  self.all[id-1]
18
18
  end
19
19
 
20
- def self.scrape_data
21
- doc = Nokogiri::HTML(open('http://www.bollywoodmdb.com/movies/'))
22
- # Remove google ads from doc
23
- doc.css(".mob_a").remove
24
- doc.css("div.row.move-data.spacer").each do |m|
25
- movie = Movie.new
26
- movie.name = m.css("a.movie-link").first.text
27
- # Prevent the name of the movie from being repeated twice.
28
- #movie.name.slice!((movie.name.length/2)..movie.name.length)
29
- # Created an array to iterate the cast members of a movie correctly with a
30
- # space between each name.
31
- casts = []
32
- m.css("a.aheight").each do |c|
33
- casts << c.text
34
- end
35
- movie.cast = casts
36
- # Created an array to iterate the release date and synopsis of a movie
37
- # correctly since the css attribute which I scraped from the website from was the
38
- # same for both release date and synopsis.
39
- movie_date_synopsis = []
40
- m.css("div.spacer.hidden-xs").each do |d|
41
- movie_date_synopsis << d.text
42
- end
43
- movie.release_date = movie_date_synopsis[0]
44
- movie.synopsis = movie_date_synopsis[1]
45
- if movie.synopsis == nil
46
- movie.synopsis = "There is no synopsis available!"
47
- end
48
- end
49
- end
20
+
50
21
 
51
22
  end
@@ -0,0 +1,30 @@
1
+ class Bollywood::Scraper
2
+
3
+ def self.scrape_data
4
+ doc = Nokogiri::HTML(open('http://www.bollywoodmdb.com/movies/'))
5
+ # Remove google ads from doc
6
+ doc.css(".mob_a").remove
7
+ doc.css("div.row.move-data.spacer").each do |m|
8
+ movie = Bollywood::Movie.new
9
+ # Prevent the name of the movie from being repeated twice.
10
+ #movie.name.slice!((movie.name.length/2)..movie.name.length)
11
+ movie.name = m.css("a.movie-link").first.text
12
+ # Created an array to iterate the cast members of a movie correctly with a
13
+ # space between each name.
14
+ movie.cast = m.css("a.aheight").collect {|c| c.text }
15
+ # Created an array to iterate the release date and synopsis of a movie
16
+ # correctly since the css attribute which I scraped from the website from was the
17
+ # same for both release date and synopsis.
18
+ movie_date_synopsis = []
19
+ m.css("div.spacer.hidden-xs").each do |d|
20
+ movie_date_synopsis << d.text
21
+ end
22
+ movie.release_date = movie_date_synopsis[0]
23
+ movie.synopsis = movie_date_synopsis[1]
24
+ if movie.synopsis == nil
25
+ movie.synopsis = "There is no synopsis available!"
26
+ end
27
+ end
28
+ end
29
+
30
+ end
@@ -1,3 +1,3 @@
1
1
  module Bollywood
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bollywood
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - karuna24s
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-12 00:00:00.000000000 Z
11
+ date: 2020-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.12'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.12'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: 10.5.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: 10.5.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '3.0'
47
+ version: 3.9.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '3.0'
54
+ version: 3.9.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pry
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -99,10 +99,12 @@ files:
99
99
  - bin/bollywood
100
100
  - bin/console
101
101
  - bin/setup
102
+ - bollywood-0.1.0.gem
102
103
  - bollywood.gemspec
103
104
  - lib/bollywood.rb
104
105
  - lib/bollywood/cli.rb
105
106
  - lib/bollywood/movie.rb
107
+ - lib/bollywood/scraper.rb
106
108
  - lib/bollywood/version.rb
107
109
  homepage: https://github.com/karuna24s/bollywood
108
110
  licenses:
@@ -123,8 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
125
  - !ruby/object:Gem::Version
124
126
  version: '0'
125
127
  requirements: []
126
- rubyforge_project:
127
- rubygems_version: 2.4.8
128
+ rubygems_version: 3.1.2
128
129
  signing_key:
129
130
  specification_version: 4
130
131
  summary: A CLI gem providing information about Bollywood movies.