Module: Pugin

Defined in:
lib/pugin.rb,
lib/pugin/engine.rb,
lib/pugin/feature.rb,
lib/pugin/railtie.rb,
lib/pugin/version.rb,
lib/pugin/bandiera.rb,
lib/pugin/view_helpers.rb,
lib/pugin/feature/bandiera.rb,
lib/pugin/feature/status_banner.rb,
lib/pugin/feature/simple_feature.rb,
lib/pugin/feature/top_navigation.rb,
lib/pugin/helpers/controller_helpers.rb

Defined Under Namespace

Modules: Feature, Helpers, PuginBandieraClient, ViewHelpers Classes: Engine, Railtie

Constant Summary collapse

ASSET_VERSION =
'1.4.5'.freeze
ASSET_LOCATION_URL =
ENV.fetch('ASSET_LOCATION_URL', 'https://s3-eu-west-1.amazonaws.com/web1devci.pugin-website')
VERSION =
'0.7.1'.freeze

Class Method Summary collapse

Class Method Details

.assets_pathObject



47
48
49
# File 'lib/pugin.rb', line 47

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

.gem_pathObject

Paths



27
28
29
# File 'lib/pugin.rb', line 27

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

.images_pathObject



31
32
33
# File 'lib/pugin.rb', line 31

def images_path
  File.join assets_path, 'images'
end

.javascripts_pathObject



35
36
37
# File 'lib/pugin.rb', line 35

def javascripts_path
  File.join assets_path, 'javascripts'
end

.load!Object

Inspired by bootsrap-sass



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/pugin.rb', line 9

def load!
    if rails?
      register_rails_files
    elsif sinatra?
      register_sinatra_files
    elsif sprockets?
      register_sprockets
  end

  # Try and load HAML, raising an error if we are not able to
  begin
    require 'haml'
  rescue LoadError => e
    raise(LoadError, "pugin requires the 'haml' gem. Please check it is in your Gemfile - #{e.message}")
  end
end

.rails?Boolean

Environment detection helpers

Returns:

  • (Boolean)


52
53
54
# File 'lib/pugin.rb', line 52

def rails?
  defined?(::Rails)
end

.sinatra?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/pugin.rb', line 56

def sinatra?
  defined?(::Sinatra)
end

.sprockets?Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/pugin.rb', line 60

def sprockets?
  defined?(::Sprockets)
end

.stylesheets_pathObject



39
40
41
# File 'lib/pugin.rb', line 39

def stylesheets_path
  File.join assets_path, 'stylesheets'
end

.views_pathObject



43
44
45
# File 'lib/pugin.rb', line 43

def views_path
  File.join gem_path, 'app', 'views'
end