sample-articles
1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/environment'
# tourn on autoflush
STDOUT.sync = true
profiles = Profile.all
SUBJECTS = ['got a new car', 'release a new version of project X', "doesn't like wales no more", "doesn't use free-software no more"]
TAGS = ['free-software', 'noosfero', 'development', 'rails', 'ruby']
print "Creating some TinyMce articles: "
for subject in SUBJECTS
rand(20).times do |i|
profile = profiles.rand
profile.articles << TinyMceArticle.new(
:name => "%s #{subject}" % profile.name,
:body => "%s #{subject}" % profile.name,
:tag_list => [TAGS.rand, TAGS.rand]
)
print '.'
end
end
puts ' done!'
print "Creating some galleries: "
for subject in SUBJECTS
rand(20).times do |i|
profile = profiles.rand
profile.articles << Gallery.new(
:name => "Gallery %s #{subject}" % profile.name,
:body => "Gallery %s #{subject}" % profile.name,
:tag_list => [TAGS.rand, TAGS.rand]
)
print '.'
end
end
puts ' done!'