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.



9
10
11
12
# File 'lib/rbs/collection/installer.rb', line 9

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.



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

def lockfile
  @lockfile
end

#stdoutObject (readonly)

Returns the value of attribute stdout.



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

def stdout
  @stdout
end

Instance Method Details

#install_from_lockfileObject



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

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