From ec126793c7cb89159f633ecd7d71f591c47bb032 Mon Sep 17 00:00:00 2001 From: Jonathan Kolyer Date: Sun, 22 Dec 2013 05:22:04 -0600 Subject: [PATCH 01/12] vrfs-927: added new promotional table for home page data --- db/manifest | 2 ++ db/up/home_page_promos.sql | 28 +++++++++++++++ ruby/lib/jam_ruby.rb | 1 + ruby/lib/jam_ruby/models/promotional.rb | 45 +++++++++++++++++++++++++ 4 files changed, 76 insertions(+) create mode 100644 db/up/home_page_promos.sql create mode 100644 ruby/lib/jam_ruby/models/promotional.rb diff --git a/db/manifest b/db/manifest index 6ddf7a6aa..878961343 100755 --- a/db/manifest +++ b/db/manifest @@ -81,3 +81,5 @@ notification_band_invite.sql band_photo_filepicker.sql bands_geocoding.sql store_s3_filenames.sql +home_page_promos.sql + diff --git a/db/up/home_page_promos.sql b/db/up/home_page_promos.sql new file mode 100644 index 000000000..356fc59c8 --- /dev/null +++ b/db/up/home_page_promos.sql @@ -0,0 +1,28 @@ +-- +CREATE TABLE promotionals( + id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4(), + + /* allows for single table inheritance */ + type VARCHAR(128) NOT NULL DEFAULT 'JamRuby::PromoBuzz', + /* state machine */ + aasm_state VARCHAR(64) DEFAULT 'hidden', + /* order of promo within its types */ + position integer NOT NULL DEFAULT 0, + /* optional expiration date */ + expires_at TIMESTAMP DEFAULT NULL, + /* standard AR timestamps */ + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + + /* references latest recording or session polymorphically */ + latest_id VARCHAR(64) DEFAULT NULL, + latest_type VARCHAR(128) DEFAULT NULL, + + /* used for buzz promo type */ + original_fpfile_photo VARCHAR(8000) DEFAULT NULL, + photo_url VARCHAR(2048) DEFAULT NULL, + text_short VARCHAR(512) DEFAULT NULL, + text_long VARCHAR(4096) DEFAULT NULL +); + +CREATE INDEX promo_latest_idx ON promotionals(latest_id, latest_type); diff --git a/ruby/lib/jam_ruby.rb b/ruby/lib/jam_ruby.rb index bf158efb0..c09ed211d 100755 --- a/ruby/lib/jam_ruby.rb +++ b/ruby/lib/jam_ruby.rb @@ -83,6 +83,7 @@ require "jam_ruby/models/mix" require "jam_ruby/models/claimed_recording" require "jam_ruby/models/crash_dump" require "jam_ruby/models/isp_score_batch" +require "jam_ruby/models/promotional" include Jampb diff --git a/ruby/lib/jam_ruby/models/promotional.rb b/ruby/lib/jam_ruby/models/promotional.rb new file mode 100644 index 000000000..ff87d7548 --- /dev/null +++ b/ruby/lib/jam_ruby/models/promotional.rb @@ -0,0 +1,45 @@ +class JamRuby::Promotional < ActiveRecord::Base + self.table_name = :promotionals + self.abstract_class = true + + attr_accessible :expires_at, :position, :aasm_state + + include AASM + HIDDEN_STATE = :hidden + ACTIVE_STATE = :active + EXPIRED_STATE = :expired + + aasm do + state HIDDEN_STATE, :initial => true + state ACTIVE_STATE + state EXPIRED_STATE + + event :activate do + transitions :from => [HIDDEN_STATE, EXPIRED_STATE], :to => ACTIVE_STATE + end + + event :expire do + transitions :from => [HIDDEN_STATE, ACTIVE_STATE], :to => EXPIRED_STATE + end + + event :hide do + transitions :from => [HIDDEN_STATE, ACTIVE_STATE], :to => HIDDEN_STATE + end + + end + + def state + aasm_state + end + +end + +class JamRuby::PromoBuzz < JamRuby::Promotional + attr_accessible :original_fpfile_photo, :photo_url, :text_short, :text_long + +end + +class JamRuby::PromoLatest < JamRuby::Promotional + belongs_to :latest, :polymorphic => true + +end From 7212f20a0f1b1d0e17ae1d1659b0b4bd7f7403ee Mon Sep 17 00:00:00 2001 From: Jonathan Kolyer Date: Sun, 22 Dec 2013 10:19:39 -0600 Subject: [PATCH 02/12] vrfs-927: admin editing buzz promotions --- admin/app/admin/promo_buzz.rb | 113 ++++++++++++++++++++++++ admin/app/admin/promo_latest.rb | 85 ++++++++++++++++++ admin/app/admin/user_progression.rb | 24 ++--- db/up/home_page_promos.sql | 2 - ruby/lib/jam_ruby/models/promotional.rb | 13 +++ 5 files changed, 223 insertions(+), 14 deletions(-) create mode 100644 admin/app/admin/promo_buzz.rb create mode 100644 admin/app/admin/promo_latest.rb diff --git a/admin/app/admin/promo_buzz.rb b/admin/app/admin/promo_buzz.rb new file mode 100644 index 000000000..d3c812d0c --- /dev/null +++ b/admin/app/admin/promo_buzz.rb @@ -0,0 +1,113 @@ +ActiveAdmin.register JamRuby::PromoBuzz, :as => 'Buzz' do + + menu :label => 'Home Page Buzz' + + config.sort_order = 'position ASC aasm_state DESC created_at DESC' + config.batch_actions = false + # config.clear_action_items! + config.filters = false + + form :partial => 'form' + + # index do + # column :email do |user| link_to(truncate(user.email, {:length => 12}), resource_path(user), {:title => "#{user.first_name} #{user.last_name} (#{user.email})"}) end + # column :updated_at do |uu| uu.updated_at.strftime(DATE_FORMAT) end + # column :created_at do |uu| uu.created_at.strftime(DATE_FORMAT) end + # column :city + # column :musician + # column 'Client DL' do |uu| + # if dd = uu.first_downloaded_client_at + # dd.strftime(DATE_FORMAT) + # else + # '' + # end + # end + # column 'Client Run' do |uu| + # if dd = uu.first_ran_client_at + # dd.strftime(DATE_FORMAT) + # else + # '' + # end + # end + # column 'Certified Gear' do |uu| + # if dd = uu.first_certified_gear_at + # dd.strftime(DATE_FORMAT) + # else + # '' + # end + # end + # column 'Any Session' do |uu| + # if dd = uu.first_music_session_at + # dd.strftime(DATE_FORMAT) + # else + # '' + # end + # end + # column 'Real Session' do |uu| + # if dd = uu.first_real_music_session_at + # dd.strftime(DATE_FORMAT) + # else + # '' + # end + # end + # column 'Good Session' do |uu| + # if dd = uu.first_good_music_session_at + # dd.strftime(DATE_FORMAT) + # else + # '' + # end + # end + # column 'Invited' do |uu| + # if dd = uu.first_invited_at + # dd.strftime(DATE_FORMAT) + # else + # '' + # end + # end + # column 'Friended' do |uu| + # if dd = uu.first_friended_at + # dd.strftime(DATE_FORMAT) + # else + # '' + # end + # end + # column 'Promoted' do |uu| + # if dd = uu.first_social_promoted_at + # dd.strftime(DATE_FORMAT) + # else + # '' + # end + # end + # column 'Recorded' do |uu| + # uu.first_recording_at + # end + + # end + + show do + attributes_table do + row :text_short + row :text_long + row 'Status' do |obj| obj.aasm_state end + # row :image do + # image_tag(ad.image.url) + # end + end + end + + controller do + + def new + @promo = JamRuby::PromoBuzz.new + @promo.aasm_state = 'active' + super + end + + def create + promo = PromoBuzz.create_with_params(params[:jam_ruby_promo_buzz]) + super + end + + end + +end diff --git a/admin/app/admin/promo_latest.rb b/admin/app/admin/promo_latest.rb new file mode 100644 index 000000000..5e8435882 --- /dev/null +++ b/admin/app/admin/promo_latest.rb @@ -0,0 +1,85 @@ +ActiveAdmin.register JamRuby::PromoLatest, :as => 'Latest' do + + menu :label => 'Home Page Latest' + + config.sort_order = 'position ASC aasm_state DESC created_at DESC' + config.batch_actions = false + # config.clear_action_items! + config.filters = false + + # index do + # column :email do |user| link_to(truncate(user.email, {:length => 12}), resource_path(user), {:title => "#{user.first_name} #{user.last_name} (#{user.email})"}) end + # column :updated_at do |uu| uu.updated_at.strftime(DATE_FORMAT) end + # column :created_at do |uu| uu.created_at.strftime(DATE_FORMAT) end + # column :city + # column :musician + # column 'Client DL' do |uu| + # if dd = uu.first_downloaded_client_at + # dd.strftime(DATE_FORMAT) + # else + # '' + # end + # end + # column 'Client Run' do |uu| + # if dd = uu.first_ran_client_at + # dd.strftime(DATE_FORMAT) + # else + # '' + # end + # end + # column 'Certified Gear' do |uu| + # if dd = uu.first_certified_gear_at + # dd.strftime(DATE_FORMAT) + # else + # '' + # end + # end + # column 'Any Session' do |uu| + # if dd = uu.first_music_session_at + # dd.strftime(DATE_FORMAT) + # else + # '' + # end + # end + # column 'Real Session' do |uu| + # if dd = uu.first_real_music_session_at + # dd.strftime(DATE_FORMAT) + # else + # '' + # end + # end + # column 'Good Session' do |uu| + # if dd = uu.first_good_music_session_at + # dd.strftime(DATE_FORMAT) + # else + # '' + # end + # end + # column 'Invited' do |uu| + # if dd = uu.first_invited_at + # dd.strftime(DATE_FORMAT) + # else + # '' + # end + # end + # column 'Friended' do |uu| + # if dd = uu.first_friended_at + # dd.strftime(DATE_FORMAT) + # else + # '' + # end + # end + # column 'Promoted' do |uu| + # if dd = uu.first_social_promoted_at + # dd.strftime(DATE_FORMAT) + # else + # '' + # end + # end + # column 'Recorded' do |uu| + # uu.first_recording_at + # end + + # end + +end diff --git a/admin/app/admin/user_progression.rb b/admin/app/admin/user_progression.rb index 5f6e12ec0..0ae1413c2 100644 --- a/admin/app/admin/user_progression.rb +++ b/admin/app/admin/user_progression.rb @@ -1,5 +1,5 @@ ActiveAdmin.register JamRuby::User, :as => 'User Progression' do - DATE_FORMAT = '%Y-%m-%d %H:%M' + PROGRESSION_DATE = '%Y-%m-%d %H:%M' menu :label => 'User Progression' @@ -10,69 +10,69 @@ ActiveAdmin.register JamRuby::User, :as => 'User Progression' do index do column :email do |user| link_to(truncate(user.email, {:length => 12}), resource_path(user), {:title => "#{user.first_name} #{user.last_name} (#{user.email})"}) end - column :updated_at do |uu| uu.updated_at.strftime(DATE_FORMAT) end - column :created_at do |uu| uu.created_at.strftime(DATE_FORMAT) end + column :updated_at do |uu| uu.updated_at.strftime(PROGRESSION_DATE) end + column :created_at do |uu| uu.created_at.strftime(PROGRESSION_DATE) end column :city column :musician column 'Client DL' do |uu| if dd = uu.first_downloaded_client_at - dd.strftime(DATE_FORMAT) + dd.strftime(PROGRESSION_DATE) else '' end end column 'Client Run' do |uu| if dd = uu.first_ran_client_at - dd.strftime(DATE_FORMAT) + dd.strftime(PROGRESSION_DATE) else '' end end column 'Certified Gear' do |uu| if dd = uu.first_certified_gear_at - dd.strftime(DATE_FORMAT) + dd.strftime(PROGRESSION_DATE) else '' end end column 'Any Session' do |uu| if dd = uu.first_music_session_at - dd.strftime(DATE_FORMAT) + dd.strftime(PROGRESSION_DATE) else '' end end column 'Real Session' do |uu| if dd = uu.first_real_music_session_at - dd.strftime(DATE_FORMAT) + dd.strftime(PROGRESSION_DATE) else '' end end column 'Good Session' do |uu| if dd = uu.first_good_music_session_at - dd.strftime(DATE_FORMAT) + dd.strftime(PROGRESSION_DATE) else '' end end column 'Invited' do |uu| if dd = uu.first_invited_at - dd.strftime(DATE_FORMAT) + dd.strftime(PROGRESSION_DATE) else '' end end column 'Friended' do |uu| if dd = uu.first_friended_at - dd.strftime(DATE_FORMAT) + dd.strftime(PROGRESSION_DATE) else '' end end column 'Promoted' do |uu| if dd = uu.first_social_promoted_at - dd.strftime(DATE_FORMAT) + dd.strftime(PROGRESSION_DATE) else '' end diff --git a/db/up/home_page_promos.sql b/db/up/home_page_promos.sql index 356fc59c8..c4c73f913 100644 --- a/db/up/home_page_promos.sql +++ b/db/up/home_page_promos.sql @@ -8,8 +8,6 @@ CREATE TABLE promotionals( aasm_state VARCHAR(64) DEFAULT 'hidden', /* order of promo within its types */ position integer NOT NULL DEFAULT 0, - /* optional expiration date */ - expires_at TIMESTAMP DEFAULT NULL, /* standard AR timestamps */ created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, diff --git a/ruby/lib/jam_ruby/models/promotional.rb b/ruby/lib/jam_ruby/models/promotional.rb index ff87d7548..a48312516 100644 --- a/ruby/lib/jam_ruby/models/promotional.rb +++ b/ruby/lib/jam_ruby/models/promotional.rb @@ -8,6 +8,7 @@ class JamRuby::Promotional < ActiveRecord::Base HIDDEN_STATE = :hidden ACTIVE_STATE = :active EXPIRED_STATE = :expired + STATES = [HIDDEN_STATE, ACTIVE_STATE, EXPIRED_STATE] aasm do state HIDDEN_STATE, :initial => true @@ -37,6 +38,18 @@ end class JamRuby::PromoBuzz < JamRuby::Promotional attr_accessible :original_fpfile_photo, :photo_url, :text_short, :text_long + def self.create_with_params(params) + obj = self.new + obj.text_short = params[:text_short] + obj.text_long = params[:text_long] + obj.save! + obj + end + + def admin_title + "Buzz #{created_at.strftime('%Y-%m-%d %H-%M')}" + end + end class JamRuby::PromoLatest < JamRuby::Promotional From 4c9d2f0c2963bb71c2fed2d78290e7a8c3aa1477 Mon Sep 17 00:00:00 2001 From: Jonathan Kolyer Date: Sat, 4 Jan 2014 03:10:58 -0600 Subject: [PATCH 03/12] vrfs-927: carrierwave integration fixes --- ruby/Gemfile | 2 ++ ruby/lib/jam_ruby.rb | 1 + ruby/lib/jam_ruby/models/promotional.rb | 13 +++++++++++-- ruby/spec/factories.rb | 7 +++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ruby/Gemfile b/ruby/Gemfile index 67fa507f4..768695548 100644 --- a/ruby/Gemfile +++ b/ruby/Gemfile @@ -20,6 +20,7 @@ gem 'actionmailer', '3.2.13' gem 'sendgrid' gem 'aws-sdk', '1.29.1' gem 'carrierwave' +gem 'carrierwave_direct' gem 'aasm', '3.0.16' gem 'devise', '>= 1.1.2' gem 'postgres-copy' @@ -41,6 +42,7 @@ group :test do gem 'spork', '0.9.0' gem 'database_cleaner', '0.7.0' gem 'rest-client' + gem 'faker' end # Specify your gem's dependencies in jam_ruby.gemspec diff --git a/ruby/lib/jam_ruby.rb b/ruby/lib/jam_ruby.rb index c09ed211d..a2235ad27 100755 --- a/ruby/lib/jam_ruby.rb +++ b/ruby/lib/jam_ruby.rb @@ -2,6 +2,7 @@ require "pg" require "active_record" require "carrierwave" require "carrierwave/orm/activerecord" +require "carrierwave_direct" require "jampb" require "uuidtools" require "logging" diff --git a/ruby/lib/jam_ruby/models/promotional.rb b/ruby/lib/jam_ruby/models/promotional.rb index a48312516..20d83f1d0 100644 --- a/ruby/lib/jam_ruby/models/promotional.rb +++ b/ruby/lib/jam_ruby/models/promotional.rb @@ -36,8 +36,8 @@ class JamRuby::Promotional < ActiveRecord::Base end class JamRuby::PromoBuzz < JamRuby::Promotional - attr_accessible :original_fpfile_photo, :photo_url, :text_short, :text_long - + attr_accessible :image, :text_short, :text_long + def self.create_with_params(params) obj = self.new obj.text_short = params[:text_short] @@ -50,6 +50,15 @@ class JamRuby::PromoBuzz < JamRuby::Promotional "Buzz #{created_at.strftime('%Y-%m-%d %H-%M')}" end + def image_name + fn = image ? image.path || image.filename : nil + File.basename(fn) if fn + end + + def image_url + self.image.direct_fog_url(with_path: true) + end + end class JamRuby::PromoLatest < JamRuby::Promotional diff --git a/ruby/spec/factories.rb b/ruby/spec/factories.rb index dbb845cc5..285dd5ad5 100644 --- a/ruby/spec/factories.rb +++ b/ruby/spec/factories.rb @@ -1,3 +1,5 @@ +require 'faker' + FactoryGirl.define do factory :user, :class => JamRuby::User do sequence(:email) { |n| "person_#{n}@example.com"} @@ -132,4 +134,9 @@ FactoryGirl.define do sequence(:lng) { |n| [-78.85029, -122.4155311][(n-1).modulo(2)] } end + factory :promo_buzz, :class => JamRuby::PromoBuzz do + text_short Faker::Lorem.sentence + text_long Faker::Lorem.paragraphs(3).join("\n") + end + end From b731bd84e0c6c732b52c1e8b4f4f721505d0dd2c Mon Sep 17 00:00:00 2001 From: Jonathan Kolyer Date: Sat, 4 Jan 2014 03:11:31 -0600 Subject: [PATCH 04/12] vrfs-927: updated db cols for carrierwave integration --- db/up/home_page_promos.sql | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/db/up/home_page_promos.sql b/db/up/home_page_promos.sql index c4c73f913..9c0419b34 100644 --- a/db/up/home_page_promos.sql +++ b/db/up/home_page_promos.sql @@ -17,8 +17,7 @@ CREATE TABLE promotionals( latest_type VARCHAR(128) DEFAULT NULL, /* used for buzz promo type */ - original_fpfile_photo VARCHAR(8000) DEFAULT NULL, - photo_url VARCHAR(2048) DEFAULT NULL, + image VARCHAR(1024) DEFAULT NULL, text_short VARCHAR(512) DEFAULT NULL, text_long VARCHAR(4096) DEFAULT NULL ); From 9e4995a55baec889b7e64e8cc651e00c29482d4d Mon Sep 17 00:00:00 2001 From: Jonathan Kolyer Date: Sat, 4 Jan 2014 03:15:19 -0600 Subject: [PATCH 05/12] vrfs-927: carrrierwave integration --- admin/Gemfile | 1 + admin/app/admin/promo_buzz.rb | 11 +++++++++++ admin/app/uploaders/image_uploader.rb | 15 +++++++++++++++ admin/app/views/admin/buzzs/_form.html.erb | 16 ++++++++++++++++ admin/config/application.rb | 3 ++- .../config/initializers/jam_ruby/promotional.rb | 3 +++ 6 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 admin/app/uploaders/image_uploader.rb create mode 100644 admin/app/views/admin/buzzs/_form.html.erb create mode 100644 admin/config/initializers/jam_ruby/promotional.rb diff --git a/admin/Gemfile b/admin/Gemfile index 0dfe6961f..048e1a87d 100644 --- a/admin/Gemfile +++ b/admin/Gemfile @@ -34,6 +34,7 @@ end gem 'will_paginate', '3.0.3' gem 'bootstrap-will_paginate', '0.0.6' gem 'carrierwave', '0.9.0' +gem 'carrierwave_direct' gem 'uuidtools', '2.1.2' gem 'bcrypt-ruby', '3.0.1' gem 'jquery-rails', '2.3.0' # pinned because jquery-ui-rails was split from jquery-rails, but activeadmin doesn't support this gem yet diff --git a/admin/app/admin/promo_buzz.rb b/admin/app/admin/promo_buzz.rb index d3c812d0c..741af4af1 100644 --- a/admin/app/admin/promo_buzz.rb +++ b/admin/app/admin/promo_buzz.rb @@ -100,6 +100,8 @@ ActiveAdmin.register JamRuby::PromoBuzz, :as => 'Buzz' do def new @promo = JamRuby::PromoBuzz.new @promo.aasm_state = 'active' + @uploader = @promo.image + # @uploader.success_action_redirect = new_painting_url super end @@ -108,6 +110,15 @@ ActiveAdmin.register JamRuby::PromoBuzz, :as => 'Buzz' do super end + def edit + @promo = resource + super + end + + def update + super + end + end end diff --git a/admin/app/uploaders/image_uploader.rb b/admin/app/uploaders/image_uploader.rb new file mode 100644 index 000000000..82008cbc5 --- /dev/null +++ b/admin/app/uploaders/image_uploader.rb @@ -0,0 +1,15 @@ +# encoding: utf-8 + +class ImageUploader < CarrierWave::Uploader::Base + include CarrierWaveDirect::Uploader + + include CarrierWave::MimeTypes + process :set_content_type + storage :fog + + # Add a white list of extensions which are allowed to be uploaded. + def extension_white_list + %w(jpg jpeg gif png) + end + +end diff --git a/admin/app/views/admin/buzzs/_form.html.erb b/admin/app/views/admin/buzzs/_form.html.erb new file mode 100644 index 000000000..bf64b25d6 --- /dev/null +++ b/admin/app/views/admin/buzzs/_form.html.erb @@ -0,0 +1,16 @@ +<%= semantic_form_for([:admin, @promo], :html => {:multipart => true}, :url => @promo.new_record? ? admin_buzzs_path : admin_buzzs_path(@promo)) do |f| %> + <%= f.inputs do %> + <%= hidden_field_tag :referring_url, URI::encode(request.referrer) %> + <%= f.input(:text_short, :label => "Short Text", :input_html => {:maxlength => 512}) %> + <%= f.input(:text_long, :label => "Long Text", :input_html => {:rows => 3, :maxlength => 4096}) %> + <%= f.input(:aasm_state, :as => :select, :collection => Promotional::STATES, :label => 'Status') %> +

