Sha256: 744aaf679eb09b9d75b00a7a36da32af6cfb5cb62d78143337c6d98372ad89d6

Contents?: true

Size: 896 Bytes

Versions: 7

Compression:

Stored size: 896 Bytes

Contents

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

7 entries across 7 versions & 1 rubygems

Version Path
rbs-2.6.0 lib/rbs/collection/installer.rb
rbs-2.5.1 lib/rbs/collection/installer.rb
rbs-2.5.0 lib/rbs/collection/installer.rb
rbs-2.4.0 lib/rbs/collection/installer.rb
rbs-2.3.2 lib/rbs/collection/installer.rb
rbs-2.3.1 lib/rbs/collection/installer.rb
rbs-2.3.0 lib/rbs/collection/installer.rb