<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -82,8 +82,8 @@ module Rails
       end
 
       def load_rubygems
+        min_version = '1.3.2'
         require 'rubygems'
-        min_version = '1.3.1'
         unless rubygems_version &gt;= min_version
           $stderr.puts %Q(Rails requires RubyGems &gt;= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
           exit 1</diff>
      <filename>config/boot.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,26 +6,32 @@ require 'yaml'
 
 class RemoteInstaller
   BRANCH = ARGV[0] || &quot;master&quot;
-  URL = &quot;http://github.com/dim/retrospectiva/tarball/#{BRANCH}&quot;
-  RUBYGEMS_URL = &quot;http://rubyforge.org/frs/download.php/57643/rubygems-1.3.4.tgz&quot;
-  RAKE_URL  = &quot;http://rubyforge.org/frs/download.php/56872/rake-0.8.7.tgz&quot;
-  RAILS_URL = lambda { |rails_version| &quot;http://github.com/rails/rails/tarball/v#{rails_version}&quot; }
+  RETRO_URL          = &quot;http://github.com/dim/retrospectiva/tarball/#{BRANCH}&quot;
+  RUBYGEMS_URL = &quot;http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz&quot;
+  RAKE_URL     = &quot;http://rubyforge.org/frs/download.php/56872/rake-0.8.7.tgz&quot;
+  VENDOR_URL   = &quot;http://cloud.github.com/downloads/dim/retrospectiva/vendor.tar.gz&quot;
 
   def self.run!
     new.run!
   end
+  
+  def initialize
+    @rake = false
+    @rubygems = false
+  end
 
   def run!
     puts &quot;\n  Retrospectiva Remote Installer\n  ==============================\n\n&quot;
 
-    check_prerequisites || exit(1)
+    check_prerequisites || instruct!
     install_retrospectiva!
+    install_rubygems!
     install_rake!
-    install_rails!
-    install_gems!
+    install_vendor!
     load_rake!
     configure_db!
     create_database!
+    build_gems!
 
     next_steps!
   end
@@ -33,19 +39,22 @@ class RemoteInstaller
   protected
 
     def check_prerequisites
+      check_lib('sqlite3')
+    end
+    
+    def check_lib(name)
       begin
-        require_library_or_gem 'sqlite3'
+        require_library_or_gem name
         true
-      rescue LoadError
-        sqlite3_instruct!
+      rescue LoadError        
         false
       end
     end
 
     def install_retrospectiva!
       unless File.exist?(ARCHIVE_PATH)
-        step &quot;Downloading Retrospectiva '#{BRANCH}' branch from '#{URL}'&quot;
-        download! URL, ARCHIVE_PATH
+        step &quot;Downloading Retrospectiva '#{BRANCH}' branch from '#{RETRO_URL}'&quot;
+        download! RETRO_URL, ARCHIVE_PATH
       end
 
       unless File.exist?(INSTALL_PATH)
@@ -56,21 +65,31 @@ class RemoteInstaller
       end
     end
 
-    def install_rails!
-      unless File.exist?(RAILS_ARCHIVE)        
-        step &quot;Downloading Rails v#{rails_version} from '#{RAILS_URL.call(rails_version)}'&quot;
-        download! RAILS_URL.call(rails_version), RAILS_ARCHIVE
+    def install_rubygems!
+      if check_lib('rubygems')
+        @rubygems = true
+        return
+      end
+      
+      unless File.exist?(RUBYGEMS_ARCHIVE)
+        step &quot;Downloading RubyGems from '#{RUBYGEMS_URL}'&quot;
+        download! RUBYGEMS_URL, RUBYGEMS_ARCHIVE
       end
 
-      unless File.exist?(RAILS_PATH)
-        step &quot;Unpacking Rails to '#{RAILS_PATH}'&quot;, true
-        unpack! RAILS_ARCHIVE, VENDOR_PATH
-        temp_folder = Dir[File.join(VENDOR_PATH, 'rails-rails-*')].first
-        FileUtils.mv temp_folder, RAILS_PATH
+      unless File.exist?(RUBYGEMS_PATH)
+        step &quot;Unpacking RubyGems to '#{RUBYGEMS_PATH}'&quot;, true
+        unpack! RUBYGEMS_ARCHIVE, VENDOR_PATH
+        temp_folder = Dir[File.join(VENDOR_PATH, 'rubygems-*')].first
+        FileUtils.mv temp_folder, RUBYGEMS_PATH
       end
     end
 
     def install_rake!
+      if check_lib('rake')
+        @rake = true
+        return
+      end
+
       unless File.exist?(RAKE_ARCHIVE)
         step &quot;Downloading Rake from '#{RAKE_URL}'&quot;
         download! RAKE_URL, RAKE_ARCHIVE
@@ -84,21 +103,14 @@ class RemoteInstaller
       end
     end
 
-    def install_gems!
-      required_gems.each do |name, source|
-        unless File.exist?(gem_archive_path(name))
-          gem_url = source + &quot;/gems/#{name}.gem&quot;
-          step &quot;Downloading GEM #{name} from '#{source}'&quot;
-          download! gem_url, gem_archive_path(name)
-        end
-
-        unless File.exist?(gem_path(name))
-          FileUtils.mkdir_p(gem_path(name))
-          step &quot;Unpacking GEM #{name}&quot;, true
-          system &quot;tar xf #{gem_archive_path(name)} --exclude metadata.gz -O | tar xz -C #{gem_path(name)} 2&gt; /dev/null&quot;
-          system &quot;tar xf #{gem_archive_path(name)} --exclude data.tar.gz -O | gzip -d &gt; #{File.join(gem_path(name), '.specification')} 2&gt; /dev/null&quot;
-        end
+    def install_vendor!
+      unless File.exist?(VENDOR_ARCHIVE)
+        step &quot;Downloading vendor libraries from '#{VENDOR_URL}'&quot;
+        download! VENDOR_URL, VENDOR_ARCHIVE
       end
+
+      step &quot;Unpacking vendor libraries to '#{VENDOR_PATH}'&quot;, true
+      unpack! VENDOR_ARCHIVE, VENDOR_PATH
     end
 
     def configure_db!
@@ -120,17 +132,24 @@ class RemoteInstaller
       end
     end
 
-    def next_steps!
+    def build_gems!
+      step &quot;Building GEMs&quot;, true
+      silence_stream(STDOUT) do
+        Rake.application['gems:build'].invoke
+      end
+    end
+
+    def next_steps!      
       instructions = %Q(
         Next Steps:
 
         * Add the following line to your crontab (crontab -e):
-           * *  * * *  RAILS_ENV=production ruby #{INSTALL_PATH}/script/retro_tasks
+           * *  * * *  RAILS_ENV=production #{ruby_path} #{INSTALL_PATH}/script/retro_tasks
 
-        * Run Retrospectiva (not recommended for production):
-           cd retrospectiva; ruby script/server -e production
+        * Run Retrospectiva:
+           cd retrospectiva; #{ruby_path} script/server -e production
 
-        * Deploy as Apache2 Virtual Host:
+        * Deploy as Apache2/NingX Virtual Host:
            Please visit http://www.modrails.com/ for more information
       )
 
@@ -151,7 +170,7 @@ class RemoteInstaller
       puts instructions + &quot;\n&quot;
     end
 
-    def sqlite3_instruct!
+    def instruct!
       puts &quot;  Support for SQLite3 is MISSING on your machine\n&quot;
 
       if sqlite3_howto
@@ -161,6 +180,8 @@ class RemoteInstaller
         end
         puts &quot;\n  Re-run the installer afterwards\n\n&quot;
       end
+      
+      exit(1)
     end
 
   private
@@ -170,21 +191,15 @@ class RemoteInstaller
     INSTALL_PATH = File.join(ROOT_PATH, &quot;retrospectiva&quot;)
 
     VENDOR_PATH = File.join(INSTALL_PATH, &quot;vendor&quot;)
-    RUBYGEMS_PATH = File.join(VENDOR_PATH, &quot;rubygems&quot;)
-    RAILS_PATH = File.join(VENDOR_PATH, &quot;rails&quot;)
     RAKE_PATH = File.join(VENDOR_PATH, &quot;rake&quot;)
-    GEMS_PATH = File.join(VENDOR_PATH, &quot;gems&quot;)
+    RUBYGEMS_PATH = File.join(VENDOR_PATH, &quot;rubygems&quot;)
 
     RUBYGEMS_ARCHIVE = File.join(VENDOR_PATH, &quot;rubygems.tgz&quot;)
-    RAILS_ARCHIVE = File.join(VENDOR_PATH, &quot;rails.tgz&quot;)
     RAKE_ARCHIVE = File.join(VENDOR_PATH, &quot;rake.tgz&quot;)
+    VENDOR_ARCHIVE = File.join(VENDOR_PATH, &quot;vendor.tgz&quot;)
     DATABASE_CONFIG = File.join(INSTALL_PATH, 'config', 'database.yml')
     DATABASE_FILE = File.join(INSTALL_PATH, 'db', 'production.db')
 
-    def required_gems
-      @required_gems ||= GemsConfig.new(environment.scan(/config\.gem .+$/))
-    end
-
     def download!(url, path)
       system &quot;wget -q -O #{path} #{url}&quot;
     end
@@ -193,22 +208,6 @@ class RemoteInstaller
       system &quot;tar xzf #{file} -C #{path}&quot;
     end
 
-    def gem_path(name)
-      File.join(GEMS_PATH, name)
-    end
-
-    def gem_archive_path(file_name)
-      File.join(VENDOR_PATH, file_name + '.gem')
-    end
-
-    def rails_version
-      @rails_version ||= environment.match(/RAILS_GEM_VERSION\D+([\d\.]+)/)[1]
-    end
-
-    def environment
-      @environment ||= File.read(File.join(INSTALL_PATH, 'config', 'environment.rb'))
-    end
-
     def step(description, nl = false)
       puts &quot;  #{description}&quot; + (nl ? &quot;\n&quot; : '')
     end
@@ -217,10 +216,17 @@ class RemoteInstaller
       super(command) || abort(&quot;[E] Command '#{command}' failed during execution&quot;)
     end
 
+    def ruby_path
+      [
+        ENV['_'],
+        @rubygems ? nil : &quot;-I#{File.join(RUBYGEMS_PATH, 'lib')}&quot;
+      ].compact.join(' ')
+    end
+
     def load_rake!
       ENV['RAILS_ENV'] = 'production'
-      lib_path = File.join(RAKE_PATH, 'lib')
-      $: &lt;&lt; lib_path
+      $: &lt;&lt; File.join(RAKE_PATH, 'lib') unless @rake
+      $: &lt;&lt; File.join(RUBYGEMS_PATH, 'lib') unless @rubygems
       load File.join(INSTALL_PATH, 'Rakefile')
     end
 
@@ -291,23 +297,6 @@ class RemoteInstaller
       end
     end
 
-    class GemsConfig &lt; Hash
-
-      def initialize(lines)
-        super()
-        lines.each do |line|
-          eval line.gsub(/^\s*config\./, '')
-        end
-      end
-
-      def gem(name, options = {})
-        return unless options[:version]
-        
-        name = name + '-' + options[:version].gsub(/[^\d.]/, '')
-        self[name] = options[:source] || 'http://gems.rubyforge.org'
-      end
-
-    end
 end
 
 module Kernel</diff>
      <filename>script/remote/retrospectiva_installer.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>b5cfc55756f87b05421a9690b4d1acddf5c3f971</id>
    </parent>
  </parents>
  <author>
    <name>Dimitrij Denissenko</name>
    <email>contact@dvisionfactory.com</email>
  </author>
  <url>http://github.com/dim/retrospectiva/commit/24cd5ce29dd3233cd573b1a9b9bb552106d67388</url>
  <id>24cd5ce29dd3233cd573b1a9b9bb552106d67388</id>
  <committed-date>2009-09-12T02:48:01-07:00</committed-date>
  <authored-date>2009-09-12T02:48:01-07:00</authored-date>
  <message>Updated boot requirements
Improved Single-Step-Installer</message>
  <tree>9e3b8f307ad321d940279ec3c4e5edc99068b136</tree>
  <committer>
    <name>Dimitrij Denissenko</name>
    <email>contact@dvisionfactory.com</email>
  </committer>
</commit>