File: <%= @promo.image_name %>

+ <% # = f.hidden_field :key %> + <% # = f.input(:photo, :as => :file, :hint => f.template.image_tag(@promo.image_url(:thumb), :size => '50x50')) if @promo.new_record? %> + <% end %> + <%= f.actions %> +<% end %> +<%= direct_upload_form_for @uploader do |f| %> +

<%= f.file_field :image %>

+

<%= f.submit "Upload Image" %>

+<% end %> diff --git a/admin/config/application.rb b/admin/config/application.rb index 92b12cdd3..75bebc077 100644 --- a/admin/config/application.rb +++ b/admin/config/application.rb @@ -76,7 +76,8 @@ module JamAdmin config.assets.precompile += ['active_admin.css', 'active_admin.js', 'active_admin/print.css'] # set to false to instead use amazon. You will also need to supply amazon secrets - config.store_artifacts_to_disk = true + config.store_artifacts_to_disk = false + config.storage_type = :fog # these only need to be set if store_artifact_to_files = false config.aws_artifact_access_key_id = ENV['AWS_KEY'] diff --git a/admin/config/initializers/jam_ruby/promotional.rb b/admin/config/initializers/jam_ruby/promotional.rb new file mode 100644 index 000000000..7d58bf09d --- /dev/null +++ b/admin/config/initializers/jam_ruby/promotional.rb @@ -0,0 +1,3 @@ +class JamRuby::PromoBuzz < JamRuby::Promotional + mount_uploader :image, ImageUploader +end From c94537da62529417996fc4784c3ee5514197726e Mon Sep 17 00:00:00 2001 From: Jonathan Kolyer Date: Sat, 4 Jan 2014 03:22:29 -0600 Subject: [PATCH 06/12] vrfs-927: added carrierwave-direct --- web/Gemfile | 1 + websocket-gateway/Gemfile | 1 + 2 files changed, 2 insertions(+) diff --git a/web/Gemfile b/web/Gemfile index 0f5f3066e..422ed0da6 100644 --- a/web/Gemfile +++ b/web/Gemfile @@ -46,6 +46,7 @@ gem 'filepicker-rails', '0.1.0' gem 'aws-sdk', '1.29.1' gem 'aasm', '3.0.16' gem 'carrierwave' +gem 'carrierwave_direct' gem 'fog' gem 'unf' #optional fog dependency gem 'devise', '>= 1.1.2' diff --git a/websocket-gateway/Gemfile b/websocket-gateway/Gemfile index 301837131..33f9f524f 100644 --- a/websocket-gateway/Gemfile +++ b/websocket-gateway/Gemfile @@ -31,6 +31,7 @@ gem 'sendgrid' gem 'rb-readline' gem 'aasm', '3.0.16' gem 'carrierwave' +gem 'carrierwave_direct' gem 'devise' gem 'postgres-copy' gem 'aws-sdk', '1.29.1' From bb2024fe197180e8f0681c2ba3fbf7152e223ebd Mon Sep 17 00:00:00 2001 From: Jonathan Kolyer Date: Wed, 8 Jan 2014 01:04:17 -0600 Subject: [PATCH 07/12] vrfs-927: carrierwave_direct integration --- admin/app/admin/promo_buzz.rb | 3 ++- admin/app/uploaders/image_uploader.rb | 1 - admin/app/views/admin/buzzs/_form.html.erb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/admin/app/admin/promo_buzz.rb b/admin/app/admin/promo_buzz.rb index 741af4af1..e87d85e33 100644 --- a/admin/app/admin/promo_buzz.rb +++ b/admin/app/admin/promo_buzz.rb @@ -99,9 +99,10 @@ ActiveAdmin.register JamRuby::PromoBuzz, :as => 'Buzz' do def new @promo = JamRuby::PromoBuzz.new + @promo.key = params[:key] if params[:key].present? @promo.aasm_state = 'active' @uploader = @promo.image - # @uploader.success_action_redirect = new_painting_url + @uploader.success_action_redirect = new_admin_buzz_url super end diff --git a/admin/app/uploaders/image_uploader.rb b/admin/app/uploaders/image_uploader.rb index 82008cbc5..bde053642 100644 --- a/admin/app/uploaders/image_uploader.rb +++ b/admin/app/uploaders/image_uploader.rb @@ -5,7 +5,6 @@ class ImageUploader < CarrierWave::Uploader::Base include CarrierWave::MimeTypes process :set_content_type - storage :fog # Add a white list of extensions which are allowed to be uploaded. def extension_white_list diff --git a/admin/app/views/admin/buzzs/_form.html.erb b/admin/app/views/admin/buzzs/_form.html.erb index bf64b25d6..cffb5c38e 100644 --- a/admin/app/views/admin/buzzs/_form.html.erb +++ b/admin/app/views/admin/buzzs/_form.html.erb @@ -5,7 +5,7 @@ <%= f.input(:text_long, :label => "Long Text", :input_html => {:rows => 3, :maxlength => 4096}) %> <%= f.input(:aasm_state, :as => :select, :collection => Promotional::STATES, :label => 'Status') %>

