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/global_search.rb,
lib/pugin/feature/status_banner.rb,
lib/pugin/feature/simple_feature.rb,
lib/pugin/feature/asset_overrides.rb,
lib/pugin/feature/pingdom_feature.rb,
lib/pugin/helpers/controller_helpers.rb

Defined Under Namespace

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

Constant Summary collapse

ASSET_VERSION =
'1.12.1'.freeze
ASSET_LOCATION_URL =
ENV.fetch('ASSET_LOCATION_URL', 'https://static.parliament.uk/pugin')
STATIC_ASSET_LOCATION_URL =
ENV.fetch('STATIC_ASSET_LOCATION_URL', 'https://s3-eu-west-1.amazonaws.com/web1live.static-assets')
STATIC_ASSET_PUBLIC_LOCATION_URL =
ENV.fetch('STATIC_ASSET_PUBLIC_LOCATION_URL', 'https://static.parliament.uk/assets-public')
VERSION =
'1.10.7'.freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.alternatesObject



11
12
13
# File 'lib/pugin.rb', line 11

def alternates
	@alternates || []
end

Class Method Details

.assets_pathObject



54
55
56
# File 'lib/pugin.rb', line 54

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

.gem_pathObject

Paths



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

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

.images_pathObject



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

def images_path
	File.join assets_path, 'images'
end

.javascripts_pathObject



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

def javascripts_path
	File.join assets_path, 'javascripts'
end

.load!Object

Inspired by bootsrap-sass



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/pugin.rb', line 16

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)


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

def rails?
	defined?(::Rails)
end

.sinatra?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/pugin.rb', line 63

def sinatra?
	defined?(::Sinatra)
end

.sprockets?Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/pugin.rb', line 67

def sprockets?
	defined?(::Sprockets)
end

.stylesheets_pathObject



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

def stylesheets_path
	File.join assets_path, 'stylesheets'
end

.views_pathObject



50
51
52
# File 'lib/pugin.rb', line 50

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