Class: EPC::Command::DeleteDependencyCommand
- Inherits:
-
DeleteCommand
- Object
- BaseCommand
- DeleteCommand
- EPC::Command::DeleteDependencyCommand
- Defined in:
- lib/epc/command/dependency/delete_dependency_command.rb
Constant Summary
Constants inherited from BaseCommand
BaseCommand::GIVEUP_TICKS, BaseCommand::SLEEP_TIME, BaseCommand::TICKER_TICKS
Instance Attribute Summary
Attributes inherited from BaseCommand
Instance Method Summary collapse
Methods inherited from BaseCommand
#go, inherited, #initialize, required_options
Methods included from PersistentAttributes
#auth_token, #caller_id, #target_url
Constructor Details
This class inherits a constructor from EPC::Command::BaseCommand
Instance Method Details
#execute(dependency_id = nil, target = nil) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/epc/command/dependency/delete_dependency_command.rb', line 4 def execute(dependency_id = nil, target = nil) path = File.(".") project = target.split(":")[1] rescue nil ids = project.split(":") rescue [nil, nil] if ids.size == 1 project_name = ids[0] solution_name = nil elsif ids.size == 2 solution_name, project_name = ids end solution_id, solution_name = infer_solution_context(solution_name, path) project_id, project_name = infer_project_context(project_name, path, solution_id) raise FatalError, "Project could not be inferred" if project_id.blank? || project_id == 0 proceed = ask_yn("Are you sure you want to delete the dependency with id = [#{dependency_id}]. Correct? [Yn] ") if proceed.upcase == 'N' return 1 end status, response, headers = client.delete(EPC::Config::PROJECTS_PATH + "/#{project_id}/remove_dependency/#{dependency_id}") if status.successful? say("Dependency deleted") else say("Request failed: [#{response[:message]}]") end return status end |