File: <%= @promo.image_name %>

- <% # = f.hidden_field :key %> + <%= f.hidden_field :key %> <% # = f.input(:photo, :as => :file, :hint => f.template.image_tag(@promo.image_url(:thumb), :size => '50x50')) if @promo.new_record? %> <% end %> <%= f.actions %> From 4b85863a339e798e7d3c120aa3701b86199864bc Mon Sep 17 00:00:00 2001 From: Jonathan Kolyer Date: Wed, 8 Jan 2014 18:00:22 -0600 Subject: [PATCH 08/12] vrfs-927: buzz admin fixes --- admin/app/admin/promo_buzz.rb | 100 +++++---------------- admin/app/admin/user_progression.rb | 2 +- admin/app/views/admin/buzzs/_form.html.erb | 20 +++-- admin/config/application.rb | 3 + ruby/Gemfile | 1 - web/Gemfile | 1 - web/config/application.rb | 7 +- websocket-gateway/Gemfile | 1 - 8 files changed, 41 insertions(+), 94 deletions(-) diff --git a/admin/app/admin/promo_buzz.rb b/admin/app/admin/promo_buzz.rb index e87d85e33..e3d0035b1 100644 --- a/admin/app/admin/promo_buzz.rb +++ b/admin/app/admin/promo_buzz.rb @@ -2,96 +2,35 @@ ActiveAdmin.register JamRuby::PromoBuzz, :as => 'Buzz' do menu :label => 'Home Page Buzz' - config.sort_order = 'position ASC aasm_state DESC created_at DESC' + config.sort_order = 'position ASC aasm_state DESC updated_at DESC' config.batch_actions = false # config.clear_action_items! config.filters = false form :partial => 'form' - # index do - # column :email do |user| link_to(truncate(user.email, {:length => 12}), resource_path(user), {:title => "#{user.first_name} #{user.last_name} (#{user.email})"}) end - # column :updated_at do |uu| uu.updated_at.strftime(DATE_FORMAT) end - # column :created_at do |uu| uu.created_at.strftime(DATE_FORMAT) end - # column :city - # column :musician - # column 'Client DL' do |uu| - # if dd = uu.first_downloaded_client_at - # dd.strftime(DATE_FORMAT) - # else - # '' - # end - # end - # column 'Client Run' do |uu| - # if dd = uu.first_ran_client_at - # dd.strftime(DATE_FORMAT) - # else - # '' - # end - # end - # column 'Certified Gear' do |uu| - # if dd = uu.first_certified_gear_at - # dd.strftime(DATE_FORMAT) - # else - # '' - # end - # end - # column 'Any Session' do |uu| - # if dd = uu.first_music_session_at - # dd.strftime(DATE_FORMAT) - # else - # '' - # end - # end - # column 'Real Session' do |uu| - # if dd = uu.first_real_music_session_at - # dd.strftime(DATE_FORMAT) - # else - # '' - # end - # end - # column 'Good Session' do |uu| - # if dd = uu.first_good_music_session_at - # dd.strftime(DATE_FORMAT) - # else - # '' - # end - # end - # column 'Invited' do |uu| - # if dd = uu.first_invited_at - # dd.strftime(DATE_FORMAT) - # else - # '' - # end - # end - # column 'Friended' do |uu| - # if dd = uu.first_friended_at - # dd.strftime(DATE_FORMAT) - # else - # '' - # end - # end - # column 'Promoted' do |uu| - # if dd = uu.first_social_promoted_at - # dd.strftime(DATE_FORMAT) - # else - # '' - # end - # end - # column 'Recorded' do |uu| - # uu.first_recording_at - # end - - # end + index do + column 'Short Text' do |pp| pp.text_short end + column 'Image' do |pp| + image_tag(pp.image_url, :size => '50x50') + end + column 'Long Text' do |pp| pp.text_long[0..256] end + column 'State' do |pp| pp.aasm_state end + column 'Position' do |pp| pp.position end + column 'Updated' do |pp| pp.updated_at end + default_actions + end show do attributes_table do row :text_short row :text_long - row 'Status' do |obj| obj.aasm_state end - # row :image do - # image_tag(ad.image.url) - # end + row :image do |obj| + image_tag(obj.image_url, :size => '50x50') + end + row 'State' do |obj| obj.aasm_state end + row 'Position' do |obj| obj.position end + row 'Updated' do |obj| obj.updated_at end end end @@ -113,6 +52,9 @@ ActiveAdmin.register JamRuby::PromoBuzz, :as => 'Buzz' do def edit @promo = resource + @promo.key = params[:key] if params[:key].present? && params[:key] != @promo.key + @uploader = @promo.image + @uploader.success_action_redirect = edit_admin_buzz_url(@promo) super end diff --git a/admin/app/admin/user_progression.rb b/admin/app/admin/user_progression.rb index 0ae1413c2..ab8f73c84 100644 --- a/admin/app/admin/user_progression.rb +++ b/admin/app/admin/user_progression.rb @@ -1,5 +1,5 @@ ActiveAdmin.register JamRuby::User, :as => 'User Progression' do - PROGRESSION_DATE = '%Y-%m-%d %H:%M' + PROGRESSION_DATE = '%Y-%m-%d %H:%M' unless defined?(PROGRESSION_DATE) menu :label => 'User Progression' diff --git a/admin/app/views/admin/buzzs/_form.html.erb b/admin/app/views/admin/buzzs/_form.html.erb index cffb5c38e..96d6b7b83 100644 --- a/admin/app/views/admin/buzzs/_form.html.erb +++ b/admin/app/views/admin/buzzs/_form.html.erb @@ -1,16 +1,20 @@ -<%= semantic_form_for([:admin, @promo], :html => {:multipart => true}, :url => @promo.new_record? ? admin_buzzs_path : admin_buzzs_path(@promo)) do |f| %> +<% unless @promo.image_name.present? %> + <%= direct_upload_form_for @uploader do |f| %> +

