<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -96,6 +96,10 @@ class PeopleController &lt; ApplicationController
           format.html { render :action =&gt; &quot;edit&quot; }
         end
       when 'password_edit'
+        if global_prefs.demo?
+          flash[:error] = &quot;Passwords can't be changed in demo mode.&quot;
+          redirect_to @person and return
+        end
         if @person.change_password?(params[:person])
           flash[:success] = 'Password changed.'
           format.html { redirect_to(@person) }</diff>
      <filename>app/controllers/people_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -64,8 +64,14 @@ module AuthenticatedSystem
       respond_to do |format|
         format.html do
           store_location
-          flash[:error] = &quot;You must log in to access this page.&quot;
-          redirect_to login_url
+          if global_prefs.demo?
+            self.current_person = Person.find_by_name(&quot;Guest User&quot;)
+            flash[:success] = &quot;You have been logged in as the guest user.&quot;
+            redirect_back_or_default(home_url)
+          else
+            flash[:error] = &quot;You must log in to access this page.&quot;
+            redirect_to login_url
+          end
         end
         format.any do
           request_http_basic_authentication 'Web Password'</diff>
      <filename>lib/authenticated_system.rb</filename>
    </modified>
    <modified>
      <diff>@@ -11,10 +11,8 @@ namespace :db do
     task :load =&gt; :environment do |t|
       create_demo_people
       make_demo_connections
-      # make_messages(@lipsum)
-      # make_forum_posts
-      # make_blog_posts
-      # make_feed   
+      make_demo_activities
+      Preference.find(:first).update_attributes(:demo =&gt; true)
     end
       
     desc &quot;Remove demo data&quot; 
@@ -32,8 +30,6 @@ namespace :db do
       Rake::Task[&quot;install&quot;].invoke
       Rake::Task[&quot;db:demo_data:load&quot;].invoke
     end
-    
-
   end
 end
 
@@ -44,10 +40,10 @@ def create_demo_people
                  :password_confirmation =&gt; &quot;foobar&quot;,
                  :name =&gt; &quot;Guest User&quot;,
                  :description =&gt; &quot;This is the guest user's description.&quot;)
-  description = &quot;This is a desription for &quot;
+  description = &quot;This is a description for &quot;
   %w[male female].each do |gender|
     filename = File.join(DATA_DIRECTORY, &quot;#{gender}_names.txt&quot;)
-    names = File.open(filename).readlines
+    names = File.open(filename).readlines[0...10]
     password = &quot;foobar&quot;
     photos = Dir.glob(&quot;lib/tasks/sample_data/#{gender}_photos/*.jpg&quot;).shuffle
     names.each_with_index do |name, i|
@@ -61,7 +57,7 @@ def create_demo_people
                     :person =&gt; person, :primary =&gt; true)
     end
   end
-end   
+end
 
 def make_demo_connections
   person = default_demo_person
@@ -71,74 +67,24 @@ def make_demo_connections
   end
 end
 
-# 
-# def make_messages(text)
-#   michael = default_person
-#   senders = Person.find(:all, :limit =&gt; 10)
-#   senders.each do |sender|
-#     subject = some_text(SMALL_STRING_LENGTH)
-#     Message.create!(:subject =&gt; subject, :content =&gt; text, 
-#                     :sender =&gt; sender, :recipient =&gt; michael,
-#                     :send_mail =&gt; false)
-#     Message.create!(:subject =&gt; subject, :content =&gt; text, 
-#                     :sender =&gt; michael, :recipient =&gt; sender,
-#                     :send_mail =&gt; false)
-#   end
-# end
-# 
-# def make_forum_posts
-#   forum = Forum.find(:first)
-#   people = [default_person] + default_person.contacts
-#   (1..11).each do |n|
-#     name = some_text(rand(Topic::MAX_NAME))
-#     topic = forum.topics.create(:name =&gt; name, :person =&gt; people.pick,
-#                                 :created_at =&gt; rand(10).hours.ago)
-#     11.times do
-#       topic.posts.create(:body =&gt; @lipsum, :person =&gt; people.pick,
-#                          :created_at =&gt; rand(10).hours.ago)
-#     end
-#   end
-# end
-# 
-# def make_blog_posts
-#   3.times do
-#     default_person.blog.posts.create!(:title =&gt; some_text(rand(25)),
-#       :body =&gt; some_text(rand(MEDIUM_TEXT_LENGTH)))
-#   end
-#   default_person.contacts.each do |contact|
-#     contact.blog.posts.create!(:title =&gt; some_text(rand(25)),
-#       :body =&gt; some_text(rand(MEDIUM_TEXT_LENGTH)))
-#   end
-# end
-# 
-# # Make a less-boring sample feed.
-# def make_feed
-#   # Mix up activities for variety.
-#   default_person.activities.each do |activity|
-#     activity.created_at = rand(20).hours.ago
-#     activity.save!
-#   end
-# end
-# 
-# def uploaded_file(filename, content_type)
-#   t = Tempfile.new(filename.split('/').last)
-#   t.binmode
-#   path = File.join(RAILS_ROOT, filename)
-#   FileUtils.copy_file(path, t.path)
-#   (class &lt;&lt; t; self; end).class_eval do
-#     alias local_path path
-#     define_method(:original_filename) {filename}
-#     define_method(:content_type) {content_type}
-#   end
-#   return t
-# end
-# 
+def make_demo_activities
+  person = default_demo_person
+  people = Person.find(:all) - [person]
+  Message.create(:subject =&gt; &quot;The message subject&quot;,
+                 :content =&gt; &quot;The message content.&quot;,
+                 :sender =&gt; people.rand,
+                 :recipient =&gt; person)
+  person.comments.create(:body =&gt; &quot;A wall comment!&quot;,
+                         :commenter =&gt; people.rand)
+  forum = Forum.find(:first)
+  topic = forum.topics.create(:name =&gt; &quot;A forum topic&quot;,
+                              :person =&gt; people.rand)
+  topic.posts.create(:body =&gt; &quot;This is the post body.&quot;,
+                     :person =&gt; people.rand)
+  people.rand.blog.posts.create(:title =&gt; &quot;A blog post&quot;,
+                                :body =&gt; &quot;This is a blog post!&quot;)
+end
+
 def default_demo_person
   Person.find_by_name(&quot;Guest User&quot;)
-end
-# 
-# # Return some random text.
-# def some_text(n, default = &quot;foobar&quot;)
-#   text = @lipsum.split.shuffle.join(' ')[0...n].strip.capitalize
-#   text.blank? ? default : text
-# end
\ No newline at end of file
+end
\ No newline at end of file</diff>
      <filename>lib/tasks/demo_data.rake</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>baf550172e16255e37e79c8a0c3249a85e66ff83</id>
    </parent>
  </parents>
  <author>
    <name>Michael Hartl</name>
    <email>michael@michaelhartl.com</email>
  </author>
  <url>http://github.com/insoshi/insoshi/commit/30b14d441098647bfcf4108b1a336c013f1a0aff</url>
  <id>30b14d441098647bfcf4108b1a336c013f1a0aff</id>
  <committed-date>2008-05-20T15:35:56-07:00</committed-date>
  <authored-date>2008-05-20T15:35:56-07:00</authored-date>
  <message>Finished demo data</message>
  <tree>bca6124ce032d1bfe040973461c8416757d6ac82</tree>
  <committer>
    <name>Michael Hartl</name>
    <email>michael@michaelhartl.com</email>
  </committer>
</commit>
