Sha256: 250bdd5fd93d420c1b703521b7cf9826c7ec0d4f90d5a840cdc7475c0c0b8153
Contents?: true
Size: 1.63 KB
Versions: 2
Compression:
Stored size: 1.63 KB
Contents
# # Blogaze # Copyright (C) 2011-2013 Jack Polgar # # Blogaze is released under the BSD 3-clause license. # @license http://opensource.org/licenses/BSD-3-Clause # Sequel.extension(:migration) namespace :db do desc 'Migrates the database to the most recent version' task :migrate do Sequel::Migrator.run(Blogaze.database, File.expand_path('../../db/migration', __FILE__)) end desc 'Inserts default data into the database' task :defaults do # Insert settings puts "Inserting settings" settings = Blogaze.database[:settings] settings.insert(:setting => 'title', :value => 'Blogaze') settings.insert(:setting => 'posts_per_page', :value => 5) settings.insert(:setting => 'moderate_comments', :value => 1) settings.insert(:setting => 'theme', :value => 'Default') # Insert groups puts "Inserting groups" groups = Blogaze.database[:groups] groups.insert(:name => 'Admin', :is_admin => 1, :create_posts => 1, :edit_posts => 1, :delete_posts => 1) groups.insert(:name => 'Author', :is_admin => 0, :create_posts => 1, :edit_posts => 1, :delete_posts => 1) groups.insert(:name => 'Reader', :is_admin => 0, :create_posts => 0, :edit_posts => 0, :delete_posts => 0) # Admin user puts "Creating admin user" Blogaze.database[:users].insert(:username => 'Admin', :password => 'bc750014cb3cf5a86b4851b9ca33027537b3fb85', :email => 'admin@example.com', :group_id => '1') # First post Blogaze.database[:posts].insert(:title => 'Welcome', :slug => 'welcome', :body => '**Welcome** to _Blogaze!_', :published_at => Time.now.to_i, :created_at => Time.now.to_i, :user_id => 1) puts "Done" end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
blogaze-0.0.2 | lib/blogaze/tasks/db.rake |
blogaze-0.0.1 | lib/blogaze/tasks/db.rake |