<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>bin/vanilla</filename>
    </added>
    <added>
      <filename>lib/tasks/vanilla.rake</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -5,3 +5,4 @@ pkg
 *~
 tmp
 config.yml
+rdoc
\ No newline at end of file</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -1,170 +1,118 @@
 $LOAD_PATH.unshift File.join(File.dirname(__FILE__), 'lib')
 require 'vanilla'
 
-desc &quot;Open an irb session preloaded with this library&quot;
-task :console do
-  sh &quot;irb -Ilib -rvanilla/console&quot;
-end
-
-task :clean do
-  # TODO: get the database name from Soup
-  FileUtils.rm &quot;soup.db&quot; if File.exist?(&quot;soup.db&quot;)
-end
-
-task :prepare do
-  Soup.prepare
-end
-
-task :bootstrap =&gt; :prepare do  
-  Dynasnip.persist_all!(overwrite=true)
-  
-  Dir[File.join(File.dirname(__FILE__), 'lib', 'vanilla', 'snips', '*.rb')].each do |f|
-    p &quot;loading #{f}&quot;
-    load f
-  end  
-  
-  load File.join(File.dirname(__FILE__), *%w[lib vanilla test_snips.rb])
-  
-  puts &quot;The soup is simmering. Loaded #{Soup.tuple_class.count} tuples&quot;
-end
-
-desc 'Resets the soup to contain the base snips only. Dangerous!'
-task :reset =&gt; [:clean, :bootstrap]
-
-namespace :upgrade do
-  desc 'Upgrade the dynasnips'
-  task :dynasnips =&gt; :prepare do
-    Dynasnip.all.each do |dynasnip|
-      print &quot;Upgrading #{dynasnip.snip_name}... &quot;
-      # TODO: our confused Soup interface might return an array.
-      snip = Soup[dynasnip.snip_name]
-      if snip.empty? || snip.nil?
-        # it's a new dyna
-        Soup &lt;&lt; dynasnip.snip_attributes
-        puts &quot;(new)&quot;
-      elsif snip.created_at == snip.updated_at
-        # it's not been changed, let's upgrade
-        snip.destroy
-        Soup &lt;&lt; dynasnip.snip_attributes
-        puts &quot;(unedited)&quot;
-      else
-        # the dyna exists and has been changed
-        dynasnip.snip_attributes.each do |name, value|
-          unless (existing_value = snip.get_value(name)) == value
-            puts &quot;Conflict in attribute '#{name}':&quot;
-            puts &quot;&gt; Your soup: '#{existing_value}'&quot;
-            puts &quot;&gt;  New soup: '#{value}&quot;
-            print &quot;Upgrade? [Y/n]: &quot;
-            upgrade_value = [&quot;Y&quot;, &quot;y&quot;, &quot;&quot;].include? STDIN.gets.chomp.strip
-            snip.set_value(name, value) if upgrade_value
-          end
-        end
-        snip.save
-      end
-    end
-  end
-end
-
-desc 'Upgrade dynasnips and system snips'
-task :upgrade =&gt; [&quot;upgrade:dynasnips&quot;]
-
-desc 'Add a user (or change an existing password)'
-task :add_user =&gt; :prepare do
-  puts &quot;Adding a new user&quot;
-  # config_file = ENV['VANILLA_CONFIG'] || 'config.yml'
-  # config_file = YAML.load(File.open(config_file)) rescue {}
-  app = Vanilla::App.new(ENV['VANILLA_CONFIG'])
-  print &quot;Username: &quot;
-  username = STDIN.gets.chomp.strip
-  print &quot;Password: &quot;
-  password = STDIN.gets.chomp.strip
-  print &quot;Confirm password: &quot;
-  confirm_password = STDIN.gets.chomp.strip
-  if password != confirm_password
-    raise &quot;Passwords don't match!&quot;
-  else
-    app.config[:credentials] ||= {}
-    app.config[:credentials][username] = MD5.md5(password).to_s
-    app.config.save!
-    puts &quot;User '#{username}' added.&quot;
-  end
-end
-
-desc 'Generate file containing secret for cookie-based session storage'
-task :generate_secret do
-  # Adapted from old rails secret generator.
-  require 'openssl'
-  if !File.exist?(&quot;/dev/urandom&quot;)
-    # OpenSSL transparently seeds the random number generator with
-    # data from /dev/urandom. On platforms where that is not
-    # available, such as Windows, we have to provide OpenSSL with
-    # our own seed. Unfortunately there's no way to provide a
-    # secure seed without OS support, so we'll have to do with
-    # rand() and Time.now.usec().
-    OpenSSL::Random.seed(rand(0).to_s + Time.now.usec.to_s)
-  end
-  data = OpenSSL::BN.rand(2048, -1, false).to_s
-  secret = OpenSSL::Digest::SHA512.new(data).hexdigest
-  app = Vanilla::App.new(ENV['VANILLA_CONFIG'])
-  app.config[:secret] = secret
-  app.config.save!
-  puts &quot;Secret generated.&quot;
+require 'spec'
+require 'spec/rake/spectask'
+Spec::Rake::SpecTask.new do |t|
+  t.spec_opts = %w(--format specdoc --colour)
+  t.libs = [&quot;spec&quot;]
 end
 
