class Jars::MavenExec
def setup(spec = nil, allow_no_file: false)
def setup(spec = nil, allow_no_file: false) spec ||= find_spec(allow_no_file) case spec when String @specfile = File.expand_path(spec) @basedir = File.dirname(@specfile) Dir.chdir(@basedir) do spec = eval(File.read(@specfile), TOPLEVEL_BINDING, @specfile) # rubocop:disable Security/Eval end when Gem::Specification if File.exist?(spec.loaded_from) @basedir = spec.gem_dir @specfile = spec.loaded_from else # this happens with bundle and local gems # there the spec_file is "not installed" but inside # the gem_dir directory Dir.chdir(spec.gem_dir) do setup(nil, allow_no_file: true) end end when nil # ignore else Jars.debug('spec must be either String or Gem::Specification. ' \ 'File an issue on github if you need it.') end @spec = spec end