Module: PusherChameleon

Defined in:
lib/pusher_chameleon.rb,
lib/pusher_chameleon/engine.rb,
lib/pusher_chameleon/version.rb

Defined Under Namespace

Modules: Rails

Constant Summary collapse

VERSION =
JSON.load(
      File.open(
File.expand_path('../../../package.json', __FILE__)))['version']

Class Method Summary collapse

Class Method Details

.assets_pathObject



32
33
34
# File 'lib/pusher_chameleon.rb', line 32

def assets_path
  @assets_path ||= File.join gem_path, ''
end

.gem_pathObject

Paths



16
17
18
# File 'lib/pusher_chameleon.rb', line 16

def gem_path
  @gem_path ||= File.expand_path '..', File.dirname(__FILE__)
end

.images_pathObject



28
29
30
# File 'lib/pusher_chameleon.rb', line 28

def images_path
  File.join assets_path, 'images'
end

.javascripts_pathObject



24
25
26
# File 'lib/pusher_chameleon.rb', line 24

def javascripts_path
  File.join assets_path, 'javascripts'
end

.load!Object

Inspired by Kaminari



4
5
6
7
8
9
10
11
12
13
# File 'lib/pusher_chameleon.rb', line 4

def load!

  if rails?
    register_rails_engine
  elsif sprockets?
    register_sprockets
  end

  configure_sass
end

.rails?Boolean

Returns:

  • (Boolean)


41
42
43
44
# File 'lib/pusher_chameleon.rb', line 41

def rails?
  defined?(::Rails)
  autoload 'VERSION', 'pusher_chameleon/version'
end

.sprockets?Boolean

Environment detection helpers

Returns:

  • (Boolean)


37
38
39
# File 'lib/pusher_chameleon.rb', line 37

def sprockets?
  defined?(::Sprockets)
end

.stylesheets_pathObject



20
21
22
# File 'lib/pusher_chameleon.rb', line 20

def stylesheets_path
  File.join assets_path, 'stylesheets'
end