module Hackathon::Bootstrap

Constants

PATCHLEVEL
VERSION

Public Class Methods

asset_pipeline?() click to toggle source

Environment detection helpers

# File lib/hackathon-bootstrap.rb, line 43
def asset_pipeline?
  defined?(::Sprockets)
end
assets_path() click to toggle source
# File lib/hackathon-bootstrap.rb, line 38
def assets_path
  @assets_path ||= File.join gem_path, 'assets'
end
compass?() click to toggle source
# File lib/hackathon-bootstrap.rb, line 47
def compass?
  defined?(::Compass)
end
fonts_path() click to toggle source
# File lib/hackathon-bootstrap.rb, line 30
def fonts_path
  File.join assets_path, 'fonts'
end
gem_path() click to toggle source

Paths

# File lib/hackathon-bootstrap.rb, line 22
def gem_path
  @gem_path ||= File.expand_path '..', File.dirname(__FILE__)
end
javascripts_path() click to toggle source
# File lib/hackathon-bootstrap.rb, line 34
def javascripts_path
  File.join assets_path, 'javascripts'
end
load!() click to toggle source
# File lib/hackathon-bootstrap.rb, line 7
def load!
  register_compass_extension if compass?
  register_rails_engine      if rails?
  configure_sass
end
rails?() click to toggle source
# File lib/hackathon-bootstrap.rb, line 51
def rails?
  defined?(::Rails)
end
stylesheets_path() click to toggle source
# File lib/hackathon-bootstrap.rb, line 26
def stylesheets_path
  File.join assets_path, 'stylesheets'
end
theme() click to toggle source
# File lib/hackathon-bootstrap.rb, line 17
def theme
  @@theme
end
use(theme) click to toggle source
# File lib/hackathon-bootstrap.rb, line 13
def use theme
  @@theme = theme
end

Private Class Methods

configure_sass() click to toggle source
# File lib/hackathon-bootstrap.rb, line 57
def configure_sass
  require 'sass'

  ::Sass.load_paths << stylesheets_path

  # bootstrap requires minimum precision of 10, see https://github.com/twbs/bootstrap-sass/issues/409
  ::Sass::Script::Number.precision = [10, ::Sass::Script::Number.precision].max
end
register_compass_extension() click to toggle source
# File lib/hackathon-bootstrap.rb, line 66
def register_compass_extension
  ::Compass::Frameworks.register(
      'bootstrap',
      :version               => "#{Hackathon::Bootstrap::VERSION}.#{Hackathon::Bootstrap::PATCHLEVEL}",
      :path                  => gem_path,
      :stylesheets_directory => stylesheets_path,
      :templates_directory   => File.join(gem_path, 'templates')
  )
end
register_rails_engine() click to toggle source
# File lib/hackathon-bootstrap.rb, line 76
def register_rails_engine
  require 'hackathon/bootstrap/engine'
end