Class: Mvnizer::Command::AddDependency

Inherits:
Object
  • Object
show all
Includes:
TaskHelper
Defined in:
lib/mvnizer/commands/add_dependency.rb

Constant Summary

Constants included from TaskHelper

TaskHelper::TEMPLATE_DIR

Instance Method Summary collapse

Methods included from TaskHelper

#add_dependency, #create_dir, #generate_file

Instance Method Details

#run(options) ⇒ Object



6
7
8
9
10
11
12
13
14
# 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