<%= f.file_field :image %>

+

<%= f.submit "Upload Image" %>

+ <% end %> +<% end %> +<%= semantic_form_for([:admin, @promo], :html => {:multipart => true}, :url => @promo.new_record? ? admin_buzzs_path : "/admin/buzzs/#{@promo.id}") do |f| %> <%= f.inputs do %> - <%= hidden_field_tag :referring_url, URI::encode(request.referrer) %> <%= f.input(:text_short, :label => "Short Text", :input_html => {:maxlength => 512}) %> <%= f.input(:text_long, :label => "Long Text", :input_html => {:rows => 3, :maxlength => 4096}) %> + <%= f.input(:position, :label => "Position", :input_html => {:maxlength => 4}) %> <%= f.input(:aasm_state, :as => :select, :collection => Promotional::STATES, :label => 'Status') %> -

File: <%= @promo.image_name %>

+ Image File: <%= @promo.image_name %> <%= f.hidden_field :key %> <% # = f.input(:photo, :as => :file, :hint => f.template.image_tag(@promo.image_url(:thumb), :size => '50x50')) if @promo.new_record? %> <% end %> - <%= f.actions %> -<% end %> -<%= direct_upload_form_for @uploader do |f| %> -

<%= f.file_field :image %>

-

<%= f.submit "Upload Image" %>

