Sha256: a2c20724e8653bc577ca91aa17c1e02dcb8f1269cfca717b2f96844a9de9b158

Contents?: true

Size: 1.69 KB

Versions: 17

Compression:

Stored size: 1.69 KB

Contents

module Steep
  class Project
    class Options
      PathOptions = _ = Struct.new(:core_root, :stdlib_root, :repo_paths, keyword_init: true) do
        # @implements PathOptions

        def customized_stdlib?
          stdlib_root != nil
        end

        def customized_core?
          core_root != nil
        end
      end

      attr_reader :libraries
      attr_accessor :paths
      attr_accessor :collection_config_path

      def initialize
        @paths = PathOptions.new(repo_paths: [])
        @libraries = []
      end

      def collection_lock_path
        if collection_config_path
          RBS::Collection::Config.to_lockfile_path(collection_config_path)
        end
      end

      def load_collection_lock(force: false)
        @collection_lock = nil if force
        @collection_lock ||=
          if collection_config_path && collection_lock_path
            case
            when !collection_config_path.file?
              collection_config_path
            when !collection_lock_path.file?
              collection_lock_path
            else
              begin
                content = YAML.load_file(collection_lock_path)
                lock_file = RBS::Collection::Config::Lockfile.from_lockfile(lockfile_path: collection_lock_path, data: content)
                lock_file.check_rbs_availability!
                lock_file
              rescue YAML::SyntaxError, RBS::Collection::Config::CollectionNotAvailable => exn
                exn
              end
            end
          end
      end

      def collection_lock
        case config = load_collection_lock()
        when RBS::Collection::Config::Lockfile
          config
        else
          nil
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
steep-1.9.1 lib/steep/project/options.rb
steep-1.9.0 lib/steep/project/options.rb
steep-1.9.0.dev.2 lib/steep/project/options.rb
steep-1.9.0.dev.1 lib/steep/project/options.rb
steep-1.8.3 lib/steep/project/options.rb
steep-1.8.2 lib/steep/project/options.rb
steep-1.8.1 lib/steep/project/options.rb
steep-1.8.0 lib/steep/project/options.rb
steep-1.8.0.pre.2 lib/steep/project/options.rb
steep-1.8.0.pre.1 lib/steep/project/options.rb
steep-1.8.0.dev.2 lib/steep/project/options.rb
steep-1.8.0.dev.1 lib/steep/project/options.rb
steep-1.7.1 lib/steep/project/options.rb
steep-1.7.0 lib/steep/project/options.rb
steep-1.7.0.dev.3 lib/steep/project/options.rb
steep-1.7.0.dev.2 lib/steep/project/options.rb
steep-1.7.0.dev.1 lib/steep/project/options.rb