From 2d56a976740a14c2d40a3cfe3a5d432760f58c5f Mon Sep 17 00:00:00 2001 From: Tyrel Souza Date: Mon, 7 Apr 2014 14:41:34 -0400 Subject: [PATCH] Initial Commit --- .gitignore | 13 + .rspec | 1 + .ruby-version | 1 + .sample.env | 3 + .travis.yml | 13 + Gemfile | 50 ++++ Gemfile.lock | 236 ++++++++++++++++++ Procfile | 2 + README.md | 25 ++ Rakefile | 23 ++ app/assets/images/.keep | 0 app/assets/javascripts/application.js | 15 ++ app/assets/stylesheets/application.css.scss | 8 + app/controllers/application_controller.rb | 5 + app/controllers/campaigns_controller.rb | 58 +++++ app/controllers/concerns/.keep | 0 app/controllers/videolistings_controller.rb | 58 +++++ app/helpers/application_helper.rb | 2 + app/mailers/.keep | 0 app/models/.keep | 0 app/models/campaign.rb | 4 + app/models/concerns/.keep | 0 app/models/videolisting.rb | 3 + app/views/application/_flashes.html.erb | 5 + app/views/application/_javascript.html.erb | 10 + app/views/campaigns/_form.html.erb | 85 +++++++ app/views/campaigns/edit.html.erb | 6 + app/views/campaigns/index.html.erb | 59 +++++ app/views/campaigns/new.html.erb | 5 + app/views/campaigns/show.html.erb | 89 +++++++ app/views/layouts/application.html.erb | 15 ++ app/views/pages/.keep | 0 app/views/videolistings/_form.html.erb | 57 +++++ app/views/videolistings/edit.html.erb | 6 + app/views/videolistings/index.html.erb | 45 ++++ app/views/videolistings/new.html.erb | 5 + app/views/videolistings/show.html.erb | 54 ++++ bin/bundle | 3 + bin/delayed_job | 5 + bin/rails | 4 + bin/rake | 4 + bin/setup | 32 +++ config.ru | 4 + config/application.rb | 42 ++++ config/boot.rb | 4 + config/database.yml | 11 + config/environment.rb | 5 + config/environments/development.rb | 35 +++ config/environments/production.rb | 89 +++++++ config/environments/staging.rb | 9 + config/environments/test.rb | 38 +++ config/initializers/backtrace_silencers.rb | 7 + config/initializers/disable_xml_params.rb | 3 + config/initializers/errors.rb | 28 +++ .../initializers/filter_parameter_logging.rb | 4 + config/initializers/inflections.rb | 16 ++ config/initializers/mime_types.rb | 5 + config/initializers/rack_timeout.rb | 1 + config/initializers/secret_token.rb | 10 + config/initializers/session_store.rb | 3 + config/initializers/smtp.rb | 10 + config/initializers/wrap_parameters.rb | 14 ++ config/locales/en.yml | 11 + config/routes.rb | 6 + config/unicorn.rb | 29 +++ .../20140407172914_create_delayed_jobs.rb | 22 ++ db/migrate/20140407180220_create_campaigns.rb | 25 ++ .../20140407180228_create_videolistings.rb | 18 ++ ...7180534_add_campaign_id_to_videolisting.rb | 5 + db/schema.rb | 73 ++++++ db/seeds.rb | 7 + lib/assets/.keep | 0 lib/tasks/.keep | 0 lib/tasks/development_seeds.rake | 13 + public/404.html | 59 +++++ public/422.html | 59 +++++ public/500.html | 58 +++++ public/favicon.ico | 0 public/robots.txt | 5 + spec/factories/campaigns.rb | 23 ++ spec/factories/videolistings.rb | 16 ++ spec/models/campaign_spec.rb | 5 + spec/models/factories_spec.rb | 13 + spec/models/videolisting_spec.rb | 5 + spec/spec_helper.rb | 30 +++ spec/support/background_jobs.rb | 19 ++ spec/support/database_cleaner.rb | 21 ++ spec/support/factory_girl.rb | 3 + spec/support/features/.keep | 0 spec/support/i18n.rb | 3 + spec/support/matchers/.keep | 0 spec/support/mixins/.keep | 0 spec/support/shared_examples/.keep | 0 vendor/assets/javascripts/.keep | 0 vendor/assets/stylesheets/.keep | 0 95 files changed, 1875 insertions(+) create mode 100644 .gitignore create mode 100644 .rspec create mode 100644 .ruby-version create mode 100644 .sample.env create mode 100644 .travis.yml create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 Procfile create mode 100644 README.md create mode 100644 Rakefile create mode 100644 app/assets/images/.keep create mode 100644 app/assets/javascripts/application.js create mode 100644 app/assets/stylesheets/application.css.scss create mode 100644 app/controllers/application_controller.rb create mode 100644 app/controllers/campaigns_controller.rb create mode 100644 app/controllers/concerns/.keep create mode 100644 app/controllers/videolistings_controller.rb create mode 100644 app/helpers/application_helper.rb create mode 100644 app/mailers/.keep create mode 100644 app/models/.keep create mode 100644 app/models/campaign.rb create mode 100644 app/models/concerns/.keep create mode 100644 app/models/videolisting.rb create mode 100644 app/views/application/_flashes.html.erb create mode 100644 app/views/application/_javascript.html.erb create mode 100644 app/views/campaigns/_form.html.erb create mode 100644 app/views/campaigns/edit.html.erb create mode 100644 app/views/campaigns/index.html.erb create mode 100644 app/views/campaigns/new.html.erb create mode 100644 app/views/campaigns/show.html.erb create mode 100644 app/views/layouts/application.html.erb create mode 100644 app/views/pages/.keep create mode 100644 app/views/videolistings/_form.html.erb create mode 100644 app/views/videolistings/edit.html.erb create mode 100644 app/views/videolistings/index.html.erb create mode 100644 app/views/videolistings/new.html.erb create mode 100644 app/views/videolistings/show.html.erb create mode 100755 bin/bundle create mode 100755 bin/delayed_job create mode 100755 bin/rails create mode 100755 bin/rake create mode 100755 bin/setup create mode 100644 config.ru create mode 100644 config/application.rb create mode 100644 config/boot.rb create mode 100644 config/database.yml create mode 100644 config/environment.rb create mode 100644 config/environments/development.rb create mode 100644 config/environments/production.rb create mode 100644 config/environments/staging.rb create mode 100644 config/environments/test.rb create mode 100644 config/initializers/backtrace_silencers.rb create mode 100644 config/initializers/disable_xml_params.rb create mode 100644 config/initializers/errors.rb create mode 100644 config/initializers/filter_parameter_logging.rb create mode 100644 config/initializers/inflections.rb create mode 100644 config/initializers/mime_types.rb create mode 100644 config/initializers/rack_timeout.rb create mode 100644 config/initializers/secret_token.rb create mode 100644 config/initializers/session_store.rb create mode 100644 config/initializers/smtp.rb create mode 100644 config/initializers/wrap_parameters.rb create mode 100644 config/locales/en.yml create mode 100644 config/routes.rb create mode 100644 config/unicorn.rb create mode 100644 db/migrate/20140407172914_create_delayed_jobs.rb create mode 100644 db/migrate/20140407180220_create_campaigns.rb create mode 100644 db/migrate/20140407180228_create_videolistings.rb create mode 100644 db/migrate/20140407180534_add_campaign_id_to_videolisting.rb create mode 100644 db/schema.rb create mode 100644 db/seeds.rb create mode 100644 lib/assets/.keep create mode 100644 lib/tasks/.keep create mode 100644 lib/tasks/development_seeds.rake create mode 100644 public/404.html create mode 100644 public/422.html create mode 100644 public/500.html create mode 100644 public/favicon.ico create mode 100644 public/robots.txt create mode 100644 spec/factories/campaigns.rb create mode 100644 spec/factories/videolistings.rb create mode 100644 spec/models/campaign_spec.rb create mode 100644 spec/models/factories_spec.rb create mode 100644 spec/models/videolisting_spec.rb create mode 100644 spec/spec_helper.rb create mode 100644 spec/support/background_jobs.rb create mode 100644 spec/support/database_cleaner.rb create mode 100644 spec/support/factory_girl.rb create mode 100644 spec/support/features/.keep create mode 100644 spec/support/i18n.rb create mode 100644 spec/support/matchers/.keep create mode 100644 spec/support/mixins/.keep create mode 100644 spec/support/shared_examples/.keep create mode 100644 vendor/assets/javascripts/.keep create mode 100644 vendor/assets/stylesheets/.keep diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9de8c2f --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +!.keep +*.DS_Store +*.swo +*.swp +/.bundle +/.env +/.foreman +/coverage/* +/db/*.sqlite3 +/log/* +/public/system +/tags +/tmp/* diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..4e1e0d2 --- /dev/null +++ b/.rspec @@ -0,0 +1 @@ +--color diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..7ec1d6d --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.1.0 diff --git a/.sample.env b/.sample.env new file mode 100644 index 0000000..27983d1 --- /dev/null +++ b/.sample.env @@ -0,0 +1,3 @@ +# http://ddollar.github.com/foreman/ +RACK_ENV=development +SECRET_KEY_BASE=development_secret diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..b7db76f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,13 @@ +before_script: +- cp .sample.env .env +branches: + only: + - master +cache: bundler +language: ruby +notifications: + campfire: + on_success: change + on_failure: always + template: '%{repository_name} build #%{build_number} on %{branch} by %{author} finished: %{message}: %{build_url}' +rvm: ruby-2.1.0 diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..1104bc5 --- /dev/null +++ b/Gemfile @@ -0,0 +1,50 @@ +source 'https://rubygems.org' + +ruby '2.1.0' + +gem 'airbrake' +gem 'bourbon' +gem 'coffee-rails' +gem 'delayed_job_active_record', '>= 4.0.0' +gem 'email_validator' +gem 'flutie' +gem 'high_voltage' +gem 'jquery-rails' +gem 'neat' +gem 'pg' +gem 'rack-timeout' +gem 'rails', '>= 4.0.3' +gem 'recipient_interceptor' +gem 'sass-rails' +gem 'simple_form' +gem 'title' +gem 'uglifier' +gem 'unicorn' + +group :development do + gem 'foreman' + gem 'spring' + gem 'spring-commands-rspec' +end + +group :development, :test do + gem 'awesome_print' + gem 'dotenv-rails' + gem 'factory_girl_rails' + gem 'pry-rails' + gem 'rspec-rails', '>= 2.14' +end + +group :test do + gem 'capybara-webkit', '>= 1.0.0' + gem 'database_cleaner' + gem 'launchy' + gem 'shoulda-matchers' + gem 'simplecov', require: false + gem 'timecop' + gem 'webmock' +end + +group :staging, :production do + gem 'newrelic_rpm', '>= 3.7.3' +end diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..e6e5689 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,236 @@ +GEM + remote: https://rubygems.org/ + specs: + actionmailer (4.0.4) + actionpack (= 4.0.4) + mail (~> 2.5.4) + actionpack (4.0.4) + activesupport (= 4.0.4) + builder (~> 3.1.0) + erubis (~> 2.7.0) + rack (~> 1.5.2) + rack-test (~> 0.6.2) + activemodel (4.0.4) + activesupport (= 4.0.4) + builder (~> 3.1.0) + activerecord (4.0.4) + activemodel (= 4.0.4) + activerecord-deprecated_finders (~> 1.0.2) + activesupport (= 4.0.4) + arel (~> 4.0.0) + activerecord-deprecated_finders (1.0.3) + activesupport (4.0.4) + i18n (~> 0.6, >= 0.6.9) + minitest (~> 4.2) + multi_json (~> 1.3) + thread_safe (~> 0.1) + tzinfo (~> 0.3.37) + addressable (2.3.6) + airbrake (3.1.16) + builder + multi_json + arel (4.0.2) + awesome_print (1.2.0) + bourbon (3.1.8) + sass (>= 3.2.0) + thor + builder (3.1.4) + capybara (2.1.0) + mime-types (>= 1.16) + nokogiri (>= 1.3.3) + rack (>= 1.0.0) + rack-test (>= 0.5.4) + xpath (~> 2.0) + capybara-webkit (1.1.1) + capybara (>= 2.0.2, < 2.2.0) + json + coderay (1.1.0) + coffee-rails (4.0.1) + coffee-script (>= 2.2.0) + railties (>= 4.0.0, < 5.0) + coffee-script (2.2.0) + coffee-script-source + execjs + coffee-script-source (1.7.0) + crack (0.4.2) + safe_yaml (~> 1.0.0) + database_cleaner (1.2.0) + delayed_job (4.0.0) + activesupport (>= 3.0, < 4.1) + delayed_job_active_record (4.0.0) + activerecord (>= 3.0, < 4.1) + delayed_job (>= 3.0, < 4.1) + diff-lcs (1.2.5) + docile (1.1.3) + dotenv (0.10.0) + dotenv-rails (0.10.0) + dotenv (= 0.10.0) + email_validator (1.4.0) + activemodel + erubis (2.7.0) + execjs (2.0.2) + factory_girl (4.4.0) + activesupport (>= 3.0.0) + factory_girl_rails (4.4.1) + factory_girl (~> 4.4.0) + railties (>= 3.0.0) + flutie (2.0.0) + foreman (0.63.0) + dotenv (>= 0.7) + thor (>= 0.13.6) + high_voltage (2.1.0) + hike (1.2.3) + i18n (0.6.9) + jquery-rails (3.1.0) + railties (>= 3.0, < 5.0) + thor (>= 0.14, < 2.0) + json (1.8.1) + kgio (2.9.2) + launchy (2.4.2) + addressable (~> 2.3) + mail (2.5.4) + mime-types (~> 1.16) + treetop (~> 1.4.8) + method_source (0.8.2) + mime-types (1.25.1) + mini_portile (0.5.3) + minitest (4.7.5) + multi_json (1.9.2) + neat (1.6.0) + bourbon (>= 3.1) + sass (>= 3.3) + newrelic_rpm (3.7.3.204) + nokogiri (1.6.1) + mini_portile (~> 0.5.0) + pg (0.17.1) + polyglot (0.3.4) + pry (0.9.12.6) + coderay (~> 1.0) + method_source (~> 0.8) + slop (~> 3.4) + pry-rails (0.3.2) + pry (>= 0.9.10) + rack (1.5.2) + rack-test (0.6.2) + rack (>= 1.0) + rack-timeout (0.0.4) + rails (4.0.4) + actionmailer (= 4.0.4) + actionpack (= 4.0.4) + activerecord (= 4.0.4) + activesupport (= 4.0.4) + bundler (>= 1.3.0, < 2.0) + railties (= 4.0.4) + sprockets-rails (~> 2.0.0) + railties (4.0.4) + actionpack (= 4.0.4) + activesupport (= 4.0.4) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + raindrops (0.13.0) + rake (10.2.2) + recipient_interceptor (0.1.2) + mail + rspec-core (2.14.8) + rspec-expectations (2.14.5) + diff-lcs (>= 1.1.3, < 2.0) + rspec-mocks (2.14.6) + rspec-rails (2.14.2) + actionpack (>= 3.0) + activemodel (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec-core (~> 2.14.0) + rspec-expectations (~> 2.14.0) + rspec-mocks (~> 2.14.0) + safe_yaml (1.0.2) + sass (3.3.4) + sass-rails (4.0.1) + railties (>= 4.0.0, < 5.0) + sass (>= 3.1.10) + sprockets-rails (~> 2.0.0) + shoulda-matchers (2.5.0) + activesupport (>= 3.0.0) + simple_form (3.0.1) + actionpack (>= 4.0.0, < 4.1) + activemodel (>= 4.0.0, < 4.1) + simplecov (0.8.2) + docile (~> 1.1.0) + multi_json + simplecov-html (~> 0.8.0) + simplecov-html (0.8.0) + slop (3.5.0) + spring (1.1.2) + spring-commands-rspec (1.0.1) + spring (>= 0.9.1) + sprockets (2.12.0) + hike (~> 1.2) + multi_json (~> 1.0) + rack (~> 1.0) + tilt (~> 1.1, != 1.3.0) + sprockets-rails (2.0.1) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (~> 2.8) + thor (0.19.1) + thread_safe (0.3.3) + tilt (1.4.1) + timecop (0.7.1) + title (0.0.4) + i18n + rails (>= 3.1) + treetop (1.4.15) + polyglot + polyglot (>= 0.3.1) + tzinfo (0.3.39) + uglifier (2.5.0) + execjs (>= 0.3.0) + json (>= 1.8.0) + unicorn (4.8.2) + kgio (~> 2.6) + rack + raindrops (~> 0.7) + webmock (1.17.4) + addressable (>= 2.2.7) + crack (>= 0.3.2) + xpath (2.0.0) + nokogiri (~> 1.3) + +PLATFORMS + ruby + +DEPENDENCIES + airbrake + awesome_print + bourbon + capybara-webkit (>= 1.0.0) + coffee-rails + database_cleaner + delayed_job_active_record (>= 4.0.0) + dotenv-rails + email_validator + factory_girl_rails + flutie + foreman + high_voltage + jquery-rails + launchy + neat + newrelic_rpm (>= 3.7.3) + pg + pry-rails + rack-timeout + rails (>= 4.0.3) + recipient_interceptor + rspec-rails (>= 2.14) + sass-rails + shoulda-matchers + simple_form + simplecov + spring + spring-commands-rspec + timecop + title + uglifier + unicorn + webmock diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..7934897 --- /dev/null +++ b/Procfile @@ -0,0 +1,2 @@ +web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb +worker: bundle exec rake jobs:work diff --git a/README.md b/README.md new file mode 100644 index 0000000..48ef74f --- /dev/null +++ b/README.md @@ -0,0 +1,25 @@ +Vidpush +======= + +Getting Started +--------------- + +This repository comes equipped with a self-setup script: + + % ./bin/setup + +After setting up, you can run the application using [foreman]: + + % foreman start + +[foreman]: http://ddollar.github.io/foreman/ + +Guidelines +---------- + +Use the following guides for getting things done, programming well, and +programming in style. + +* [Protocol](http://github.com/thoughtbot/guides/blob/master/protocol) +* [Best Practices](http://github.com/thoughtbot/guides/blob/master/best-practices) +* [Style](http://github.com/thoughtbot/guides/blob/master/style) diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..1aead80 --- /dev/null +++ b/Rakefile @@ -0,0 +1,23 @@ +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require File.expand_path('../config/application', __FILE__) + +Vidpush::Application.load_tasks +if defined?(RSpec) + task(:spec).clear + + desc 'Run all specs' + RSpec::Core::RakeTask.new(:spec) do |t| + t.rspec_opts = '--tag ~factory' + end + + desc 'Run factory specs.' + RSpec::Core::RakeTask.new(:factory_specs) do |t| + t.pattern = './spec/models/factories_spec.rb' + end + + task spec: :factory_specs +end +task(:default).clear +task :default => [:spec] diff --git a/app/assets/images/.keep b/app/assets/images/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js new file mode 100644 index 0000000..1ca0e3b --- /dev/null +++ b/app/assets/javascripts/application.js @@ -0,0 +1,15 @@ +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, +// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// compiled file. +// +// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details +// about supported directives. +// +//= require jquery +//= require jquery_ujs +//= require_tree . diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss new file mode 100644 index 0000000..a7c04e0 --- /dev/null +++ b/app/assets/stylesheets/application.css.scss @@ -0,0 +1,8 @@ +@charset 'utf-8'; + +/////////////////////////////////////////////////////////////////////////////// + +@import 'bourbon'; +@import 'neat'; + +/////////////////////////////////////////////////////////////////////////////// diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb new file mode 100644 index 0000000..d83690e --- /dev/null +++ b/app/controllers/application_controller.rb @@ -0,0 +1,5 @@ +class ApplicationController < ActionController::Base + # Prevent CSRF attacks by raising an exception. + # For APIs, you may want to use :null_session instead. + protect_from_forgery with: :exception +end diff --git a/app/controllers/campaigns_controller.rb b/app/controllers/campaigns_controller.rb new file mode 100644 index 0000000..797422c --- /dev/null +++ b/app/controllers/campaigns_controller.rb @@ -0,0 +1,58 @@ +class CampaignsController < ApplicationController + before_action :set_campaign, only: [:show, :edit, :update, :destroy] + + # GET /campaigns + def index + @campaigns = Campaign.all + end + + # GET /campaigns/1 + def show + end + + # GET /campaigns/new + def new + @campaign = Campaign.new + end + + # GET /campaigns/1/edit + def edit + end + + # POST /campaigns + def create + @campaign = Campaign.new(campaign_params) + + if @campaign.save + redirect_to @campaign, notice: 'Campaign was successfully created.' + else + render action: 'new' + end + end + + # PATCH/PUT /campaigns/1 + def update + if @campaign.update(campaign_params) + redirect_to @campaign, notice: 'Campaign was successfully updated.' + else + render action: 'edit' + end + end + + # DELETE /campaigns/1 + def destroy + @campaign.destroy + redirect_to campaigns_url, notice: 'Campaign was successfully destroyed.' + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_campaign + @campaign = Campaign.find(params[:id]) + end + + # Only allow a trusted parameter "white list" through. + def campaign_params + params.require(:campaign).permit(:clientid, :listingcode, :billingcode, :advertisername, :address1, :address2, :city, :state, :zip, :emailaddress, :customerfirstname, :customerlastname, :salesrep, :salesrepemail, :businessphone, :contactphone, :websiteurl) + end +end diff --git a/app/controllers/concerns/.keep b/app/controllers/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/controllers/videolistings_controller.rb b/app/controllers/videolistings_controller.rb new file mode 100644 index 0000000..c841e75 --- /dev/null +++ b/app/controllers/videolistings_controller.rb @@ -0,0 +1,58 @@ +class VideolistingsController < ApplicationController + before_action :set_videolisting, only: [:show, :edit, :update, :destroy] + + # GET /videolistings + def index + @videolistings = Videolisting.all + end + + # GET /videolistings/1 + def show + end + + # GET /videolistings/new + def new + @videolisting = Videolisting.new + end + + # GET /videolistings/1/edit + def edit + end + + # POST /videolistings + def create + @videolisting = Videolisting.new(videolisting_params) + + if @videolisting.save + redirect_to @videolisting, notice: 'Videolisting was successfully created.' + else + render action: 'new' + end + end + + # PATCH/PUT /videolistings/1 + def update + if @videolisting.update(videolisting_params) + redirect_to @videolisting, notice: 'Videolisting was successfully updated.' + else + render action: 'edit' + end + end + + # DELETE /videolistings/1 + def destroy + @videolisting.destroy + redirect_to videolistings_url, notice: 'Videolisting was successfully destroyed.' + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_videolisting + @videolisting = Videolisting.find(params[:id]) + end + + # Only allow a trusted parameter "white list" through. + def videolisting_params + params.require(:videolisting).permit(:videocode, :producttypeid, :remoteassetsarchive, :voiceoverselection, :musicselection, :clientprovidedscript, :keywords, :focus, :notes, :asseturls) + end +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb new file mode 100644 index 0000000..de6be79 --- /dev/null +++ b/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/app/mailers/.keep b/app/mailers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/models/.keep b/app/models/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/models/campaign.rb b/app/models/campaign.rb new file mode 100644 index 0000000..cd84d7e --- /dev/null +++ b/app/models/campaign.rb @@ -0,0 +1,4 @@ +class Campaign < ActiveRecord::Base + has_many :videolistings + accepts_nested_attributes_for :videolistings +end diff --git a/app/models/concerns/.keep b/app/models/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/models/videolisting.rb b/app/models/videolisting.rb new file mode 100644 index 0000000..9b3860b --- /dev/null +++ b/app/models/videolisting.rb @@ -0,0 +1,3 @@ +class Videolisting < ActiveRecord::Base + belongs_to :campaign +end diff --git a/app/views/application/_flashes.html.erb b/app/views/application/_flashes.html.erb new file mode 100644 index 0000000..ae7ff75 --- /dev/null +++ b/app/views/application/_flashes.html.erb @@ -0,0 +1,5 @@ +
+ <% flash.each do |key, value| -%> +
<%= value %>
+ <% end -%> +
diff --git a/app/views/application/_javascript.html.erb b/app/views/application/_javascript.html.erb new file mode 100644 index 0000000..232046a --- /dev/null +++ b/app/views/application/_javascript.html.erb @@ -0,0 +1,10 @@ +<%= javascript_include_tag :application %> + +<%= yield :javascript %> + +<% if Rails.env.test? %> + <%= javascript_tag do %> + $.fx.off = true; + $.ajaxSetup({ async: false }); + <% end %> +<% end %> diff --git a/app/views/campaigns/_form.html.erb b/app/views/campaigns/_form.html.erb new file mode 100644 index 0000000..e870049 --- /dev/null +++ b/app/views/campaigns/_form.html.erb @@ -0,0 +1,85 @@ +<%= form_for(@campaign) do |f| %> + <% if @campaign.errors.any? %> +
+

<%= pluralize(@campaign.errors.count, "error") %> prohibited this campaign from being saved:

+ + +
+ <% end %> + +
+ <%= f.label :clientid %>
+ <%= f.text_field :clientid %> +
+
+ <%= f.label :listingcode %>
+ <%= f.text_field :listingcode %> +
+
+ <%= f.label :billingcode %>
+ <%= f.text_field :billingcode %> +
+
+ <%= f.label :advertisername %>
+ <%= f.text_field :advertisername %> +
+
+ <%= f.label :address1 %>
+ <%= f.text_field :address1 %> +
+
+ <%= f.label :address2 %>
+ <%= f.text_field :address2 %> +
+
+ <%= f.label :city %>
+ <%= f.text_field :city %> +
+
+ <%= f.label :state %>
+ <%= f.text_field :state %> +
+
+ <%= f.label :zip %>
+ <%= f.text_field :zip %> +
+
+ <%= f.label :emailaddress %>
+ <%= f.text_field :emailaddress %> +
+
+ <%= f.label :customerfirstname %>
+ <%= f.text_field :customerfirstname %> +
+
+ <%= f.label :customerlastname %>
+ <%= f.text_field :customerlastname %> +
+
+ <%= f.label :salesrep %>
+ <%= f.text_field :salesrep %> +
+
+ <%= f.label :salesrepemail %>
+ <%= f.text_field :salesrepemail %> +
+
+ <%= f.label :businessphone %>
+ <%= f.text_field :businessphone %> +
+
+ <%= f.label :contactphone %>
+ <%= f.text_field :contactphone %> +
+
+ <%= f.label :websiteurl %>
+ <%= f.text_field :websiteurl %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/campaigns/edit.html.erb b/app/views/campaigns/edit.html.erb new file mode 100644 index 0000000..992234e --- /dev/null +++ b/app/views/campaigns/edit.html.erb @@ -0,0 +1,6 @@ +

Editing campaign

+ +<%= render 'form' %> + +<%= link_to 'Show', @campaign %> | +<%= link_to 'Back', campaigns_path %> diff --git a/app/views/campaigns/index.html.erb b/app/views/campaigns/index.html.erb new file mode 100644 index 0000000..c46744b --- /dev/null +++ b/app/views/campaigns/index.html.erb @@ -0,0 +1,59 @@ +

Listing campaigns

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + <% @campaigns.each do |campaign| %> + + + + + + + + + + + + + + + + + + + + + + + <% end %> + +
ClientidListingcodeBillingcodeAdvertisernameAddress1Address2CityStateZipEmailaddressCustomerfirstnameCustomerlastnameSalesrepSalesrepemailBusinessphoneContactphoneWebsiteurl
<%= campaign.clientid %><%= campaign.listingcode %><%= campaign.billingcode %><%= campaign.advertisername %><%= campaign.address1 %><%= campaign.address2 %><%= campaign.city %><%= campaign.state %><%= campaign.zip %><%= campaign.emailaddress %><%= campaign.customerfirstname %><%= campaign.customerlastname %><%= campaign.salesrep %><%= campaign.salesrepemail %><%= campaign.businessphone %><%= campaign.contactphone %><%= campaign.websiteurl %><%= link_to 'Show', campaign %><%= link_to 'Edit', edit_campaign_path(campaign) %><%= link_to 'Destroy', campaign, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Campaign', new_campaign_path %> diff --git a/app/views/campaigns/new.html.erb b/app/views/campaigns/new.html.erb new file mode 100644 index 0000000..b219e95 --- /dev/null +++ b/app/views/campaigns/new.html.erb @@ -0,0 +1,5 @@ +

New campaign

+ +<%= render 'form' %> + +<%= link_to 'Back', campaigns_path %> diff --git a/app/views/campaigns/show.html.erb b/app/views/campaigns/show.html.erb new file mode 100644 index 0000000..ae88ffc --- /dev/null +++ b/app/views/campaigns/show.html.erb @@ -0,0 +1,89 @@ +

<%= notice %>

+ +

+ Clientid: + <%= @campaign.clientid %> +

+ +

+ Listingcode: + <%= @campaign.listingcode %> +

+ +

+ Billingcode: + <%= @campaign.billingcode %> +

+ +

+ Advertisername: + <%= @campaign.advertisername %> +

+ +

+ Address1: + <%= @campaign.address1 %> +

+ +

+ Address2: + <%= @campaign.address2 %> +

+ +

+ City: + <%= @campaign.city %> +

+ +

+ State: + <%= @campaign.state %> +

+ +

+ Zip: + <%= @campaign.zip %> +

+ +

+ Emailaddress: + <%= @campaign.emailaddress %> +

+ +

+ Customerfirstname: + <%= @campaign.customerfirstname %> +

+ +

+ Customerlastname: + <%= @campaign.customerlastname %> +

+ +

+ Salesrep: + <%= @campaign.salesrep %> +

+ +

+ Salesrepemail: + <%= @campaign.salesrepemail %> +

+ +

+ Businessphone: + <%= @campaign.businessphone %> +

+ +

+ Contactphone: + <%= @campaign.contactphone %> +

+ +

+ Websiteurl: + <%= @campaign.websiteurl %> +

+ +<%= link_to 'Edit', edit_campaign_path(@campaign) %> | +<%= link_to 'Back', campaigns_path %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb new file mode 100644 index 0000000..049e5cd --- /dev/null +++ b/app/views/layouts/application.html.erb @@ -0,0 +1,15 @@ + + + + + + <%= title %> + <%= stylesheet_link_tag :application, :media => 'all' %> + <%= csrf_meta_tags %> + + + <%= render 'flashes' -%> + <%= yield %> + <%= render 'javascript' %> + + diff --git a/app/views/pages/.keep b/app/views/pages/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/views/videolistings/_form.html.erb b/app/views/videolistings/_form.html.erb new file mode 100644 index 0000000..54860d6 --- /dev/null +++ b/app/views/videolistings/_form.html.erb @@ -0,0 +1,57 @@ +<%= form_for(@videolisting) do |f| %> + <% if @videolisting.errors.any? %> +
+

<%= pluralize(@videolisting.errors.count, "error") %> prohibited this videolisting from being saved:

+ + +
+ <% end %> + +
+ <%= f.label :videocode %>
+ <%= f.text_field :videocode %> +
+
+ <%= f.label :producttypeid %>
+ <%= f.text_field :producttypeid %> +
+
+ <%= f.label :remoteassetsarchive %>
+ <%= f.text_field :remoteassetsarchive %> +
+
+ <%= f.label :voiceoverselection %>
+ <%= f.text_field :voiceoverselection %> +
+
+ <%= f.label :musicselection %>
+ <%= f.text_field :musicselection %> +
+
+ <%= f.label :clientprovidedscript %>
+ <%= f.text_field :clientprovidedscript %> +
+
+ <%= f.label :keywords %>
+ <%= f.text_field :keywords %> +
+
+ <%= f.label :focus %>
+ <%= f.text_field :focus %> +
+
+ <%= f.label :notes %>
+ <%= f.text_field :notes %> +
+
+ <%= f.label :asseturls %>
+ <%= f.text_field :asseturls %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/videolistings/edit.html.erb b/app/views/videolistings/edit.html.erb new file mode 100644 index 0000000..80c13f9 --- /dev/null +++ b/app/views/videolistings/edit.html.erb @@ -0,0 +1,6 @@ +

Editing videolisting

+ +<%= render 'form' %> + +<%= link_to 'Show', @videolisting %> | +<%= link_to 'Back', videolistings_path %> diff --git a/app/views/videolistings/index.html.erb b/app/views/videolistings/index.html.erb new file mode 100644 index 0000000..65a3a06 --- /dev/null +++ b/app/views/videolistings/index.html.erb @@ -0,0 +1,45 @@ +

Listing videolistings

+ + + + + + + + + + + + + + + + + + + + + + <% @videolistings.each do |videolisting| %> + + + + + + + + + + + + + + + + <% end %> + +
VideocodeProducttypeidRemoteassetsarchiveVoiceoverselectionMusicselectionClientprovidedscriptKeywordsFocusNotesAsseturls
<%= videolisting.videocode %><%= videolisting.producttypeid %><%= videolisting.remoteassetsarchive %><%= videolisting.voiceoverselection %><%= videolisting.musicselection %><%= videolisting.clientprovidedscript %><%= videolisting.keywords %><%= videolisting.focus %><%= videolisting.notes %><%= videolisting.asseturls %><%= link_to 'Show', videolisting %><%= link_to 'Edit', edit_videolisting_path(videolisting) %><%= link_to 'Destroy', videolisting, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Videolisting', new_videolisting_path %> diff --git a/app/views/videolistings/new.html.erb b/app/views/videolistings/new.html.erb new file mode 100644 index 0000000..9692bd5 --- /dev/null +++ b/app/views/videolistings/new.html.erb @@ -0,0 +1,5 @@ +

New videolisting

+ +<%= render 'form' %> + +<%= link_to 'Back', videolistings_path %> diff --git a/app/views/videolistings/show.html.erb b/app/views/videolistings/show.html.erb new file mode 100644 index 0000000..1abe518 --- /dev/null +++ b/app/views/videolistings/show.html.erb @@ -0,0 +1,54 @@ +

<%= notice %>

+ +

+ Videocode: + <%= @videolisting.videocode %> +

+ +

+ Producttypeid: + <%= @videolisting.producttypeid %> +

+ +

+ Remoteassetsarchive: + <%= @videolisting.remoteassetsarchive %> +

+ +

+ Voiceoverselection: + <%= @videolisting.voiceoverselection %> +

+ +

+ Musicselection: + <%= @videolisting.musicselection %> +

+ +

+ Clientprovidedscript: + <%= @videolisting.clientprovidedscript %> +

+ +

+ Keywords: + <%= @videolisting.keywords %> +

+ +

+ Focus: + <%= @videolisting.focus %> +

+ +

+ Notes: + <%= @videolisting.notes %> +

+ +

+ Asseturls: + <%= @videolisting.asseturls %> +

+ +<%= link_to 'Edit', edit_videolisting_path(@videolisting) %> | +<%= link_to 'Back', videolistings_path %> diff --git a/bin/bundle b/bin/bundle new file mode 100755 index 0000000..66e9889 --- /dev/null +++ b/bin/bundle @@ -0,0 +1,3 @@ +#!/usr/bin/env ruby +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +load Gem.bin_path('bundler', 'bundle') diff --git a/bin/delayed_job b/bin/delayed_job new file mode 100755 index 0000000..edf1959 --- /dev/null +++ b/bin/delayed_job @@ -0,0 +1,5 @@ +#!/usr/bin/env ruby + +require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment')) +require 'delayed/command' +Delayed::Command.new(ARGV).daemonize diff --git a/bin/rails b/bin/rails new file mode 100755 index 0000000..728cd85 --- /dev/null +++ b/bin/rails @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +APP_PATH = File.expand_path('../../config/application', __FILE__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/bin/rake b/bin/rake new file mode 100755 index 0000000..1724048 --- /dev/null +++ b/bin/rake @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +require_relative '../config/boot' +require 'rake' +Rake.application.run diff --git a/bin/setup b/bin/setup new file mode 100755 index 0000000..3cfa5af --- /dev/null +++ b/bin/setup @@ -0,0 +1,32 @@ +#!/usr/bin/env sh + +# Set up Rails app. Run this script immediately after cloning the codebase. +# https://github.com/thoughtbot/guides/tree/master/protocol + +# Exit if any subcommand fails +set -e + +# Set up Ruby dependencies via Bundler +bundle install + +# Set up database and add any development seed data +bundle exec rake dev:prime + +# Add binstubs to PATH via export PATH=".git/safe/../../bin:$PATH" in ~/.zshenv +mkdir -p .git/safe + +# Set up configurable environment variables +if [ ! -f .env ]; then + cp .sample.env .env +fi + +# Pick a port for Foreman +echo "port: 7000" > .foreman + +# Set up DNS via Pow +if [ -d ~/.pow ] +then + echo 7000 > ~/.pow/`basename $PWD` +else + echo "Pow not set up but the team uses it for this project. Setup: http://goo.gl/RaDPO" +fi diff --git a/config.ru b/config.ru new file mode 100644 index 0000000..5bc2a61 --- /dev/null +++ b/config.ru @@ -0,0 +1,4 @@ +# This file is used by Rack-based servers to start the application. + +require ::File.expand_path('../config/environment', __FILE__) +run Rails.application diff --git a/config/application.rb b/config/application.rb new file mode 100644 index 0000000..afd3987 --- /dev/null +++ b/config/application.rb @@ -0,0 +1,42 @@ +require File.expand_path('../boot', __FILE__) + +# Pick the frameworks you want: +require "active_record/railtie" +require "action_controller/railtie" +require "action_mailer/railtie" +require "sprockets/railtie" +# require "rails/test_unit/railtie" + +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(:default, Rails.env) + +module Vidpush + class Application < Rails::Application + config.i18n.enforce_available_locales = true + + config.active_record.default_timezone = :utc + + config.generators do |generate| + generate.helper false + generate.javascript_engine false + generate.request_specs false + generate.routing_specs false + generate.stylesheets false + generate.test_framework :rspec + generate.view_specs false + end + + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + # config.time_zone = 'Central Time (US & Canada)' + + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] + # config.i18n.default_locale = :de + end +end diff --git a/config/boot.rb b/config/boot.rb new file mode 100644 index 0000000..3596736 --- /dev/null +++ b/config/boot.rb @@ -0,0 +1,4 @@ +# Set up gems listed in the Gemfile. +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) + +require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) diff --git a/config/database.yml b/config/database.yml new file mode 100644 index 0000000..1e8b3fb --- /dev/null +++ b/config/database.yml @@ -0,0 +1,11 @@ +development: &default + adapter: postgresql + database: vidpush_development + encoding: utf8 + min_messages: warning + pool: 2 + timeout: 5000 + +test: + <<: *default + database: vidpush_test diff --git a/config/environment.rb b/config/environment.rb new file mode 100644 index 0000000..b85d282 --- /dev/null +++ b/config/environment.rb @@ -0,0 +1,5 @@ +# Load the Rails application. +require File.expand_path('../application', __FILE__) + +# Initialize the Rails application. +Vidpush::Application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb new file mode 100644 index 0000000..cebdc14 --- /dev/null +++ b/config/environments/development.rb @@ -0,0 +1,35 @@ +Vidpush::Application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false + + # Do not eager load code on boot. + config.eager_load = false + + # Show full error reports and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Don't care if the mailer can't send. + config.action_mailer.raise_delivery_errors = true + + # Print deprecation notices to the Rails logger. + config.active_support.deprecation = :log + + # Raise an error on page load if there are pending migrations + config.active_record.migration_error = :page_load + + # Debug mode disables concatenation and preprocessing of assets. + # This option may cause significant delays in view rendering with a large + # number of complex assets. + config.assets.debug = true + # Raise an ActionController::UnpermittedParameters exception when + # a parameter is not explcitly permitted but is passed anyway. + config.action_controller.action_on_unpermitted_parameters = :raise + + + config.action_mailer.default_url_options = { host: 'vidpush.local' } +end diff --git a/config/environments/production.rb b/config/environments/production.rb new file mode 100644 index 0000000..b59092f --- /dev/null +++ b/config/environments/production.rb @@ -0,0 +1,89 @@ +require Rails.root.join('config/initializers/smtp') +Vidpush::Application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # Code is not reloaded between requests. + config.cache_classes = true + + # Eager load code on boot. This eager loads most of Rails and + # your application in memory, allowing both thread web servers + # and those relying on copy on write to perform better. + # Rake tasks automatically ignore this option for performance. + config.eager_load = true + + # Full error reports are disabled and caching is turned on. + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Enable Rack::Cache to put a simple HTTP cache in front of your application + # Add `rack-cache` to your Gemfile before enabling this. + # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid. + # config.action_dispatch.rack_cache = true + + # Disable Rails's static asset server (Apache or nginx will already do this). + config.serve_static_assets = false + + # Enable deflate / gzip compression of controller-generated responses + config.middleware.use Rack::Deflater + + # Compress JavaScripts and CSS. + config.assets.js_compressor = :uglifier + # config.assets.css_compressor = :sass + + # Do not fallback to assets pipeline if a precompiled asset is missed. + config.assets.compile = false + + # Generate digests for assets URLs. + config.assets.digest = true + + # Version of your assets, change this if you want to expire all your assets. + config.assets.version = '1.0' + + # Specifies the header that your server uses for sending files. + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # Set to :debug to see everything in the log. + config.log_level = :info + + # Prepend all log lines with the following tags. + # config.log_tags = [ :subdomain, :uuid ] + + # Use a different logger for distributed setups. + # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + + # Use a different cache store in production. + # config.cache_store = :mem_cache_store + + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = "http://assets.example.com" + + # Precompile additional assets. + # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. + # config.assets.precompile += %w( search.js ) + + # Ignore bad email addresses and do not raise email delivery errors. + # Set this to true and configure the email server for immediate delivery to raise delivery errors. + # config.action_mailer.raise_delivery_errors = false + config.action_mailer.delivery_method = :smtp + config.action_mailer.smtp_settings = SMTP_SETTINGS + + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation can not be found). + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners. + config.active_support.deprecation = :notify + + # Disable automatic flushing of the log to improve performance. + # config.autoflush_log = false + + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new + + config.action_mailer.default_url_options = { host: 'vidpush.com' } +end diff --git a/config/environments/staging.rb b/config/environments/staging.rb new file mode 100644 index 0000000..f6025f9 --- /dev/null +++ b/config/environments/staging.rb @@ -0,0 +1,9 @@ +require_relative 'production' + +Mail.register_interceptor RecipientInterceptor.new(ENV['EMAIL_RECIPIENTS']) + +Vidpush::Application.configure do + # ... + + config.action_mailer.default_url_options = { host: 'staging.vidpush.com' } +end diff --git a/config/environments/test.rb b/config/environments/test.rb new file mode 100644 index 0000000..a45941f --- /dev/null +++ b/config/environments/test.rb @@ -0,0 +1,38 @@ +Vidpush::Application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # The test environment is used exclusively to run your application's + # test suite. You never need to work with it otherwise. Remember that + # your test database is "scratch space" for the test suite and is wiped + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = true + + # Do not eager load code on boot. This avoids loading your whole application + # just for the purpose of running a single test. If you are using a tool that + # preloads Rails for running tests, you may have to set it to true. + config.eager_load = false + + # Configure static asset server for tests with Cache-Control for performance. + config.serve_static_assets = true + config.static_cache_control = "public, max-age=3600" + + # Show full error reports and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Raise exceptions instead of rendering exception templates. + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment. + config.action_controller.allow_forgery_protection = false + + # Tell Action Mailer not to deliver emails to the real world. + # The :test delivery method accumulates sent emails in the + # ActionMailer::Base.deliveries array. + config.action_mailer.delivery_method = :test + + # Print deprecation notices to the stderr. + config.active_support.deprecation = :stderr + + config.action_mailer.default_url_options = { host: 'www.example.com' } +end diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb new file mode 100644 index 0000000..59385cd --- /dev/null +++ b/config/initializers/backtrace_silencers.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. +# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } + +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! diff --git a/config/initializers/disable_xml_params.rb b/config/initializers/disable_xml_params.rb new file mode 100644 index 0000000..c24d969 --- /dev/null +++ b/config/initializers/disable_xml_params.rb @@ -0,0 +1,3 @@ +# Protect against injection attacks +# http://www.kb.cert.org/vuls/id/380039 +ActionDispatch::ParamsParser::DEFAULT_PARSERS.delete(Mime::XML) diff --git a/config/initializers/errors.rb b/config/initializers/errors.rb new file mode 100644 index 0000000..7b28e97 --- /dev/null +++ b/config/initializers/errors.rb @@ -0,0 +1,28 @@ +require 'net/http' +require 'net/smtp' + +# Example: +# begin +# some http call +# rescue *HTTP_ERRORS => error +# notify_hoptoad error +# end + +HTTP_ERRORS = [Timeout::Error, + Errno::EINVAL, + Errno::ECONNRESET, + EOFError, + Net::HTTPBadResponse, + Net::HTTPHeaderSyntaxError, + Net::ProtocolError] + +SMTP_SERVER_ERRORS = [TimeoutError, + IOError, + Net::SMTPUnknownError, + Net::SMTPServerBusy, + Net::SMTPAuthenticationError] + +SMTP_CLIENT_ERRORS = [Net::SMTPFatalError, + Net::SMTPSyntaxError] + +SMTP_ERRORS = SMTP_SERVER_ERRORS + SMTP_CLIENT_ERRORS diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb new file mode 100644 index 0000000..4a994e1 --- /dev/null +++ b/config/initializers/filter_parameter_logging.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Configure sensitive parameters which will be filtered from the log file. +Rails.application.config.filter_parameters += [:password] diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb new file mode 100644 index 0000000..ac033bf --- /dev/null +++ b/config/initializers/inflections.rb @@ -0,0 +1,16 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format. Inflections +# are locale specific, and you may define rules for as many different +# locales as you wish. All of these examples are active by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end + +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.acronym 'RESTful' +# end diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb new file mode 100644 index 0000000..72aca7e --- /dev/null +++ b/config/initializers/mime_types.rb @@ -0,0 +1,5 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf +# Mime::Type.register_alias "text/html", :iphone diff --git a/config/initializers/rack_timeout.rb b/config/initializers/rack_timeout.rb new file mode 100644 index 0000000..a446ac0 --- /dev/null +++ b/config/initializers/rack_timeout.rb @@ -0,0 +1 @@ +Rack::Timeout.timeout = (ENV['TIMEOUT_IN_SECONDS'] || 5).to_i diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb new file mode 100644 index 0000000..4f6b444 --- /dev/null +++ b/config/initializers/secret_token.rb @@ -0,0 +1,10 @@ +# Your secret key is used for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! + +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +# You can use `rake secret` to generate a secure secret key. + +# Make sure your secret_key_base is kept private +# if you're sharing your code publicly. +Vidpush::Application.config.secret_key_base = ENV['SECRET_KEY_BASE'] diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb new file mode 100644 index 0000000..959d33f --- /dev/null +++ b/config/initializers/session_store.rb @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +Vidpush::Application.config.session_store :cookie_store, key: '_vidpush_session' diff --git a/config/initializers/smtp.rb b/config/initializers/smtp.rb new file mode 100644 index 0000000..e67d082 --- /dev/null +++ b/config/initializers/smtp.rb @@ -0,0 +1,10 @@ +if Rails.env.staging? || Rails.env.production? + SMTP_SETTINGS = { + address: ENV.fetch('SMTP_ADDRESS'), # example: 'smtp.sendgrid.net' + authentication: :plain, + domain: ENV.fetch('SMTP_DOMAIN'), # example: 'this-app.com' + password: ENV.fetch('SMTP_PASSWORD'), + port: '587', + user_name: ENV.fetch('SMTP_USERNAME') + } +end diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb new file mode 100644 index 0000000..33725e9 --- /dev/null +++ b/config/initializers/wrap_parameters.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. + +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] if respond_to?(:wrap_parameters) +end + +# To enable root element in JSON for ActiveRecord objects. +# ActiveSupport.on_load(:active_record) do +# self.include_root_in_json = true +# end diff --git a/config/locales/en.yml b/config/locales/en.yml new file mode 100644 index 0000000..80d924b --- /dev/null +++ b/config/locales/en.yml @@ -0,0 +1,11 @@ +en: + date: + formats: + default: '%m/%d/%Y' + with_weekday: '%a %m/%d/%y' + + time: + formats: + default: '%a, %b %-d, %Y at %r' + date: '%b %-d, %Y' + short: '%B %d' diff --git a/config/routes.rb b/config/routes.rb new file mode 100644 index 0000000..66e0bb8 --- /dev/null +++ b/config/routes.rb @@ -0,0 +1,6 @@ +Vidpush::Application.routes.draw do + + + resources :campaigns + +end diff --git a/config/unicorn.rb b/config/unicorn.rb new file mode 100644 index 0000000..b156900 --- /dev/null +++ b/config/unicorn.rb @@ -0,0 +1,29 @@ +# https://devcenter.heroku.com/articles/rails-unicorn + +worker_processes (ENV['WEB_CONCURRENCY'] || 3).to_i +timeout (ENV['WEB_TIMEOUT'] || 5).to_i +preload_app true + +before_fork do |server, worker| + Signal.trap 'TERM' do + puts 'Unicorn master intercepting TERM and sending myself QUIT instead' + Process.kill 'QUIT', Process.pid + end + + if defined? ActiveRecord::Base + ActiveRecord::Base.connection.disconnect! + end +end + +after_fork do |server, worker| + Signal.trap 'TERM' do + puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to sent QUIT' + end + + if defined? ActiveRecord::Base + config = Rails.application.config.database_configuration[Rails.env] + config['reaping_frequency'] = (ENV['DB_REAPING_FREQUENCY'] || 10).to_i + config['pool'] = (ENV['DB_POOL'] || 2).to_i + ActiveRecord::Base.establish_connection(config) + end +end diff --git a/db/migrate/20140407172914_create_delayed_jobs.rb b/db/migrate/20140407172914_create_delayed_jobs.rb new file mode 100644 index 0000000..ec0dd93 --- /dev/null +++ b/db/migrate/20140407172914_create_delayed_jobs.rb @@ -0,0 +1,22 @@ +class CreateDelayedJobs < ActiveRecord::Migration + def self.up + create_table :delayed_jobs, :force => true do |table| + table.integer :priority, :default => 0, :null => false # Allows some jobs to jump to the front of the queue + table.integer :attempts, :default => 0, :null => false # Provides for retries, but still fail eventually. + table.text :handler, :null => false # YAML-encoded string of the object that will do work + table.text :last_error # reason for last failure (See Note below) + table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future. + table.datetime :locked_at # Set when a client is working on this object + table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead) + table.string :locked_by # Who is working on this object (if locked) + table.string :queue # The name of the queue this job is in + table.timestamps + end + + add_index :delayed_jobs, [:priority, :run_at], :name => 'delayed_jobs_priority' + end + + def self.down + drop_table :delayed_jobs + end +end diff --git a/db/migrate/20140407180220_create_campaigns.rb b/db/migrate/20140407180220_create_campaigns.rb new file mode 100644 index 0000000..5485305 --- /dev/null +++ b/db/migrate/20140407180220_create_campaigns.rb @@ -0,0 +1,25 @@ +class CreateCampaigns < ActiveRecord::Migration + def change + create_table :campaigns do |t| + t.string :clientid + t.string :listingcode + t.string :billingcode + t.string :advertisername + t.string :address1 + t.string :address2 + t.string :city + t.string :state + t.string :zip + t.string :emailaddress + t.string :customerfirstname + t.string :customerlastname + t.string :salesrep + t.string :salesrepemail + t.string :businessphone + t.string :contactphone + t.string :websiteurl + + t.timestamps + end + end +end diff --git a/db/migrate/20140407180228_create_videolistings.rb b/db/migrate/20140407180228_create_videolistings.rb new file mode 100644 index 0000000..e3b9aab --- /dev/null +++ b/db/migrate/20140407180228_create_videolistings.rb @@ -0,0 +1,18 @@ +class CreateVideolistings < ActiveRecord::Migration + def change + create_table :videolistings do |t| + t.string :videocode + t.string :producttypeid + t.string :remoteassetsarchive + t.string :voiceoverselection + t.string :musicselection + t.string :clientprovidedscript + t.string :keywords + t.string :focus + t.string :notes + t.string :asseturls, array: true, default: [] + + t.timestamps + end + end +end diff --git a/db/migrate/20140407180534_add_campaign_id_to_videolisting.rb b/db/migrate/20140407180534_add_campaign_id_to_videolisting.rb new file mode 100644 index 0000000..bb9747f --- /dev/null +++ b/db/migrate/20140407180534_add_campaign_id_to_videolisting.rb @@ -0,0 +1,5 @@ +class AddCampaignIdToVideolisting < ActiveRecord::Migration + def change + add_column :videolistings, :campaign_id, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 0000000..118bd32 --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,73 @@ +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 20140407180534) do + + # These are extensions that must be enabled in order to support this database + enable_extension "plpgsql" + + create_table "campaigns", force: true do |t| + t.string "clientid" + t.string "listingcode" + t.string "billingcode" + t.string "advertisername" + t.string "address1" + t.string "address2" + t.string "city" + t.string "state" + t.string "zip" + t.string "emailaddress" + t.string "customerfirstname" + t.string "customerlastname" + t.string "salesrep" + t.string "salesrepemail" + t.string "businessphone" + t.string "contactphone" + t.string "websiteurl" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "delayed_jobs", force: true do |t| + t.integer "priority", default: 0, null: false + t.integer "attempts", default: 0, null: false + t.text "handler", null: false + t.text "last_error" + t.datetime "run_at" + t.datetime "locked_at" + t.datetime "failed_at" + t.string "locked_by" + t.string "queue" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority", using: :btree + + create_table "videolistings", force: true do |t| + t.string "videocode" + t.string "producttypeid" + t.string "remoteassetsarchive" + t.string "voiceoverselection" + t.string "musicselection" + t.string "clientprovidedscript" + t.string "keywords" + t.string "focus" + t.string "notes" + t.string "asseturls", default: [], array: true + t.datetime "created_at" + t.datetime "updated_at" + t.integer "campaign_id" + end + +end diff --git a/db/seeds.rb b/db/seeds.rb new file mode 100644 index 0000000..4edb1e8 --- /dev/null +++ b/db/seeds.rb @@ -0,0 +1,7 @@ +# This file should contain all the record creation needed to seed the database with its default values. +# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). +# +# Examples: +# +# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) +# Mayor.create(name: 'Emanuel', city: cities.first) diff --git a/lib/assets/.keep b/lib/assets/.keep new file mode 100644 index 0000000..e69de29 diff --git a/lib/tasks/.keep b/lib/tasks/.keep new file mode 100644 index 0000000..e69de29 diff --git a/lib/tasks/development_seeds.rake b/lib/tasks/development_seeds.rake new file mode 100644 index 0000000..9fd95a3 --- /dev/null +++ b/lib/tasks/development_seeds.rake @@ -0,0 +1,13 @@ +if Rails.env.development? + require 'factory_girl' + + namespace :dev do + desc 'Seed data for development environment' + task prime: 'db:setup' do + FactoryGirl.find_definitions + include FactoryGirl::Syntax::Methods + + # create(:user, email: 'user@example.com', password: 'password') + end + end +end diff --git a/public/404.html b/public/404.html new file mode 100644 index 0000000..ba8390c --- /dev/null +++ b/public/404.html @@ -0,0 +1,59 @@ + + + + + + The page you were looking for doesn't exist (404) + + + + +
+

The page you were looking for doesn't exist.

+

You may have mistyped the address or the page may have moved.

+
+

If you are the application owner check the logs for more information.

+ + diff --git a/public/422.html b/public/422.html new file mode 100644 index 0000000..e1c016d --- /dev/null +++ b/public/422.html @@ -0,0 +1,59 @@ + + + + + + The change you wanted was rejected (422) + + + + +
+

The change you wanted was rejected.

+

Maybe you tried to change something you didn't have access to.

+
+

If you are the application owner check the logs for more information.

+ + diff --git a/public/500.html b/public/500.html new file mode 100644 index 0000000..4279d42 --- /dev/null +++ b/public/500.html @@ -0,0 +1,58 @@ + + + + + + We're sorry, but something went wrong (500) + + + + +
+

We're sorry, but something went wrong.

+
+

If you are the application owner check the logs for more information.

+ + diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..e69de29 diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..1a3a5e4 --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,5 @@ +# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file +# +# To ban all spiders from the entire site uncomment the next two lines: +# User-agent: * +# Disallow: / diff --git a/spec/factories/campaigns.rb b/spec/factories/campaigns.rb new file mode 100644 index 0000000..a1f61f0 --- /dev/null +++ b/spec/factories/campaigns.rb @@ -0,0 +1,23 @@ +# Read about factories at https://github.com/thoughtbot/factory_girl + +FactoryGirl.define do + factory :campaign do + clientid "MyString" + listingcode "MyString" + billingcode "MyString" + advertisername "MyString" + address1 "MyString" + address2 "MyString" + city "MyString" + state "MyString" + zip "MyString" + emailaddress "MyString" + customerfirstname "MyString" + customerlastname "MyString" + salesrep "MyString" + salesrepemail "MyString" + businessphone "MyString" + contactphone "MyString" + websiteurl "MyString" + end +end diff --git a/spec/factories/videolistings.rb b/spec/factories/videolistings.rb new file mode 100644 index 0000000..7e8dbae --- /dev/null +++ b/spec/factories/videolistings.rb @@ -0,0 +1,16 @@ +# Read about factories at https://github.com/thoughtbot/factory_girl + +FactoryGirl.define do + factory :videolisting do + videocode "MyString" + producttypeid "MyString" + remoteassetsarchive "MyString" + voiceoverselection "MyString" + musicselection "MyString" + clientprovidedscript "MyString" + keywords "MyString" + focus "MyString" + notes "MyString" + asseturls ["MyString", "MyString2"] + end +end diff --git a/spec/models/campaign_spec.rb b/spec/models/campaign_spec.rb new file mode 100644 index 0000000..83eb646 --- /dev/null +++ b/spec/models/campaign_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Campaign, 'associations' do + it {should have_many(:videolistings) } +end \ No newline at end of file diff --git a/spec/models/factories_spec.rb b/spec/models/factories_spec.rb new file mode 100644 index 0000000..62c709b --- /dev/null +++ b/spec/models/factories_spec.rb @@ -0,0 +1,13 @@ +require 'spec_helper' + +describe 'factories' do + FactoryGirl.factories.map(&:name).each do |factory_name| + specify "#{factory_name} factory is valid", :factory do + factory = build(factory_name) + + if factory.respond_to?(:valid?) + expect(factory).to be_valid, factory.errors.full_messages.join(',') + end + end + end +end diff --git a/spec/models/videolisting_spec.rb b/spec/models/videolisting_spec.rb new file mode 100644 index 0000000..cc0eb61 --- /dev/null +++ b/spec/models/videolisting_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Videolisting, 'associations' do + it {should belong_to(:campaign) } +end \ No newline at end of file diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..c0cb50f --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,30 @@ +require 'simplecov' +SimpleCov.start 'rails' + +ENV['RAILS_ENV'] = 'test' + +require File.expand_path('../../config/environment', __FILE__) + +require 'rspec/rails' +require 'webmock/rspec' + +Dir[Rails.root.join('spec/support/**/*.rb')].each { |file| require file } + +module Features + # Extend this module in spec/support/features/*.rb +end + +RSpec.configure do |config| + config.expect_with :rspec do |c| + c.syntax = :expect + end + config.treat_symbols_as_metadata_keys_with_true_values = true + + config.include Features, type: :feature + config.infer_base_class_for_anonymous_controllers = false + config.order = 'random' + config.use_transactional_fixtures = false +end + +Capybara.javascript_driver = :webkit +WebMock.disable_net_connect!(allow_localhost: true) diff --git a/spec/support/background_jobs.rb b/spec/support/background_jobs.rb new file mode 100644 index 0000000..14788de --- /dev/null +++ b/spec/support/background_jobs.rb @@ -0,0 +1,19 @@ +module BackgroundJobs + def run_background_jobs_immediately + delay_jobs = Delayed::Worker.delay_jobs + Delayed::Worker.delay_jobs = false + yield + ensure + Delayed::Worker.delay_jobs = delay_jobs + end +end + +RSpec.configure do |config| + config.around(:each, type: :feature) do |example| + run_background_jobs_immediately do + example.run + end + end + + config.include BackgroundJobs +end diff --git a/spec/support/database_cleaner.rb b/spec/support/database_cleaner.rb new file mode 100644 index 0000000..cea35ff --- /dev/null +++ b/spec/support/database_cleaner.rb @@ -0,0 +1,21 @@ +RSpec.configure do |config| + config.before(:suite) do + DatabaseCleaner.clean_with(:deletion) + end + + config.before(:each) do + DatabaseCleaner.strategy = :transaction + end + + config.before(:each, :js => true) do + DatabaseCleaner.strategy = :deletion + end + + config.before(:each) do + DatabaseCleaner.start + end + + config.after(:each) do + DatabaseCleaner.clean + end +end diff --git a/spec/support/factory_girl.rb b/spec/support/factory_girl.rb new file mode 100644 index 0000000..eec437f --- /dev/null +++ b/spec/support/factory_girl.rb @@ -0,0 +1,3 @@ +RSpec.configure do |config| + config.include FactoryGirl::Syntax::Methods +end diff --git a/spec/support/features/.keep b/spec/support/features/.keep new file mode 100644 index 0000000..e69de29 diff --git a/spec/support/i18n.rb b/spec/support/i18n.rb new file mode 100644 index 0000000..3d4094d --- /dev/null +++ b/spec/support/i18n.rb @@ -0,0 +1,3 @@ +RSpec.configure do |config| + config.include AbstractController::Translation +end diff --git a/spec/support/matchers/.keep b/spec/support/matchers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/spec/support/mixins/.keep b/spec/support/mixins/.keep new file mode 100644 index 0000000..e69de29 diff --git a/spec/support/shared_examples/.keep b/spec/support/shared_examples/.keep new file mode 100644 index 0000000..e69de29 diff --git a/vendor/assets/javascripts/.keep b/vendor/assets/javascripts/.keep new file mode 100644 index 0000000..e69de29 diff --git a/vendor/assets/stylesheets/.keep b/vendor/assets/stylesheets/.keep new file mode 100644 index 0000000..e69de29