rake task added

This commit is contained in:
harrybomrah authored and Matt K. Fu committed 2013-04-17 14:28:13 +08:00
1 parent 055d758769
commit e2802d94d0
3 files changed
+96 -74

No files matched your search

+19 -8
View File
@@ -1,13 +1,24 @@
# encoding: utf-8
namespace :desktop do
task :destroy_build_desktop => :environment do
Desktop.all.destroy_all
u = User.all
u.each do |us|
x = us.initialize_desktop
x.save!
puts "Desktop created for " + us.email.to_s
namespace :tiles do
task :destroy_build_tiles => :environment do
Tile.destroy_all
secs = Section.all
dws = DesktopWidget.all
secs.each do |sec,x|
grp = sec.groups.first
t = Tile.new(data_category: "app", data_content: "wikibooks", position: 1, shape: "w1 h1", title: "WikiBooks")
grp.tiles+=[t]
t = Tile.new(data_category: "app", data_content: "envocab", position: 2, shape: "w1 h1", title: "English Vocabulary")
grp.tiles+=[t]
@i = 3
dws.each do |dw|
t = Tile.new(data_category: "widget", position: @i,desktop_widget_id: dw.id)
@i = @i + 1
grp.tiles+=[t]
end
grp.save!
end
puts "Section " + x + " done!"
end
end