Class: RBS::Collection::Installer

Inherits:
Object
  • Object
show all
Defined in:
lib/rbs/collection/installer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lockfile_path:, stdout: $stdout) ⇒ Installer

Returns a new instance of Installer.



7
8
9
10
# File 'lib/rbs/collection/installer.rb', line 7

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

Instance Attribute Details

#lockfileObject (readonly)

Returns the value of attribute lockfile.



4
5
6
# File 'lib/rbs/collection/installer.rb', line 4

def lockfile
  @lockfile
end

#stdoutObject (readonly)

Returns the value of attribute stdout.



5
6
7
# File 'lib/rbs/collection/installer.rb', line 5

def stdout
  @stdout
end

Instance Method Details

#install_from_lockfileObject



12
13
14
15
16
17
18
19
# File 'lib/rbs/collection/installer.rb', line 12

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