Sha256: 3c9e6c1b706f72d13453888739caf8d524c23a3ad450c40383b57f1329e4cda8
Contents?: true
Size: 1.71 KB
Versions: 4
Compression:
Stored size: 1.71 KB
Contents
namespace :shoppe do desc "Load seed data for the Shoppe" task :seed => :environment do require File.join(Shoppe.root, 'db', 'seeds') end desc "Create a default admin user" task :create_default_user => :environment do Shoppe::User.create(:email_address => 'admin@example.com', :password => 'password', :password_confirmation => 'password', :first_name => 'Default', :last_name => 'Admin') puts puts " New user has been created successfully." puts puts " E-Mail Address..: admin@example.com" puts " Password........: password" puts end desc "Import default set of countries" task :import_countries => :environment do Shoppe::CountryImporter.import end desc "Run the key setup tasks for a new application" task :setup => :environment do Rake::Task["shoppe:import_countries"].invoke if Shoppe::Country.all.empty? Rake::Task["shoppe:create_default_user"].invoke if Shoppe::User.all.empty? end desc "Converts nifty-attachment attachments to Shoppe Attachments" task :attachments => :environment do require "nifty/attachments" attachments = Nifty::Attachments::Attachment.all attachments.each do |attachment| object = attachment.parent_type.constantize.find(attachment.parent_id) attach = object.attachments.build attach.role = attachment.role attach.file_name = attachment.file_name tempfile = Tempfile.new("attach-#{attachment.token}") tempfile.binmode tempfile.write(attachment.data) uploaded_file = ActionDispatch::Http::UploadedFile.new(tempfile: tempfile, filename: attachment.file_name, type: attachment.file_type) attach.file = uploaded_file attach.save! end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
shoppe-1.1.2 | lib/tasks/shoppe.rake |
shoppe-1.1.1 | lib/tasks/shoppe.rake |
shoppe-1.1.0 | lib/tasks/shoppe.rake |
shoppe-1.0.9 | lib/tasks/shoppe.rake |