class Grundler::CLI

Public Class Methods

new() click to toggle source
# File lib/grundler.rb, line 18
def initialize
  json_writer = PackageJsonWriter.new(lockfile_path)
  Grundler::Commands.const_get(current_command).new(self, arguments, json_writer)
end

Public Instance Methods

arguments() click to toggle source
# File lib/grundler.rb, line 27
def arguments
  @switches = ARGV.select { |a| a[0] == "-" }

  ARGV.drop(1) - @switches
end
current_command() click to toggle source
# File lib/grundler.rb, line 23
def current_command
  COMMANDS.find { |c| ARGV.first == c }&.capitalize || "Help"
end
lockfile_path() click to toggle source
# File lib/grundler.rb, line 39
def lockfile_path
  LOCKFILE_PATH
end
nodule_path() click to toggle source
# File lib/grundler.rb, line 33
def nodule_path
  @nodule_path ||=
    (JSON.parse(File.read(LOCKFILE_PATH))["nodulePath"] if File.exist?(LOCKFILE_PATH)) ||
    DEFAULT_NODULE_PATH
end