def server_status_alerts
      require 'rubygems'

      alerts = []

      if check_json_ext?
        msg = <<-MSG.strip.gsub(/\s+/, " ")
          <h4>JSON C extension not found.</h4>
          Falling back to the pure Ruby variant. <code>gem install json</code> for better performance.
        MSG
        alerts << {:level => 'warning', :msg => msg}
      end

      # It would be awesome if we didn't have to resort to this :)
      if Gem::Specification.respond_to? :find_all

        if check_bson_ext?
          Gem.refresh

          installed = Gem::Specification.find_all { |s| s.name == 'mongo' }.map { |s| s.version }.sort.last
          if Gem::Specification.find_all { |s| s.name == 'bson_ext' && s.version == installed }.empty?
            msg = <<-MSG.strip.gsub(/\s+/, " ")
              <h4>MongoDB driver C extension not found.</h4>
              Install this extension for better performance: <code>gem install bson_ext -v #{installed}</code>
            MSG
            alerts << {:level => 'warning', :msg => msg}
          else
            msg = <<-MSG.strip.gsub(/\s+/, " ")
              <h4>Restart required</h4>
              You have recently installed the <tt>bson_ext</tt> extension.
              Run <code>genghisapp&nbsp;--kill</code> then restart <code>genghisapp</code> to use it.
            MSG
            alerts << {:level => 'info', :msg => msg}
          end
        end

        unless ENV['GENGHIS_NO_UPDATE_CHECK']
          require 'open-uri'

          Gem.refresh

          latest    = nil
          installed = Gem::Specification.find_all { |s| s.name == 'genghisapp' }.map { |s| s.version }.sort.last
          running   = Gem::Version.new(Genghis::VERSION.gsub(/[\+_-]/, '.'))

          begin
            open('https://raw.github.com/bobthecow/genghis/master/VERSION') do |f|
              latest = Gem::Version.new(f.read.gsub(/[\+_-]/, '.'))
            end
          rescue
            # do nothing...
          end

          if latest && (installed || running) < latest
            msg = <<-MSG.strip.gsub(/\s+/, " ")
              <h4>A Genghis update is available</h4>
              You are running Genghis version <tt>#{Genghis::VERSION}</tt>. The current version is <tt>#{latest}</tt>.
              Visit <a href="http://genghisapp.com">genghisapp.com</a> for more information.
            MSG
            alerts << {:level => 'warning', :msg => msg}
          elsif installed && running < installed
            msg = <<-MSG.strip.gsub(/\s+/, " ")
              <h4>Restart required</h4>
              You have installed Genghis version <tt>#{installed}</tt> but are still running <tt>#{Genghis::VERSION}</tt>.
              Run <code>genghisapp&nbsp;--kill</code> then restart <code>genghisapp</code>.
            MSG
            alerts << {:level => 'info', :msg => msg}
          end
        end

      end

      alerts
    end
def server_status_alerts
      require 'rubygems'

      alerts = []

      if check_json_ext?
        msg = <<-MSG.strip.gsub(/\s+/, " ")
          <h4>JSON C extension not found.</h4>
          Falling back to the pure Ruby variant. <code>gem install json</code> for better performance.
        MSG
        alerts << {:level => 'warning', :msg => msg}
      end

      # It would be awesome if we didn't have to resort to this :)
      if Gem::Specification.respond_to? :find_all

        if check_bson_ext?
          Gem.refresh

          installed = Gem::Specification.find_all { |s| s.name == 'mongo' }.map { |s| s.version }.sort.last
          if Gem::Specification.find_all { |s| s.name == 'bson_ext' && s.version == installed }.empty?
            msg = <<-MSG.strip.gsub(/\s+/, " ")
              <h4>MongoDB driver C extension not found.</h4>
              Install this extension for better performance: <code>gem install bson_ext -v #{installed}</code>
            MSG
            alerts << {:level => 'warning', :msg => msg}
          else
            msg = <<-MSG.strip.gsub(/\s+/, " ")
              <h4>Restart required</h4>
              You have recently installed the <tt>bson_ext</tt> extension.
              Run <code>genghisapp&nbsp;--kill</code> then restart <code>genghisapp</code> to use it.
            MSG
            alerts << {:level => 'info', :msg => msg}
          end
        end

        unless ENV['GENGHIS_NO_UPDATE_CHECK']
          require 'open-uri'

          Gem.refresh

          latest    = nil
          installed = Gem::Specification.find_all { |s| s.name == 'genghisapp' }.map { |s| s.version }.sort.last
          running   = Gem::Version.new(Genghis::VERSION.gsub(/[\+_-]/, '.'))

          begin
            open('https://raw.github.com/bobthecow/genghis/master/VERSION') do |f|
              latest = Gem::Version.new(f.read.gsub(/[\+_-]/, '.'))
            end
          rescue
            # do nothing...
          end

          if latest && (installed || running) < latest
            msg = <<-MSG.strip.gsub(/\s+/, " ")
              <h4>A Genghis update is available</h4>
              You are running Genghis version <tt>#{Genghis::VERSION}</tt>. The current version is <tt>#{latest}</tt>.
              Visit <a href="http://genghisapp.com">genghisapp.com</a> for more information.
            MSG
            alerts << {:level => 'warning', :msg => msg}
          elsif installed && running < installed
            msg = <<-MSG.strip.gsub(/\s+/, " ")
              <h4>Restart required</h4>
              You have installed Genghis version <tt>#{installed}</tt> but are still running <tt>#{Genghis::VERSION}</tt>.
              Run <code>genghisapp&nbsp;--kill</code> then restart <code>genghisapp</code>.
            MSG
            alerts << {:level => 'info', :msg => msg}
          end
        end

      end

      alerts
    end
Seemed like a good place to put this