module Bootstrap
  class FrameworkNotFound < StandardError; end

  # Inspired by Kaminari
  def self.load!
    if asset_pipeline?
      require 'sass-rails' # See: https://github.com/thomas-mcdonald/bootstrap-sass/pull/4
      require 'bootstrap-sass/engine'
      require 'bootstrap-sass/config/sass_extentions'
    elsif compass?
      require 'bootstrap-sass/compass_extensions'
      require 'bootstrap-sass/config/sass_extentions'
      base = File.join(File.dirname(__FILE__), '..')
      styles = File.join(base, 'vendor', 'assets', 'stylesheets')
      templates = File.join(base, 'templates')
      ::Compass::Frameworks.register('bootstrap', :stylesheets_directory => styles, :templates_directory => templates)
    else
      raise Bootstrap::FrameworkNotFound, "bootstrap-sass requires either Rails or Compass, neither of which are loaded"
    end
  end

  private
  def self.asset_pipeline?
    defined?(::Rails) && ::Rails.version >= '3.1.0'
  end

  def self.compass?
    defined?(::Compass)
  end
end

Bootstrap.load!

module Bootstrap
  class FrameworkNotFound < StandardError; end

  # Inspired by Kaminari
  def self.load!
    if asset_pipeline?
      require 'sass-rails' # See: https://github.com/thomas-mcdonald/bootstrap-sass/pull/4
      require 'bootstrap-sass/engine'
      require 'bootstrap-sass/config/sass_extentions'
    end
    if compass?
      require 'bootstrap-sass/compass_extensions'
      require 'bootstrap-sass/config/sass_extentions'
      base = File.join(File.dirname(__FILE__), '..')
      styles = File.join(base, 'vendor', 'assets', 'stylesheets')
      templates = File.join(base, 'templates')
      ::Compass::Frameworks.register('bootstrap', :stylesheets_directory => styles, :templates_directory => templates)
    else
      raise Bootstrap::FrameworkNotFound, "bootstrap-sass requires either Rails or Compass, neither of which are loaded"
    end
  end

  private
  def self.asset_pipeline?
    defined?(::Rails) && ::Rails.version >= '3.1.0'
  end

  def self.compass?
    defined?(::Compass)
  end
end

Bootstrap.load!

--- 
+++ 
@@ -7,8 +7,7 @@
       require 'sass-rails' # See: https://github.com/thomas-mcdonald/bootstrap-sass/pull/4
       require 'bootstrap-sass/engine'
       require 'bootstrap-sass/config/sass_extentions'
-    end
-    if compass?
+    elsif compass?
       require 'bootstrap-sass/compass_extensions'
       require 'bootstrap-sass/config/sass_extentions'
       base = File.join(File.dirname(__FILE__), '..')
Revert "support for rails w/compass"

This reverts commit 0cea6384c87fc88ba3503999ed808f3f833c7b43.

I had not considered the side effect of loading all the compass setup,
since this will mean that Rails' asset-url is overridden, or some side
effect will come about as a result.