+task :default =&gt; :spec
 
-desc 'Prepare a new vanilla.rb installation'
-task :setup do
-  puts &lt;&lt;-EOM
-
-===================~ Vanilla.rb ~====================
-
-Congratulations! You have elected to try out the weirdest web thing ever.
-Lets get started. Firstly, I'm going to cook you some soup:
 
+require &quot;rubygems&quot;
+require &quot;rake/gempackagetask&quot;
+require &quot;rake/rdoctask&quot;
 
-EOM
-  Rake::Task[:bootstrap].invoke
+# This builds the actual gem. For details of what all these options
+# mean, and other ones you can add, check the documentation here:
+#
+#   http://rubygems.org/read/chapter/20
+#
+spec = Gem::Specification.new do |s|
   
-  puts &lt;&lt;-EOM
+  # Change these as appropriate
+  s.name              = &quot;vanilla&quot;
+  s.version           = &quot;1.0.0&quot;
+  s.summary           = &quot;A bliki-type web content thing.&quot;
+  s.author            = &quot;James Adam&quot;
+  s.email             = &quot;james@lazyatom.com.com&quot;
+  s.homepage          = &quot;http://github.com/lazyatom/vanilla-rb&quot;
+
+  s.has_rdoc          = true
+  s.extra_rdoc_files  = %w(README)
+  s.rdoc_options      = %w(--main README)
+
+  # Add any extra files to include in the gem
+  s.files             = %w(config.example.yml config.ru Rakefile README) + Dir.glob(&quot;{spec,lib,bin}/**/*&quot;)
+  s.executables       = ['vanilla']
+  s.require_paths     = [&quot;lib&quot;]
   
-Now I'm going to generate your configuration. This will be stored either in
-'config.yml' in the current directory, or in the path you provide via the
-environment variable VANILLA_CONFIG.  
-
-Generating the secret for cookie-based session storage.
-EOM
-  Rake::Task[:generate_secret_file].invoke
+  # If you want to depend on other gems, add them here, along with any
+  # relevant versions
+  # s.add_dependency(&quot;some_other_gem&quot;, &quot;~&gt; 0.1.0&quot;)
   
-  puts &lt;&lt;-EOM
-
-
-Now that we've got our broth, you'll want to add a user, so you can edit stuff.
-Lets do that now:
-
-
-EOM
-  Rake::Task[:add_user].invoke
-  puts &lt;&lt;-EOM
+  s.add_development_dependency(&quot;rspec&quot;) # add any other gems for testing/development
 
+  # If you want to publish automatically to rubyforge, you'll may need
+  # to tweak this, and the publishing task below too.
+  s.rubyforge_project = &quot;vanilla&quot;
+end
 
-OK! You're ready to go. To start vanilla.rb, you'll want to get it running under
-a webserver that supports Rack. The easiest way to do this locally is via 'rackup':
-  
-  $ rackup
+# This task actually builds the gem. We also regenerate a static 
+# .gemspec file, which is useful if something (i.e. GitHub) will
+# be automatically building a gem for this project. If you're not
+# using GitHub, edit as appropriate.
+Rake::GemPackageTask.new(spec) do |pkg|
+  pkg.gem_spec = spec
   
-Then go to http://localhost:9292
-
-I'm going now, Goodbye!
-
+  # Generate the gemspec file for github.
+  file = File.dirname(__FILE__) + &quot;/#{spec.name}.gemspec&quot;
+  File.open(file, &quot;w&quot;) {|f| f &lt;&lt; spec.to_ruby }
+end
 
