Class: Grundler::Commands::Remove

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

Instance Method Summary collapse

Methods included from Common

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

Constructor Details

#initialize(cli, packages, json_writer) ⇒ Remove

Returns a new instance of Remove.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/grundler/commands/remove.rb', line 8

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

  if packages.empty?
    puts "Must specify a package name!"
    return
  end

  json_writer.remove(delete(packages))
end