Sha256: cc7ada579c57d57022507dbd50ef88938eb21f8896158176aa21b645c8fc3d9d

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

require 'sass_paths'
require 'nesta/env'
require 'nesta/path'
module Nesta
  module ContentFocus
    class Paths
      def self.public_paths
        lock.synchronize do
          @public_paths || []
        end
      end

      def self.view_paths
        lock.synchronize do
          @view_paths || []
        end
      end

      def self.add_public_path(path)
        lock.synchronize do
          @public_paths ||= []
          @public_paths.unshift(path)
        end
      end

      def self.add_view_path(path)
        lock.synchronize do
          @view_paths ||= []
          @view_paths.unshift(path)
        end
      end

      def self.add_sass_path(path)
        Sass.load_paths << path
        SassPaths.append(path)
      end

      def self.setup_base_app
        app_root = Nesta::Env.root
        asset_base = File.expand_path('../../assets', File.dirname(__FILE__))
        style_path = File.join(asset_base, 'stylesheets')
        add_sass_path(style_path)
        add_public_path(File.expand_path('public', app_root))
        add_view_path(File.expand_path('views', app_root))
      end

      def self.lock
        @lock || Mutex.new
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nesta-contentfocus-extensions-0.0.3 lib/nesta-contentfocus-extensions/paths.rb
nesta-contentfocus-extensions-0.0.2 lib/nesta-contentfocus-extensions/paths.rb