class Mvnizer::Command::AddDependency

Public Instance Methods

run(options) click to toggle source
# File lib/mvnizer/commands/add_dependency.rb, line 6
def run(options)
  raise Mvnizer::FileNotFoundError, "The pom.xml file cannot be found." unless pom_present?
  
  dependency = options[:name]
  content = add_dependency([dependency])
  File.open("pom.xml", "w") do |f|
    f.write(content)
  end
end

Private Instance Methods

pom_present?() click to toggle source
# File lib/mvnizer/commands/add_dependency.rb, line 17
def pom_present?
  File.exists?(File.join(Dir.pwd, "pom.xml"))
end