+ <% if @promo.image_name.present? %> + <%= f.actions %> + <% end %> <% end %> diff --git a/admin/config/application.rb b/admin/config/application.rb index 75bebc077..f3b218211 100644 --- a/admin/config/application.rb +++ b/admin/config/application.rb @@ -86,5 +86,8 @@ module JamAdmin config.aws_artifact_bucket_public = 'jamkazam-dev-public' config.aws_artifact_bucket = 'jamkazam-dev' config.aws_artifact_cache = '315576000' + + # for carrierwave_direct + config.action_controller.allow_forgery_protection = false end end diff --git a/ruby/Gemfile b/ruby/Gemfile index 768695548..19c5f3743 100644 --- a/ruby/Gemfile +++ b/ruby/Gemfile @@ -20,7 +20,6 @@ gem 'actionmailer', '3.2.13' gem 'sendgrid' gem 'aws-sdk', '1.29.1' gem 'carrierwave' -gem 'carrierwave_direct' gem 'aasm', '3.0.16' gem 'devise', '>= 1.1.2' gem 'postgres-copy' diff --git a/web/Gemfile b/web/Gemfile index 422ed0da6..0f5f3066e 100644 --- a/web/Gemfile +++ b/web/Gemfile @@ -46,7 +46,6 @@ gem 'filepicker-rails', '0.1.0' gem 'aws-sdk', '1.29.1' gem 'aasm', '3.0.16' gem 'carrierwave' -gem 'carrierwave_direct' gem 'fog' gem 'unf' #optional fog dependency gem 'devise', '>= 1.1.2' diff --git a/web/config/application.rb b/web/config/application.rb index 6d5e6d5ec..48f2807c5 100644 --- a/web/config/application.rb +++ b/web/config/application.rb @@ -105,8 +105,8 @@ if defined?(Bundler) config.websocket_gateway_connect_time_stale = 2 config.websocket_gateway_connect_time_expire = 5 else - config.websocket_gateway_connect_time_stale = 6 - config.websocket_gateway_connect_time_expire = 10 + config.websocket_gateway_connect_time_stale = 300 + config.websocket_gateway_connect_time_expire = 6000 end config.websocket_gateway_internal_debug = false config.websocket_gateway_port = 6767 @@ -116,7 +116,8 @@ if defined?(Bundler) # set this to false if you want to disable signups (lock down public user creation) config.signup_enabled = true - config.storage_type = :file # or :fog, if using AWS + config.storage_type = :fog + # config.storage_type = :file # or :fog, if using AWS # these only used if storage_type = :fog config.aws_access_key_id = ENV['AWS_KEY'] diff --git a/websocket-gateway/Gemfile b/websocket-gateway/Gemfile index 33f9f524f..301837131 100644 --- a/websocket-gateway/Gemfile +++ b/websocket-gateway/Gemfile @@ -31,7 +31,6 @@ gem 'sendgrid' gem 'rb-readline' gem 'aasm', '3.0.16' gem 'carrierwave' -gem 'carrierwave_direct' gem 'devise' gem 'postgres-copy' gem 'aws-sdk', '1.29.1' From 785817d29936085e0ba34f0f691305517919ee79 Mon Sep 17 00:00:00 2001 From: Jonathan Kolyer Date: Wed, 8 Jan 2014 18:38:04 -0600 Subject: [PATCH 09/12] vrfs-927: added initial promo latest support --- admin/app/admin/promo_latest.rb | 115 +++++++------------ admin/app/views/admin/latests/_form.html.erb | 7 ++ ruby/lib/jam_ruby/models/promotional.rb | 1 - 3 files changed, 48 insertions(+), 75 deletions(-) create mode 100644 admin/app/views/admin/latests/_form.html.erb diff --git a/admin/app/admin/promo_latest.rb b/admin/app/admin/promo_latest.rb index 5e8435882..d846ec630 100644 --- a/admin/app/admin/promo_latest.rb +++ b/admin/app/admin/promo_latest.rb @@ -2,84 +2,51 @@ ActiveAdmin.register JamRuby::PromoLatest, :as => 'Latest' do menu :label => 'Home Page Latest' - config.sort_order = 'position ASC aasm_state DESC created_at DESC' + config.sort_order = 'position ASC aasm_state DESC updated_at DESC' config.batch_actions = false # config.clear_action_items! config.filters = false - # index do - # column :email do |user| link_to(truncate(user.email, {:length => 12}), resource_path(user), {:title => "#{user.first_name} #{user.last_name} (#{user.email})"}) end - # column :updated_at do |uu| uu.updated_at.strftime(DATE_FORMAT) end - # column :created_at do |uu| uu.created_at.strftime(DATE_FORMAT) end - # column :city - # column :musician - # column 'Client DL' do |uu| - # if dd = uu.first_downloaded_client_at - # dd.strftime(DATE_FORMAT) - # else - # '' - # end - # end - # column 'Client Run' do |uu| - # if dd = uu.first_ran_client_at - # dd.strftime(DATE_FORMAT) - # else - # '' - # end - # end - # column 'Certified Gear' do |uu| - # if dd = uu.first_certified_gear_at - # dd.strftime(DATE_FORMAT) - # else - # '' - # end - # end - # column 'Any Session' do |uu| - # if dd = uu.first_music_session_at - # dd.strftime(DATE_FORMAT) - # else - # '' - # end - # end - # column 'Real Session' do |uu| - # if dd = uu.first_real_music_session_at - # dd.strftime(DATE_FORMAT) - # else - # '' - # end - # end - # column 'Good Session' do |uu| - # if dd = uu.first_good_music_session_at - # dd.strftime(DATE_FORMAT) - # else - # '' - # end - # end - # column 'Invited' do |uu| - # if dd = uu.first_invited_at - # dd.strftime(DATE_FORMAT) - # else - # '' - # end - # end - # column 'Friended' do |uu| - # if dd = uu.first_friended_at - # dd.strftime(DATE_FORMAT) - # else - # '' - # end - # end - # column 'Promoted' do |uu| - # if dd = uu.first_social_promoted_at - # dd.strftime(DATE_FORMAT) - # else - # '' - # end - # end - # column 'Recorded' do |uu| - # uu.first_recording_at - # end + form :partial => 'form' + + index do + column 'State' do |pp| pp.aasm_state end + column 'Position' do |pp| pp.position end + column 'Updated' do |pp| pp.updated_at end + default_actions + end + + show do + attributes_table do + row 'State' do |obj| obj.aasm_state end + row 'Position' do |obj| obj.position end + row 'Updated' do |obj| obj.updated_at end + end + end + + controller do + + def new + @promo = JamRuby::PromoBuzz.new + @promo.aasm_state = 'active' + super + end + + def create + promo = PromoBuzz.create_with_params(params[:jam_ruby_promo_latest]) + super + end + + def edit + @promo = resource + super + end + + def update + super + end + + end - # end end diff --git a/admin/app/views/admin/latests/_form.html.erb b/admin/app/views/admin/latests/_form.html.erb new file mode 100644 index 000000000..b05d0140e --- /dev/null +++ b/admin/app/views/admin/latests/_form.html.erb @@ -0,0 +1,7 @@ +<%= semantic_form_for([:admin, @promo], :html => {:multipart => true}, :url => @promo.new_record? ? admin_latests_path : "/admin/latests/#{@promo.id}") do |f| %> + <%= f.inputs do %> + <%= f.input(:position, :label => "Position", :input_html => {:maxlength => 4}) %> + <%= f.input(:aasm_state, :as => :select, :collection => Promotional::STATES, :label => 'Status') %> + <% end %> + <%= f.actions %> +<% end %> diff --git a/ruby/lib/jam_ruby/models/promotional.rb b/ruby/lib/jam_ruby/models/promotional.rb index 20d83f1d0..7cecf0ac8 100644 --- a/ruby/lib/jam_ruby/models/promotional.rb +++ b/ruby/lib/jam_ruby/models/promotional.rb @@ -1,6 +1,5 @@ class JamRuby::Promotional < ActiveRecord::Base self.table_name = :promotionals - self.abstract_class = true attr_accessible :expires_at, :position, :aasm_state From c576901d0d3bee800ad2fa56ef373b0b5a7d74da Mon Sep 17 00:00:00 2001 From: Jonathan Kolyer Date: Wed, 8 Jan 2014 21:32:23 -0600 Subject: [PATCH 10/12] fixed merge conflict --- ruby/lib/jam_ruby.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/ruby/lib/jam_ruby.rb b/ruby/lib/jam_ruby.rb index ab8eb59a6..0b566c55d 100755 --- a/ruby/lib/jam_ruby.rb +++ b/ruby/lib/jam_ruby.rb @@ -85,9 +85,7 @@ require "jam_ruby/models/mix" require "jam_ruby/models/claimed_recording" require "jam_ruby/models/crash_dump" require "jam_ruby/models/isp_score_batch" -<<<<<<< HEAD require "jam_ruby/models/promotional" -======= require "jam_ruby/models/icecast_admin_authentication" require "jam_ruby/models/icecast_directory" require "jam_ruby/models/icecast_limit" @@ -101,7 +99,6 @@ require "jam_ruby/models/icecast_sercurity" require "jam_ruby/models/icecast_server" require "jam_ruby/models/icecast_servermisc" require "jam_ruby/models/icecast_user_authentication" ->>>>>>> develop include Jampb From be2a7ecc48165923db53337765f4a8e0f2048baf Mon Sep 17 00:00:00 2001 From: Seth Call Date: Thu, 9 Jan 2014 13:53:47 +0000 Subject: [PATCH 11/12] * removing git merge syntax from jam_ruby --- ruby/lib/jam_ruby.rb | 4 -- ruby/lib/jam_ruby/resque/audiomixer.rb | 68 ++++++++++++++++++-- ruby/spec/jam_ruby/resque/audiomixer_spec.rb | 14 +++- 3 files changed, 76 insertions(+), 10 deletions(-) diff --git a/ruby/lib/jam_ruby.rb b/ruby/lib/jam_ruby.rb index ab8eb59a6..5864d9303 100755 --- a/ruby/lib/jam_ruby.rb +++ b/ruby/lib/jam_ruby.rb @@ -85,9 +85,7 @@ require "jam_ruby/models/mix" require "jam_ruby/models/claimed_recording" require "jam_ruby/models/crash_dump" require "jam_ruby/models/isp_score_batch" -<<<<<<< HEAD require "jam_ruby/models/promotional" -======= require "jam_ruby/models/icecast_admin_authentication" require "jam_ruby/models/icecast_directory" require "jam_ruby/models/icecast_limit" @@ -101,8 +99,6 @@ require "jam_ruby/models/icecast_sercurity" require "jam_ruby/models/icecast_server" require "jam_ruby/models/icecast_servermisc" require "jam_ruby/models/icecast_user_authentication" ->>>>>>> develop - include Jampb module JamRuby diff --git a/ruby/lib/jam_ruby/resque/audiomixer.rb b/ruby/lib/jam_ruby/resque/audiomixer.rb index 8bb0f5aa3..44f75436c 100644 --- a/ruby/lib/jam_ruby/resque/audiomixer.rb +++ b/ruby/lib/jam_ruby/resque/audiomixer.rb @@ -21,17 +21,35 @@ module JamRuby def validate raise "no files specified" if !@manifest[:files] || @manifest[:files].length == 0 + + @manifest[:files].each do |file| + codec = file[:codec] + raise "no codec specified" unless codec + + offset = file[:offset] + raise "no offset specified" unless offset + + filename = file[:filename] + raise "no filename specified" unless filename + end + + raise "no output specified" unless @manifest[:output] + raise "no output codec specified" unless @manifest[:output][:codec] + raise "no output filename specified" unless @manifest[:output][:filename] + + raise "no timeline specified" if !@manifest[:timeline] || @manifest[:timeline].length == 0 + + @manifest[:timeline].each do |entry| + + end end def fetch_audio_files - @manifest[:files].each do |file| - filename = file[:filename] - end end def run(manifest) - @manifest = manifest.symbolize_keys + @manifest = symbolize_keys(manifest) validate @@ -42,7 +60,14 @@ module JamRuby f.write(@manifest.to_json) end - #{"files": [{"codec": "vorbis", "offset": 0, "filename": "TPD - bass.flac-stereo.ogg"}, {"codec": "vorbis", "offset": 0, "filename": "TPD - bg vox.flac-stereo.ogg"}, {"codec": "vorbis", "offset": 0, "filename": "TPD - drums.flac-stereo.ogg"}, {"codec": "vorbis", "offset": 0, "filename": "TPD - guitars.flac-stereo.ogg"}, {"codec": "vorbis", "offset": 0, "filename": "TPD - lead vox.flac-stereo.ogg"}], "output": {"codec": "vorbis", "filename": "mix.ogg"}, "timeline": [{"timestamp": 0, "mix": [{"balance": 0, "level": 100}, {"balance": 0, "level": 100}, {"balance": 0, "level": 100}, {"balance": 0, "level": 100}, {"balance": 0, "level": 100}]}]} + #{"files": [{"codec": "vorbis", "offset": 0, "filename": "TPD - bass.flac-stereo.ogg"}, + # {"codec": "vorbis", "offset": 0, "filename": "TPD - bg vox.flac-stereo.ogg"}, + # {"codec": "vorbis", "offset": 0, "filename": "TPD - drums.flac-stereo.ogg"}, + # {"codec": "vorbis", "offset": 0, "filename": "TPD - guitars.flac-stereo.ogg"}, + # {"codec": "vorbis", "offset": 0, "filename": "TPD - lead vox.flac-stereo.ogg"}], + # "output": {"codec": "vorbis", "filename": "mix.ogg"}, + # "timeline": + # [{"timestamp": 0, "mix": [{"balance": 0, "level": 100}, {"balance": 0, "level": 100}, {"balance": 0, "level": 100}, {"balance": 0, "level": 100}, {"balance": 0, "level": 100}]}]} audiomixer_cmd = "#{APP_CONFIG.audiomixer_path} #{manifest_file}" @@ -52,6 +77,39 @@ module JamRuby system(audiomixer_cmd) end + def symbolize_keys(obj) + case obj + when Array + obj.inject([]){|res, val| + res << case val + when Hash, Array + symbolize_keys(val) + else + val + end + res + } + when Hash + obj.inject({}){|res, (key, val)| + nkey = case key + when String + key.to_sym + else + key + end + nval = case val + when Hash, Array + symbolize_keys(val) + else + val + end + res[nkey] = nval + res + } + else + obj + end + end end end \ No newline at end of file diff --git a/ruby/spec/jam_ruby/resque/audiomixer_spec.rb b/ruby/spec/jam_ruby/resque/audiomixer_spec.rb index f01519dbe..9c4d8b909 100644 --- a/ruby/spec/jam_ruby/resque/audiomixer_spec.rb +++ b/ruby/spec/jam_ruby/resque/audiomixer_spec.rb @@ -11,8 +11,20 @@ describe AudioMixer do end it "no codec specified" do - expect{ audiomixer.run({ "files" => [ "offset" => 0, "filename" => "/some/path"] }) } + expect{ audiomixer.run({ "files" => [ {"offset" => 0, "filename" => "/some/path"} ] }) }.to raise_error("no codec specified") + end + + it "no offset specified" do + expect{ audiomixer.run({ "files" => [ {"codec" => "vorbis", "filename" => "/some/path"} ] }) }.to raise_error("no offset specified") + end + + it "no output specified" do + expect{ audiomixer.run({ "files" => [ {"codec" => "vorbis", "offset" => 0, "filename" => "/some/path"} ] }) }.to raise_error("no output specified") end end + + describe "fetch_audio_files" do + + end end From 1555af6db8c44375a365138331470bd905054fa8 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Fri, 10 Jan 2014 16:25:55 +0000 Subject: [PATCH 12/12] * VRFS-984 finished. subpath is /resque --- admin/config/routes.rb | 4 ++++ db/up/mix_job_watch.sql | 0 2 files changed, 4 insertions(+) create mode 100644 db/up/mix_job_watch.sql diff --git a/admin/config/routes.rb b/admin/config/routes.rb index ebc1b9790..b2b66d95e 100644 --- a/admin/config/routes.rb +++ b/admin/config/routes.rb @@ -1,3 +1,5 @@ +require 'resque/server' + JamAdmin::Application.routes.draw do # ActiveAdmin::Devise.config, @@ -12,6 +14,8 @@ JamAdmin::Application.routes.draw do match '/api/artifacts' => 'artifacts#update_artifacts', :via => :post + mount Resque::Server.new, :at => "/resque" + # The priority is based upon order of creation: # first created -> highest priority. diff --git a/db/up/mix_job_watch.sql b/db/up/mix_job_watch.sql new file mode 100644 index 000000000..e69de29bb