Skip to content

Instantly share code, notes, and snippets.

@augustf
Last active October 8, 2015 00:38
Show Gist options
  • Save augustf/0319df14bbea83f0bb70 to your computer and use it in GitHub Desktop.
Save augustf/0319df14bbea83f0bb70 to your computer and use it in GitHub Desktop.
Concerto Demo script
# Script to reset a Concerto demo instance and include useful demo data
# This should be invoked with bundle exec rails runner concerto_demo_script.rb
# Recommended cron entry: 00 00 * * * ruby path/to/concerto_demo_script.rb
#drop, migrate, and seed the database
require 'rake'
Rake.load_rakefile Rails.root.join( 'Rakefile' )
Rake::Task["db:reset"].invoke
# At this point, a demo screen, feed, and group exist. All that's needed is an initial admin, some sample users, and content
@katie = User.where(:email => 'katie@concerto-signage.org').first_or_create(:is_admin => true, :first_name => "Katie", :last_name => "Kay", :password => 'kati3', :password_confirmation => 'kati3')
@luke = User.where(:email => 'luke@concerto-signage.org').first_or_create(:first_name => "Luke", :last_name => "Ski", :password => 'luk3', :password_confirmation => 'luk3')
@peter = User.where(:email => 'peter@concerto-signage.org').first_or_create(:first_name => "Peter", :last_name => "Rabbit", :password => 'pet3r', :password_confirmation => 'pet3r')
@mary = User.where(:email => 'mary@concerto-signage.org').first_or_create(:first_name => "Mary", :last_name => "Mac", :password => 'marymac', :password_confirmation => 'marymac')
@file = File.new("db/seed_assets/test.jpg")
@media = Media.new(:file => @file, :key => "original", :file_type => "image/jpeg") #Concerto is rather dumb and won't take image/jpg in this case
@graphic = Graphic.new(:name => "Sample Graphic", :start_time => Time.now, :end_time => 10.days.from_now, :duration => 10, :user => @katie)
@graphic.media.append(@media)
@graphic.save
@submission = Submission.where(:content_id => @graphic.id, :feed_id => Feed.first).first_or_create(:moderation_flag => true, :moderator_id => @katie.id, :duration => 10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment