lib/pugin.rb in pugin-0.6.4 vs lib/pugin.rb in pugin-0.7.0

- old
+ new

@@ -1,18 +1,18 @@ require 'pugin/version' module Pugin - ASSET_VERSION = '1.4.3'.freeze + ASSET_VERSION = '1.4.5'.freeze ASSET_LOCATION_URL = ENV.fetch('ASSET_LOCATION_URL', 'https://s3-eu-west-1.amazonaws.com/web1devci.pugin-website') class << self # Inspired by bootsrap-sass def load! if rails? register_rails_files elsif sinatra? - add_i18n_paths + register_sinatra_files elsif sprockets? register_sprockets end # Try and load HAML, raising an error if we are not able to @@ -63,15 +63,35 @@ private def register_rails_files require 'pugin/engine' - require 'pugin/railtie' + require 'pugin/railtie' + setup_features end + def register_sinatra_files + add_i18n_paths + setup_features + require 'pugin/view_helpers' + end + def add_i18n_paths require 'i18n' I18n.load_path += Dir[File.join(gem_path, 'config', 'locales', '*.yml')] + end + + def setup_bandiera + raise(LoadError, 'pugin requires the host application to be using the bandiera-client gem. Please check your Gemfile and try again.') unless defined?(::Bandiera::Client) + raise(LoadError, 'pugin requires the environment variable BANDIERA_URL to be set. Please set the environment variable and try again.') unless ENV['BANDIERA_URL'] + + require 'pugin/bandiera' + include PuginBandieraClient + end + + def setup_features + setup_bandiera + require 'pugin/feature' end def register_sprockets Sprockets.append_path(images_path) Sprockets.append_path(javascripts_path)