-EOM
+# Generate documentation
+Rake::RDocTask.new do |rd|
+  rd.main = &quot;README&quot;
+  rd.rdoc_files.include(&quot;README&quot;, &quot;lib/**/*.rb&quot;)
+  rd.rdoc_dir = &quot;rdoc&quot;
 end
 
-require 'spec'
-require 'spec/rake/spectask'
-Spec::Rake::SpecTask.new do |t|
-  t.spec_opts = %w(--format specdoc --colour)
-  t.libs = [&quot;spec&quot;]
+desc 'Clear out RDoc and generated packages'
+task :clean =&gt; [:clobber_rdoc, :clobber_package] do
+  rm &quot;#{spec.name}.gemspec&quot;
 end
 
-task :default =&gt; :spec
+# If you want to publish to RubyForge automatically, here's a simple 
+# task to help do that. If you don't, just get rid of this.
+# Be sure to set up your Rubyforge account details with the Rubyforge
+# gem; you'll need to run `rubyforge setup` and `rubyforge config` at
+# the very least.
+begin
+  require &quot;rake/contrib/sshpublisher&quot;
+  namespace :rubyforge do
+    
+    desc &quot;Release gem and RDoc documentation to RubyForge&quot;
+    task :release =&gt; [&quot;rubyforge:release:gem&quot;, &quot;rubyforge:release:docs&quot;]
+    
+    namespace :release do
+      desc &quot;Release a new version of this gem&quot;
+      task :gem =&gt; [:package] do
+        require 'rubyforge'
+        rubyforge = RubyForge.new
+        rubyforge.configure
+        rubyforge.login
+        rubyforge.userconfig['release_notes'] = spec.summary
+        path_to_gem = File.join(File.dirname(__FILE__), &quot;pkg&quot;, &quot;#{spec.name}-#{spec.version}.gem&quot;)
+        puts &quot;Publishing #{spec.name}-#{spec.version.to_s} to Rubyforge...&quot;
+        rubyforge.add_release(spec.rubyforge_project, spec.name, spec.version.to_s, path_to_gem)
+      end
+    
+      desc &quot;Publish RDoc to RubyForge.&quot;
+      task :docs =&gt; [:rdoc] do
+        config = YAML.load(
+            File.read(File.expand_path('~/.rubyforge/user-config.yml'))
+        )
+ 
+        host = &quot;#{config['username']}@rubyforge.org&quot;
+        remote_dir = &quot;/var/www/gforge-projects/vanilla-rb/&quot; # Should be the same as the rubyforge project name
+        local_dir = 'rdoc'
+ 
+        Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
+      end
+    end
+  end
+rescue LoadError
+  puts &quot;Rake SshDirPublisher is unavailable or your rubyforge environment is not configured.&quot;
+end
\ No newline at end of file</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -1,10 +1,9 @@
-$LOAD_PATH.unshift File.join(File.dirname(__FILE__), 'lib')
 require 'vanilla'
 
 app = Vanilla::App.new(ENV['VANILLA_CONFIG'])
 use Rack::Session::Cookie, :key =&gt; 'vanilla.session',
                            :path =&gt; '/',
                            :expire_after =&gt; 2592000,
-			                     :secret =&gt; app.config[:secret]
+                           :secret =&gt; app.config[:secret]
 use Rack::Static, :urls =&gt; [&quot;/public&quot;], :root =&gt; File.join(File.dirname(__FILE__))
 run app
\ No newline at end of file</diff>
      <filename>config.ru</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>100a9ac3ad40f75d0d1d7e05081ba5d3f27412ac</id>
    </parent>
  </parents>
  <author>
    <name>James Adam</name>
    <email>james@lazyatom.com</email>
  </author>
  <url>http://github.com/lazyatom/vanilla-rb/commit/6669f1d0420d526cf56ea632f44e3528e143472a</url>
  <id>6669f1d0420d526cf56ea632f44e3528e143472a</id>
  <committed-date>2009-04-09T06:11:46-07:00</committed-date>
  <authored-date>2009-04-09T06:11:46-07:00</authored-date>
  <message>Preparing vanilla to be a gem.</message>
  <tree>1a7347f62c4f9b0d35fb6423c7199e0a0f1c1254</tree>
  <committer>
    <name>James Adam</name>
    <email>james@lazyatom.com</email>
  </committer>
</commit>
