Sha256: 9ad82e99b362c7066db903af84552a317887107f2f348727b1ab9da013615fc8

Contents?: true

Size: 1.6 KB

Versions: 91

Compression:

Stored size: 1.6 KB

Contents

module Sass
  module Importers
    # This importer emits a deprecation warning the first time it is used to
    # import a file. It is used to deprecate the current working
    # directory from the list of automatic sass load paths.
    class DeprecatedPath < Filesystem
      # @param root [String] The absolute, expanded path to the folder that is deprecated.
      def initialize(root)
        @specified_root = root
        @warning_given = false
        super
      end

      # @see Sass::Importers::Base#find
      def find(*args)
        found = super
        if found && !@warning_given
          @warning_given = true
          Sass::Util.sass_warn deprecation_warning
        end
        found
      end

      # @see Base#directories_to_watch
      def directories_to_watch
        # The current working directory was not watched in Sass 3.2,
        # so we continue not to watch it while it's deprecated.
        []
      end

      # @see Sass::Importers::Base#to_s
      def to_s
        "#{@root} (DEPRECATED)"
      end

      protected

      # @return [String] The deprecation warning that will be printed the first
      #   time an import occurs.
      def deprecation_warning
        path = @specified_root == "." ? "the current working directory" : @specified_root
        <<WARNING
DEPRECATION WARNING: Importing from #{path} will not be
automatic in future versions of Sass.  To avoid future errors, you can add it
to your environment explicitly by setting `SASS_PATH=#{@specified_root}`, by using the -I command
line option, or by changing your Sass configuration options.
WARNING
      end
    end
  end
end

Version data entries

91 entries across 89 versions & 8 rubygems

Version Path
brakeman-3.7.0 bundle/ruby/2.3.0/gems/sass-3.4.24/lib/sass/importers/deprecated_path.rb
brakeman-3.6.2 bundle/ruby/2.3.0/gems/sass-3.4.24/lib/sass/importers/deprecated_path.rb
sass-3.4.24 lib/sass/importers/deprecated_path.rb
brakeman-3.6.1 bundle/ruby/2.3.0/gems/sass-3.4.23/lib/sass/importers/deprecated_path.rb
brakeman-3.6.0 bundle/ruby/2.3.0/gems/sass-3.4.23/lib/sass/importers/deprecated_path.rb
brakeman-3.5.0 bundle/ruby/2.3.0/gems/sass-3.4.23/lib/sass/importers/deprecated_path.rb
arcabouco-0.2.13 vendor/bundle/gems/sass-3.4.23/lib/sass/importers/deprecated_path.rb
arcabouco-0.2.13 vendor/bundle/gems/sass-3.4.22/lib/sass/importers/deprecated_path.rb
sass-3.4.23 lib/sass/importers/deprecated_path.rb
brakeman-3.4.1 bundle/ruby/2.3.0/gems/sass-3.4.22/lib/sass/importers/deprecated_path.rb
brakeman-3.4.0 bundle/ruby/2.3.0/gems/sass-3.4.22/lib/sass/importers/deprecated_path.rb
sass-3.5.0.pre.rc.1 lib/sass/importers/deprecated_path.rb
brakeman-3.3.5 bundle/ruby/2.3.0/gems/sass-3.4.22/lib/sass/importers/deprecated_path.rb
brakeman-3.3.4 bundle/ruby/2.3.0/gems/sass-3.4.22/lib/sass/importers/deprecated_path.rb
brakeman-3.3.3 bundle/ruby/2.3.0/gems/sass-3.4.22/lib/sass/importers/deprecated_path.rb
brakeman-3.3.2 bundle/ruby/2.3.0/gems/sass-3.4.22/lib/sass/importers/deprecated_path.rb
brakeman-3.3.1 bundle/ruby/2.3.0/gems/sass-3.4.22/lib/sass/importers/deprecated_path.rb
brakeman-3.3.0 bundle/ruby/2.3.0/gems/sass-3.4.22/lib/sass/importers/deprecated_path.rb
sass-3.4.22 lib/sass/importers/deprecated_path.rb
sass-3.4.21 lib/sass/importers/deprecated_path.rb