orbit-basic/lib/tasks/desktop.rake

24 lines
705 B
Ruby
Raw Normal View History

2012-11-06 04:17:09 +00:00
# encoding: utf-8
2013-04-08 17:05:54 +00:00
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!
2012-11-06 04:17:09 +00:00
end
2013-04-08 17:05:54 +00:00
puts "Section " + x + " done!"
2012-11-06 04:17:09 +00:00
end
end