module PusherChameleon

Constants

VERSION

Public Class Methods

assets_path() click to toggle source
# File lib/pusher-chameleon.rb, line 32
def assets_path
  @assets_path ||= File.join gem_path, ''
end
gem_path() click to toggle source

Paths

# File lib/pusher-chameleon.rb, line 16
def gem_path
  @gem_path ||= File.expand_path '..', File.dirname(__FILE__)
end
images_path() click to toggle source
# File lib/pusher-chameleon.rb, line 28
def images_path
  File.join assets_path, 'images'
end
javascripts_path() click to toggle source
# File lib/pusher-chameleon.rb, line 24
def javascripts_path
  File.join assets_path, 'javascripts'
end
load!() click to toggle source

Inspired by Kaminari

# File lib/pusher-chameleon.rb, line 4
def load!

  if rails?
    register_rails_engine
  elsif sprockets?
    register_sprockets
  end

  configure_sass
end
rails?() click to toggle source
# File lib/pusher-chameleon.rb, line 41
def rails?
  defined?(::Rails)
  autoload 'VERSION', 'pusher-chameleon/version'
end
sprockets?() click to toggle source

Environment detection helpers

# File lib/pusher-chameleon.rb, line 37
def sprockets?
  defined?(::Sprockets)
end
stylesheets_path() click to toggle source
# File lib/pusher-chameleon.rb, line 20
def stylesheets_path
  File.join assets_path, 'stylesheets'
end

Private Class Methods

configure_sass() click to toggle source
# File lib/pusher-chameleon.rb, line 48
def configure_sass
  require 'sass'

  ::Sass.load_paths << stylesheets_path

  # bootstrap requires minimum precision of 8, see https://github.com/twbs/bootstrap-sass/issues/409
  ::Sass::Script::Number.precision = [8, ::Sass::Script::Number.precision].max
end
register_rails_engine() click to toggle source
# File lib/pusher-chameleon.rb, line 58
def register_rails_engine
  require 'pusher-chameleon/engine'
end
register_sprockets() click to toggle source
# File lib/pusher-chameleon.rb, line 63
def register_sprockets
  Sprockets.append_path(stylesheets_path)
  Sprockets.append_path(javascripts_path)
  Sprockets.append_path(images_path)
end