├── log └── .keep ├── app ├── mailers │ └── .keep ├── models │ ├── .keep │ ├── concerns │ │ └── .keep │ ├── role.rb │ ├── genre.rb │ ├── crew.rb │ └── movie.rb ├── assets │ ├── images │ │ └── .keep │ ├── stylesheets │ │ ├── movies.sass │ │ ├── landings.sass │ │ ├── navbar-form.css │ │ └── application.sass │ └── javascripts │ │ └── application.coffee ├── controllers │ ├── concerns │ │ └── .keep │ ├── landings_controller.rb │ ├── application_controller.rb │ └── movies_controller.rb ├── helpers │ ├── movies_helper.rb │ └── application_helper.rb ├── presenters │ ├── bucket_presenter.rb │ └── aggregation_presenter.rb ├── views │ ├── movies │ │ ├── index.html.erb │ │ └── _movie.html.erb │ ├── layouts │ │ ├── shared │ │ │ ├── _footer.html.erb │ │ │ └── _navigation.html.erb │ │ ├── landings.html.erb │ │ └── application.html.erb │ ├── aggregations │ │ └── _aggregation.html.erb │ └── landings │ │ └── show.html.erb ├── jobs │ └── indexer_job.rb └── queries │ └── movies_query.rb ├── lib ├── assets │ └── .keep └── tasks │ ├── .keep │ ├── elasticsearch.rake │ └── omdb.thor ├── public ├── favicon.ico ├── robots.txt ├── 500.html ├── 422.html └── 404.html ├── test ├── helpers │ └── .keep ├── mailers │ └── .keep ├── models │ ├── .keep │ ├── genre_test.rb │ ├── crew_test.rb │ ├── role_test.rb │ └── movie_test.rb ├── controllers │ ├── .keep │ └── movies_controller_test.rb ├── fixtures │ ├── .keep │ ├── crews.yml │ ├── movies.yml │ ├── genres.yml │ └── roles.yml ├── integration │ └── .keep ├── jobs │ └── indexer_job_test.rb └── test_helper.rb ├── vendor └── assets │ ├── javascripts │ └── .keep │ └── stylesheets │ └── .keep ├── bin ├── web ├── worker ├── bundle ├── rake ├── rails ├── spring └── setup ├── config ├── sidekiq.yml ├── boot.rb ├── initializers │ ├── cookies_serializer.rb │ ├── session_store.rb │ ├── mime_types.rb │ ├── filter_parameter_logging.rb │ ├── backtrace_silencers.rb │ ├── elasticsearch.rb │ ├── assets.rb │ ├── wrap_parameters.rb │ ├── inflections.rb │ └── sidekiq.rb ├── environment.rb ├── routes.rb ├── puma.rb ├── locales │ └── en.yml ├── secrets.yml ├── application.rb ├── environments │ ├── development.rb │ ├── test.rb │ └── production.rb ├── database.yml.example └── database.yml ├── db ├── migrate │ ├── 20150501102639_drop_crews_movies.rb │ ├── 20150501104039_add_release_date_to_movies.rb │ ├── 20150501071546_create_crews.rb │ ├── 20150419151922_create_genres.rb │ ├── 20150419151848_create_movies.rb │ ├── 20150501072034_create_crews_movies.rb │ ├── 20150419152045_create_genres_movies.rb │ ├── 20150501102555_create_roles.rb │ └── 20150501101641_add_fields_to_movies.rb ├── seeds.rb └── schema.rb ├── config.ru ├── Rakefile ├── .drone.sec ├── Dockerfile ├── .gitignore ├── LICENSE ├── README.md ├── Gemfile ├── .drone.yml └── Gemfile.lock /log/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/mailers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/models/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/helpers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/mailers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/models/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/controllers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/integration/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/assets/javascripts/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/assets/stylesheets/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/stylesheets/movies.sass: -------------------------------------------------------------------------------- 1 | body.movies.index 2 | -------------------------------------------------------------------------------- /bin/web: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | bundle exec puma -C config/puma.rb -------------------------------------------------------------------------------- /app/helpers/movies_helper.rb: -------------------------------------------------------------------------------- 1 | module MoviesHelper 2 | end 3 | -------------------------------------------------------------------------------- /bin/worker: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | bundle exec sidekiq -C config/sidekiq.yml -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /lib/tasks/elasticsearch.rake: -------------------------------------------------------------------------------- 1 | require 'elasticsearch/rails/tasks/import' -------------------------------------------------------------------------------- /config/sidekiq.yml: -------------------------------------------------------------------------------- 1 | --- 2 | :concurrency: 4 3 | :queues: 4 | - default 5 | - elasticsearch -------------------------------------------------------------------------------- /app/models/role.rb: -------------------------------------------------------------------------------- 1 | class Role < ActiveRecord::Base 2 | belongs_to :movie 3 | belongs_to :crew 4 | end 5 | -------------------------------------------------------------------------------- /test/models/genre_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class GenreTest < ActiveSupport::TestCase 4 | 5 | end 6 | -------------------------------------------------------------------------------- /app/controllers/landings_controller.rb: -------------------------------------------------------------------------------- 1 | class LandingsController < ApplicationController 2 | def show 3 | 4 | end 5 | end -------------------------------------------------------------------------------- /app/assets/javascripts/application.coffee: -------------------------------------------------------------------------------- 1 | #= require jquery 2 | #= require jquery_ujs 3 | #= require turbolinks 4 | #= require bootstrap -------------------------------------------------------------------------------- /app/models/genre.rb: -------------------------------------------------------------------------------- 1 | class Genre < ActiveRecord::Base 2 | has_and_belongs_to_many :movies 3 | 4 | validates :name, uniqueness: true 5 | end 6 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 2 | 3 | require 'bundler/setup' # Set up gems listed in the Gemfile. 4 | -------------------------------------------------------------------------------- /db/migrate/20150501102639_drop_crews_movies.rb: -------------------------------------------------------------------------------- 1 | class DropCrewsMovies < ActiveRecord::Migration 2 | def change 3 | drop_table :crews_movies 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /test/fixtures/crews.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | mark_ruffalo: 4 | name: Mark Ruffalo 5 | -------------------------------------------------------------------------------- /app/assets/stylesheets/landings.sass: -------------------------------------------------------------------------------- 1 | body.landings.show 2 | div#search-bar 3 | padding-top: 110px 4 | h1 5 | font-weight: bold 6 | margin-bottom: 40px -------------------------------------------------------------------------------- /app/models/crew.rb: -------------------------------------------------------------------------------- 1 | class Crew < ActiveRecord::Base 2 | has_many :roles 3 | has_many :movies, through: :roles 4 | 5 | validates :name, uniqueness: true 6 | end 7 | -------------------------------------------------------------------------------- /test/models/crew_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class CrewTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/role_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class RoleTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Rails.application 5 | -------------------------------------------------------------------------------- /test/jobs/indexer_job_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class IndexerJobTest < ActiveJob::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.action_dispatch.cookies_serializer = :json 4 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.session_store :cookie_store, key: '_moviedb_session' 4 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /db/migrate/20150501104039_add_release_date_to_movies.rb: -------------------------------------------------------------------------------- 1 | class AddReleaseDateToMovies < ActiveRecord::Migration 2 | def change 3 | add_column :movies, :release_date, :date 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /test/controllers/movies_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class MoviesControllerTest < ActionController::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/fixtures/movies.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | avengers: 4 | name: The Avengers 5 | synopsis: Superheroes fight robot 6 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path("../spring", __FILE__) 4 | rescue LoadError 5 | end 6 | require_relative '../config/boot' 7 | require 'rake' 8 | Rake.application.run 9 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /db/migrate/20150501071546_create_crews.rb: -------------------------------------------------------------------------------- 1 | class CreateCrews < ActiveRecord::Migration 2 | def change 3 | create_table :crews do |t| 4 | t.string :name 5 | 6 | t.timestamps null: false 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /test/fixtures/genres.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | action: 4 | name: Action 5 | 6 | adventure: 7 | name: Adventure 8 | 9 | thriller: 10 | name: Thriller 11 | -------------------------------------------------------------------------------- /db/migrate/20150419151922_create_genres.rb: -------------------------------------------------------------------------------- 1 | class CreateGenres < ActiveRecord::Migration 2 | def change 3 | create_table :genres do |t| 4 | t.string :name 5 | 6 | t.timestamps null: false 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path("../spring", __FILE__) 4 | rescue LoadError 5 | end 6 | APP_PATH = File.expand_path('../../config/application', __FILE__) 7 | require_relative '../config/boot' 8 | require 'rails/commands' 9 | -------------------------------------------------------------------------------- /test/fixtures/roles.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | movie_id: 5 | crew_id: 6 | job: MyString 7 | 8 | two: 9 | movie_id: 10 | crew_id: 11 | job: MyString 12 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | # Prevent CSRF attacks by raising an exception. 3 | # For APIs, you may want to use :null_session instead. 4 | protect_from_forgery with: :exception 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150419151848_create_movies.rb: -------------------------------------------------------------------------------- 1 | class CreateMovies < ActiveRecord::Migration 2 | def change 3 | create_table :movies do |t| 4 | t.string :name 5 | t.text :synopsis 6 | 7 | t.timestamps null: false 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require File.expand_path('../config/application', __FILE__) 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /app/presenters/bucket_presenter.rb: -------------------------------------------------------------------------------- 1 | class BucketPresenter < Struct.new(:bucket) 2 | def id 3 | bucket['key'].split('|').first 4 | end 5 | 6 | def name 7 | bucket['key'].split('|').last 8 | end 9 | 10 | def count 11 | bucket['doc_count'] 12 | end 13 | end -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | resources :movies, only: [:show, :index] do 3 | get 'search/*query', to: 'movies#index', as: :search, on: :collection 4 | end 5 | 6 | resource :landing, only: [:show] 7 | 8 | root to: 'landings#show' 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20150501072034_create_crews_movies.rb: -------------------------------------------------------------------------------- 1 | class CreateCrewsMovies < ActiveRecord::Migration 2 | def change 3 | create_table :crews_movies, id: false do |t| 4 | t.integer :crew_id, index: true, unique: true 5 | t.integer :movie_id, index: true 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20150419152045_create_genres_movies.rb: -------------------------------------------------------------------------------- 1 | class CreateGenresMovies < ActiveRecord::Migration 2 | def change 3 | create_table :genres_movies, id: false do |t| 4 | t.integer :genre_id, index: true, unique: true 5 | t.integer :movie_id, index: true 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /app/assets/stylesheets/navbar-form.css: -------------------------------------------------------------------------------- 1 | .navbar-form .input-group { 2 | display: table; 3 | } 4 | .navbar-form .input-group .input-group-addon, 5 | .navbar-form .input-group .input-group-btn { 6 | white-space: nowrap; 7 | width: 1%; 8 | } 9 | .navbar-form .input-group .form-control { 10 | width: 100%; 11 | } -------------------------------------------------------------------------------- /app/assets/stylesheets/application.sass: -------------------------------------------------------------------------------- 1 | @import "bootstrap-sprockets" 2 | @import "bootstrap" 3 | @import "navbar-form" 4 | @import "landings" 5 | @import "movies" 6 | 7 | body 8 | font-family: 'Open Sans', sans-serif 9 | 10 | a:hover 11 | text-decoration: none 12 | 13 | form.navbar-form 14 | margin-top: 10px 15 | 16 | footer 17 | padding-top: 40px -------------------------------------------------------------------------------- /app/views/movies/index.html.erb: -------------------------------------------------------------------------------- 1 |
<%= movie.synopsis %>
18 | 22 |