world_top_movies 0.1.6

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
+ SHA256:
3
+ metadata.gz: 6acaf18fabd99c1e82553107902839f6f3d8422d2c2797ae63f22b53d4d29e46
4
+ data.tar.gz: cabc6def3405cb02be53feb7d7b9f9305b1b057e5ae7769f6362e45fee2b3e86
5
+ SHA512:
6
+ metadata.gz: 324dab73241c863522159b149f88fddca5851de6b8e66871390be7e1d9b1aec7d12d4e7cb9ee4861f3d1bf90cfd287166b458a49906247458222bdfb98218b91
7
+ data.tar.gz: aed4277efe37930b4deb9292fd5e700f8d26fc2de037712f6dc5984b410b519acd4f9204d8dc2f7ee89a331dfcc952b0e1809be8b7a2ee4aa490ed83985d31cd
data/.DS_Store ADDED
Binary file
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2021-09-27
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at haroldtm55@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in world_top_movies.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
11
+
12
+ gem "rubocop", "~> 1.7"
data/Gemfile.lock ADDED
@@ -0,0 +1,123 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ world_top_movies (0.1.6)
5
+ activerecord (~> 5.2)
6
+ artii
7
+ colorize (~> 0.8.1)
8
+ httparty
9
+ nokogiri
10
+ sinatra-activerecord
11
+ sqlite3
12
+ tty-prompt
13
+
14
+ GEM
15
+ remote: https://rubygems.org/
16
+ specs:
17
+ activemodel (5.2.6)
18
+ activesupport (= 5.2.6)
19
+ activerecord (5.2.6)
20
+ activemodel (= 5.2.6)
21
+ activesupport (= 5.2.6)
22
+ arel (>= 9.0)
23
+ activesupport (5.2.6)
24
+ concurrent-ruby (~> 1.0, >= 1.0.2)
25
+ i18n (>= 0.7, < 2)
26
+ minitest (~> 5.1)
27
+ tzinfo (~> 1.1)
28
+ arel (9.0.0)
29
+ artii (2.1.2)
30
+ ast (2.4.2)
31
+ colorize (0.8.1)
32
+ concurrent-ruby (1.1.9)
33
+ diff-lcs (1.4.4)
34
+ httparty (0.19.0)
35
+ mime-types (~> 3.0)
36
+ multi_xml (>= 0.5.2)
37
+ i18n (1.8.10)
38
+ concurrent-ruby (~> 1.0)
39
+ mime-types (3.3.1)
40
+ mime-types-data (~> 3.2015)
41
+ mime-types-data (3.2021.0901)
42
+ minitest (5.14.4)
43
+ multi_xml (0.6.0)
44
+ mustermann (1.1.1)
45
+ ruby2_keywords (~> 0.0.1)
46
+ nokogiri (1.12.4-x86_64-darwin)
47
+ racc (~> 1.4)
48
+ parallel (1.21.0)
49
+ parser (3.0.2.0)
50
+ ast (~> 2.4.1)
51
+ pastel (0.8.0)
52
+ tty-color (~> 0.5)
53
+ racc (1.5.2)
54
+ rack (2.2.3)
55
+ rack-protection (2.1.0)
56
+ rack
57
+ rainbow (3.0.0)
58
+ rake (13.0.6)
59
+ regexp_parser (2.1.1)
60
+ rexml (3.2.5)
61
+ rspec (3.10.0)
62
+ rspec-core (~> 3.10.0)
63
+ rspec-expectations (~> 3.10.0)
64
+ rspec-mocks (~> 3.10.0)
65
+ rspec-core (3.10.1)
66
+ rspec-support (~> 3.10.0)
67
+ rspec-expectations (3.10.1)
68
+ diff-lcs (>= 1.2.0, < 2.0)
69
+ rspec-support (~> 3.10.0)
70
+ rspec-mocks (3.10.2)
71
+ diff-lcs (>= 1.2.0, < 2.0)
72
+ rspec-support (~> 3.10.0)
73
+ rspec-support (3.10.2)
74
+ rubocop (1.21.0)
75
+ parallel (~> 1.10)
76
+ parser (>= 3.0.0.0)
77
+ rainbow (>= 2.2.2, < 4.0)
78
+ regexp_parser (>= 1.8, < 3.0)
79
+ rexml
80
+ rubocop-ast (>= 1.9.1, < 2.0)
81
+ ruby-progressbar (~> 1.7)
82
+ unicode-display_width (>= 1.4.0, < 3.0)
83
+ rubocop-ast (1.11.0)
84
+ parser (>= 3.0.1.1)
85
+ ruby-progressbar (1.11.0)
86
+ ruby2_keywords (0.0.5)
87
+ sinatra (2.1.0)
88
+ mustermann (~> 1.0)
89
+ rack (~> 2.2)
90
+ rack-protection (= 2.1.0)
91
+ tilt (~> 2.0)
92
+ sinatra-activerecord (2.0.23)
93
+ activerecord (>= 4.1)
94
+ sinatra (>= 1.0)
95
+ sqlite3 (1.4.2)
96
+ thread_safe (0.3.6)
97
+ tilt (2.0.10)
98
+ tty-color (0.6.0)
99
+ tty-cursor (0.7.1)
100
+ tty-prompt (0.23.1)
101
+ pastel (~> 0.8)
102
+ tty-reader (~> 0.8)
103
+ tty-reader (0.9.0)
104
+ tty-cursor (~> 0.7)
105
+ tty-screen (~> 0.8)
106
+ wisper (~> 2.0)
107
+ tty-screen (0.8.1)
108
+ tzinfo (1.2.9)
109
+ thread_safe (~> 0.1)
110
+ unicode-display_width (2.1.0)
111
+ wisper (2.0.1)
112
+
113
+ PLATFORMS
114
+ x86_64-darwin-20
115
+
116
+ DEPENDENCIES
117
+ rake (~> 13.0)
118
+ rspec (~> 3.0)
119
+ rubocop (~> 1.7)
120
+ world_top_movies!
121
+
122
+ BUNDLED WITH
123
+ 2.2.27
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Harold Torres Marino
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/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # WorldTopMovies
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/world_top_movies`. 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
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'world_top_movies'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install world_top_movies
22
+
23
+ ## Usage
24
+
25
+ Run the following code and enjoy:
26
+
27
+ ```ruby
28
+ WorldTopMovies::CLI.new.run
29
+ ```
30
+
31
+ ## Development
32
+
33
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
34
+
35
+ 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
36
+
37
+ ## Contributing
38
+
39
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/world_top_movies. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/world_top_movies/blob/master/CODE_OF_CONDUCT.md).
40
+
41
+ ## License
42
+
43
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
44
+
45
+ ## Code of Conduct
46
+
47
+ Everyone interacting in the WorldTopMovies project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/world_top_movies/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'sinatra/activerecord/rake'
4
+ require_relative 'lib/world_top_movies.rb'
5
+ require "bundler/gem_tasks"
6
+ require "rspec/core/rake_task"
7
+
8
+ RSpec::Core::RakeTask.new(:spec)
9
+
10
+ require "rubocop/rake_task"
11
+
12
+ RuboCop::RakeTask.new
13
+
14
+ task default: %i[spec rubocop]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "world_top_movies"
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(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,24 @@
1
+ require 'active_record'
2
+ require 'tty-prompt'
3
+ require 'sqlite3'
4
+ require 'colorize'
5
+ require 'artii'
6
+ require 'httparty'
7
+ require 'nokogiri'
8
+
9
+ require_relative '../lib/world_top_movies/models/movie.rb'
10
+ require_relative '../lib/world_top_movies/models/note.rb'
11
+ require_relative '../lib/world_top_movies/models/user_movie.rb'
12
+ require_relative '../lib/world_top_movies/models/user_note.rb'
13
+ require_relative '../lib/world_top_movies/models/user.rb'
14
+ require_relative '../lib/world_top_movies/cli.rb'
15
+ require_relative '../lib/world_top_movies/movie.rb'
16
+ require_relative '../lib/world_top_movies/scraper.rb'
17
+
18
+ ActiveRecord::Base.establish_connection(
19
+ "adapter" => "sqlite3",
20
+ "database"=> "#{__dir__}/../db/development.db"
21
+ )
22
+
23
+ # Avoid undesired outputs on the terminal
24
+ ActiveRecord::Base.logger = nil
data/db/development.db ADDED
Binary file
@@ -0,0 +1,9 @@
1
+ class CreateUsers < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :users do |t|
4
+ t.string :username
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,20 @@
1
+ class CreateMovies < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :movies do |t|
4
+ t.string :title
5
+ t.string :year
6
+ t.string :duration
7
+ t.string :genres
8
+ t.float :user_rating
9
+ t.integer :metascore
10
+ t.text :description
11
+ t.string :director
12
+ t.string :stars
13
+ t.integer :votes
14
+ t.string :gross_revenue
15
+ t.string :url
16
+
17
+ t.timestamps
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,10 @@
1
+ class CreateUserMovies < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :user_movies do |t|
4
+ t.integer :user_id
5
+ t.integer :movie_id
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ class CreateNotes < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :notes do |t|
4
+ t.text :note_message
5
+ t.integer :movie_id
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ class CreateUserNotes < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :user_notes do |t|
4
+ t.integer :user_id
5
+ t.integer :note_id, index: { unique: true }
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
data/db/schema.rb ADDED
@@ -0,0 +1,60 @@
1
+ # This file is auto-generated from the current state of the database. Instead
2
+ # of editing this file, please use the migrations feature of Active Record to
3
+ # incrementally modify your database, and then regenerate this schema definition.
4
+ #
5
+ # Note that this schema.rb definition is the authoritative source for your
6
+ # database schema. If you need to create the application database on another
7
+ # system, you should be using db:schema:load, not running all the migrations
8
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
10
+ #
11
+ # It's strongly recommended that you check this file into your version control system.
12
+
13
+ ActiveRecord::Schema.define(version: 2021_09_22_215434) do
14
+
15
+ create_table "movies", force: :cascade do |t|
16
+ t.string "title"
17
+ t.string "year"
18
+ t.string "duration"
19
+ t.string "genres"
20
+ t.float "user_rating"
21
+ t.integer "metascore"
22
+ t.text "description"
23
+ t.string "director"
24
+ t.string "stars"
25
+ t.integer "votes"
26
+ t.string "gross_revenue"
27
+ t.string "url"
28
+ t.datetime "created_at", null: false
29
+ t.datetime "updated_at", null: false
30
+ end
31
+
32
+ create_table "notes", force: :cascade do |t|
33
+ t.text "note_message"
34
+ t.integer "movie_id"
35
+ t.datetime "created_at", null: false
36
+ t.datetime "updated_at", null: false
37
+ end
38
+
39
+ create_table "user_movies", force: :cascade do |t|
40
+ t.integer "user_id"
41
+ t.integer "movie_id"
42
+ t.datetime "created_at", null: false
43
+ t.datetime "updated_at", null: false
44
+ end
45
+
46
+ create_table "user_notes", force: :cascade do |t|
47
+ t.integer "user_id"
48
+ t.integer "note_id"
49
+ t.datetime "created_at", null: false
50
+ t.datetime "updated_at", null: false
51
+ t.index ["note_id"], name: "index_user_notes_on_note_id", unique: true
52
+ end
53
+
54
+ create_table "users", force: :cascade do |t|
55
+ t.string "username"
56
+ t.datetime "created_at", null: false
57
+ t.datetime "updated_at", null: false
58
+ end
59
+
60
+ end
data/db/seeds.rb ADDED
@@ -0,0 +1,5 @@
1
+ WorldTopMovies::DB::User.destroy_all
2
+ WorldTopMovies::DB::UserMovie.destroy_all
3
+ WorldTopMovies::DB::Movie.destroy_all
4
+ WorldTopMovies::DB::Note.destroy_all
5
+ WorldTopMovies::DB::UserNote.destroy_all