Sha256: 9ed49de1b8ceeb7fe5744fe263ddcaf2023555f9728775f3324a5187ecf287da

Contents?: true

Size: 913 Bytes

Versions: 29

Compression:

Stored size: 913 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::Lockfile.from_lockfile(lockfile_path: lockfile_path, data: YAML.load_file(lockfile_path))
        @stdout = stdout
      end

      def install_from_lockfile
        install_to = lockfile.fullpath
        install_to.mkpath
        selected = lockfile.gems.select do |name, gem|
          gem[:source].has?(name, gem[:version])
        end
        selected.each_value do |gem|
          gem[:source].install(
            dest: install_to,
            name: gem[:name],
            version: gem[:version],
            stdout: stdout
          )
        end
        CLI::ColoredIO.new(stdout: stdout).puts_green("It's done! #{selected.size} gems' RBSs now installed.")
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
rbs-3.8.1 lib/rbs/collection/installer.rb
rbs-3.8.0 lib/rbs/collection/installer.rb
rbs-3.8.0.pre.1 lib/rbs/collection/installer.rb
rbs-3.7.0.pre.1 lib/rbs/collection/installer.rb
rbs-3.7.0.dev.1 lib/rbs/collection/installer.rb
rbs-3.6.1 lib/rbs/collection/installer.rb
rbs-3.6.0 lib/rbs/collection/installer.rb
rbs-3.6.0.pre.3 lib/rbs/collection/installer.rb
rbs-3.6.0.pre.2 lib/rbs/collection/installer.rb
rbs-3.6.0.pre.1 lib/rbs/collection/installer.rb
rbs-3.6.0.dev.1 lib/rbs/collection/installer.rb
rbs-3.5.3 lib/rbs/collection/installer.rb
rbs-3.5.2 lib/rbs/collection/installer.rb
rbs-3.5.1 lib/rbs/collection/installer.rb
rbs-3.5.1.pre.1 lib/rbs/collection/installer.rb
rbs-3.5.0 lib/rbs/collection/installer.rb
rbs-3.5.0.pre.2 lib/rbs/collection/installer.rb
rbs-3.5.0.pre.1 lib/rbs/collection/installer.rb
rbs-3.4.4 lib/rbs/collection/installer.rb
rbs-3.4.3 lib/rbs/collection/installer.rb