Class: Grundler::Commands::Install

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/grundler/commands/install.rb

Instance Method Summary collapse

Methods included from Common

#install, #latest_version, #module?, #no_such_package

Constructor Details

#initialize(cli, _arguments, _json_writer) ⇒ Install

Returns a new instance of Install.



8
9
10
11
12
13
14
15
16
17
# File 'lib/grundler/commands/install.rb', line 8

def initialize(cli, _arguments, _json_writer)
  super(cli)
  unless File.exist?(Grundler::LOCKFILE_PATH)
    puts "No #{Grundler::LOCKFILE_PATH} file found!"
    return
  end

  loaded_versions = JSON.parse(File.read(Grundler::LOCKFILE_PATH))["dependencies"]
  loaded_versions.each { |k, v| install(specific_version(k, v)) }
end