Skip to content

Commit 7f40649

Browse files
committedApr 12, 2012
Added a rake kandan:bootstrap task
1 parent cb14e84 commit 7f40649

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
 

‎lib/tasks/kandan.rake

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
namespace :kandan do
2+
desc "Bootstrap an initial install of Kandan. Not strictly necessary, but faster."
3+
task :bootstrap => :environment do
4+
user = User.first
5+
6+
if user.nil?
7+
puts "Creating default user..."
8+
user = User.new
9+
user.email = "admin@kandan.me"
10+
user.first_name = "Admin"
11+
user.last_name = "OfKandan"
12+
user.password = "kandanadmin"
13+
user.password_confirmation = "kandanadmin"
14+
user.save!
15+
end
16+
17+
channel = Channel.first
18+
19+
if channel.nil?
20+
puts "Creating default channel..."
21+
channel = Channel.create :name => "Castle"
22+
23+
["Welcome to Kandan, the slickest chat app out there. Brought to you by the good people of CloudFuji (http://cloudfuji.com) and friends",
24+
"We think you'll really like Kandan, but if there's anything you would like to see, Kandan is fully open source, so you can dive into it or make suggestions on the mailing list.",
25+
"To get started, you can embed images or youtube clips, use the /me command (/me is in proper love with Kandan, innit!), upload files, or of course, just chat with your teammates.",
26+
"Just paste in an image url and type a subtitle http://kandan.me/images/kandan.png",
27+
"http://www.youtube.com/watch?v=Jgpty017CIw Same with youtube videos",
28+
"/me is in proper love with Kandan, innit!",
29+
"If you're the type of person who enjoys hacking on projects, the source to Kandan is at https://github.com/bushido/kandan",
30+
"Well, that's about it. If you have any questions, concerns, or ideas, just shoot us an email support@cloudfuji.com! Have fun!",
31+
"Oh, sorry, one last thing - be sure to join the mailing list at https://groups.google.com/forum/?fromgroups#!forum/cloudfuji so you know there's a new release of Kandan!"
32+
].each do |message|
33+
a = Activity.new
34+
a.content = message
35+
a.channel_id = Channel.first
36+
a.user_id = User.first
37+
a.action = "message"
38+
a.save!
39+
end
40+
end
41+
end
42+
end

0 commit comments

Comments
 (0)
Please sign in to comment.