Sha256: ca0cfde895c01c9377a2e9971373bbf46a3959210ab46810e8a484ff2d000020
Contents?: true
Size: 1.27 KB
Versions: 6
Compression:
Stored size: 1.27 KB
Contents
namespace :odania do desc 'Set default page' task :set_default_page => :environment do host_name = ENV['host'] # Check if parameter host is present if host_name.blank? puts 'Please set a host name, e.g. host=www.odania.com' else site = Odania::Site.where(host: host_name).first if site.is_default puts "Site #{site.host} already default!" else Odania::Site.update_all(is_default: false) site.is_default = true site.save! puts "Site #{site.host} set to default!" end end end desc 'Sets up the first domain' task :add_site => :environment do host_name = ENV['host'] # Check if parameter host is present if host_name.blank? puts 'Please set a host name, e.g. host=www.odania.com' else site = Odania::Site.where(host: host_name).first language = Odania::Language.first if language.nil? puts "Create a language first" elsif site.nil? site = Odania::Site.create!(default_language_id: language.id, :name => host_name, :host => host_name, :is_default => (Odania::Site.count == 0)) puts "Site #{site.host} created!" else puts "Site #{site.host} already exists!" end end end namespace :db do desc 'Seed engine data' task :seed_core => :environment do OdaniaCore::Engine.load_seed end end end
Version data entries
6 entries across 6 versions & 1 rubygems