Class: Mvnizer::Mvnize
- Inherits:
-
Object
- Object
- Mvnizer::Mvnize
- Includes:
- Configuration
- Defined in:
- lib/mvnizer/mvnize.rb
Overview
Mvnize is the main entry point into Mvnizer.
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#initialize(coordinate_parser = Mvnizer::CoordinateParser.new) ⇒ Mvnize
constructor
A new instance of Mvnize.
-
#run(options) ⇒ Object
Execute the right command depending on the :command parameter passed in
options.
Methods included from Configuration
Constructor Details
#initialize(coordinate_parser = Mvnizer::CoordinateParser.new) ⇒ Mvnize
Returns a new instance of Mvnize.
7 8 9 |
# File 'lib/mvnizer/mvnize.rb', line 7 def initialize(coordinate_parser = Mvnizer::CoordinateParser.new) @coordinate_parser = coordinate_parser end |
Instance Attribute Details
#out ⇒ Object
11 12 13 |
# File 'lib/mvnizer/mvnize.rb', line 11 def out @out ||= $stdout end |
Instance Method Details
#run(options) ⇒ Object
Execute the right command depending on the :command parameter passed in options. If the command does not exit, throw an error.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/mvnizer/mvnize.rb', line 18 def run() raise ArgumentError, "Please give a name to the project." unless [:name] case [:command] when "new" project_details = define_project() project_command = Mvnizer::Command::ProjectFactory.create(project_details.type) project_command.run(project_details) out.puts("Project #{project_details.artifact_id} created successfully.") when "search" search_command = Command::SearchArtefact.new search_command.run() when "add" add_command = Command::AddDependency.new add_command.run() else raise ArgumentError, "#{options[:command]} is not a valid command." end end |