Sha256: 7d0e67d8ee6188cfa4311e80632317a0ce2c0347900ae6d87719fb50a0defaac

Contents?: true

Size: 927 Bytes

Versions: 11

Compression:

Stored size: 927 Bytes

Contents

# frozen_string_literal: true

module RBS
  module Collection
    class Installer
      attr_reader :lockfile
      attr_reader :stdout

      def initialize(lockfile_path:, stdout: $stdout)
        @lockfile = Config.from_path(lockfile_path)
        @stdout = stdout
      end

      def install_from_lockfile
        install_to = lockfile.repo_path
        install_to.mkpath
        lockfile.gems.each do |config_entry|
          source_for(config_entry).install(dest: install_to, config_entry: config_entry, stdout: stdout)
        end
        stdout.puts "It's done! #{lockfile.gems.size} gems' RBSs now installed."
      end

      private def source_for(config_entry)
        @source_for ||= {}
        key = config_entry['source']
        unless key
          raise "Cannot find source of '#{config_entry['name']}' gem"
        end
        @source_for[key] ||= Sources.from_config_entry(key)
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
getargv-0.3.3-universal-darwin vendor/bundle/ruby/3.3.0/gems/rbs-2.8.4/lib/rbs/collection/installer.rb
rbs-2.8.4 lib/rbs/collection/installer.rb
rbs-2.8.3 lib/rbs/collection/installer.rb
rbs-2.8.2 lib/rbs/collection/installer.rb
rbs-2.8.1 lib/rbs/collection/installer.rb
rbs-2.8.0 lib/rbs/collection/installer.rb
rbs-2.8.0.pre.1 lib/rbs/collection/installer.rb
rbs-2.7.0 lib/rbs/collection/installer.rb
rbs-2.7.0.pre.3 lib/rbs/collection/installer.rb
rbs-2.7.0.pre.2 lib/rbs/collection/installer.rb
rbs-2.7.0.pre.1 lib/rbs/collection/installer.rb